The Internet of Things, and how those Things phone home

Howdy Pierce

There’s a lot of buzz about the Internet of Things, or IoT. This catchphrase is designed to encompass a whole range of embedded devices that connect to cloud servers to act more intelligently than they could on their own.

Network topology for a Thing to connect to a Cloud Server.

The Internet of Things exists in all sorts of settings—commercial, industrial, even in the backcountry—but there is particular focus these days on home automation. All sorts of Things in the home are being connected: light switches, security cameras, thermostats, refrigerators, moisture sensors, and more. It’s nearly impossible to think up a possible category of home automation where someone isn’t offering an IoT-style product. In fact, we’re currently working on several.

For most IoT products, there is an Internet-connected app that the end user uses to control and monitor the Thing. This is a powerful model, for two reasons: It can lead to a simpler Thing, because most or all control can be done through a smartphone app or web page, thus reducing the user interface needed on the device. And two, it can lead to a smarter Thing, because of the possibility for tremendous integration with all sorts of data available on the Internet.

Networking in the residential environment can be difficult, especially if your business model involves selling beyond the tech-savvy engineering community. One problem that comes up is how to design the Thing to connect back to the Cloud Server—how does the Thing phone home? It’s tricky, because usually we are trying to balance the following factors:

  • Because of home firewalls, it’s normally easy for the Thing to connect out to the Server. It’s trickier for the Server to connect directly to the Thing.
  • It’s typically a requirement that the Thing respond quickly when the user changes a setting on his or her smartphone app.
  • We also want the Cloud Server to be capable of efficiently supporting lots (at least hundreds of thousands) of simultaneously connected Things.

There are three fundamental ways for the Thing to phone home:

  1. Polling. This is by far the easiest to implement and most universal, but it’s also the most limited. In this scenario, all connections are outbound from the Thing to the Server. The Thing periodically connects to the Server—usually to a RESTful API—and, in one transaction, uploads its current status and requests any queued commands.Polling is problematic for two reasons. One, returning results or error status from the queued commands requires another round-trip to the Server (and leads to code complexity on the Server, which must track the outstanding command state). Two, more importantly, the latency is high: There is an undesirable delay between when the user issues a command on his app, and when the Thing responds to that command. That delay can be mitigated by having the Thing poll more frequently; but then we start to run into trouble with scaling the Server to handle lots of Things.
  2. Maintain an Open Socket. In this alternate approach, the Thing still initiates the connection, but then holds it open—typically using websockets. You then create a bidirectional protocol between the Thing and the Server that allows either side to initiate a command over the open socket, which results in fast response times when the user issues a command from the app.On the minus side, this approach (at least using websockets) can require more resources to implement on the Thing side. Furthermore, it can quickly run into scalability concerns on the Server—though it’s probably more efficient than polling, depending on your polling interval.
  3. Bi-directional Push. Most connected devices spend a lot of their time in a “nothing-changed” state. So by far the most efficient and scalable case is a bi-directional push, where the Thing connects to the Server only with a relatively infrequent heartbeat message, or when it has something new to report. This direction is a single call to a RESTful API, and is simple to implement.The reverse direction (Server to Thing) is equally important, and it’s hard. There are various ways to punch holes through the firewalls common in houses, although most are over UDP instead of TCP, and none of them is completely reliable because of the diversity of home router technology out in the wild. So if you implement bi-directional push, the Thing needs to be able to fall back to one of the first two methods if it doesn’t work.

I’m unaware of anyone who has deployed the bi-directional push approach in production—but again very few Things have hit the level of commercial success where server-side scalability becomes super important. I expect that to change within the next year.

Categories: Howdy, Networking

Cardinal Peak
Learn more about our Audio & Video capabilities.

Dive deeper into our IoT portfolio

Take a look at the clients we have helped.

We’re always looking for top talent, check out our current openings. 

Contact Us

Please fill out the contact form below and our engineering services team will be in touch soon.

We rely on Cardinal Peak for their ability to bolster our patent licensing efforts with in-depth technical guidance. They have deep expertise and they’re easy to work with.
Diego deGarrido Sr. Manager, LSI
Cardinal Peak has a strong technology portfolio that has complemented our own expertise well. They are communicative, drive toward results quickly, and understand the appropriate level of documentation it takes to effectively convey their work. In…
Jason Damori Director of Engineering, Biamp Systems
We asked Cardinal Peak to take ownership for an important subsystem, and they completed a very high quality deliverable on time.
Matt Cowan Chief Scientific Officer, RealD
Cardinal Peak’s personnel worked side-by-side with our own engineers and engineers from other companies on several of our key projects. The Cardinal Peak staff has consistently provided a level of professionalism and technical expertise that we…
Sherisse Hawkins VP Software Development, Time Warner Cable
Cardinal Peak was a natural choice for us. They were able to develop a high-quality product, based in part on open source, and in part on intellectual property they had already developed, all for a very effective price.
Bruce Webber VP Engineering, VBrick
We completely trust Cardinal Peak to advise us on technology strategy, as well as to implement it. They are a dependable partner that ultimately makes us more competitive in the marketplace.
Brian Brown President and CEO, Decatur Electronics
The Cardinal Peak team started quickly and delivered high-quality results, and they worked really well with our own engineering team.
Charles Corbalis VP Engineering, RGB Networks
We found Cardinal Peak’s team to be very knowledgeable about embedded video delivery systems. Their ability to deliver working solutions on time—combined with excellent project management skills—helped bring success not only to the product…
Ralph Schmitt VP, Product Marketing and Engineering, Kustom Signals
Cardinal Peak has provided deep technical insights, and they’ve allowed us to complete some really hard projects quickly. We are big fans of their team.
Scott Garlington VP Engineering, xG Technology
We’ve used Cardinal Peak on several projects. They have a very capable engineering team. They’re a great resource.
Greg Read Senior Program Manager, Symmetricom
Cardinal Peak has proven to be a trusted and flexible partner who has helped Harmonic to deliver reliably on our commitments to our own customers. The team at Cardinal Peak was responsive to our needs and delivered high quality results.
Alex Derecho VP Professional Services, Harmonic
Yonder Music was an excellent collaboration with Cardinal Peak. Combining our experience with the music industry and target music market, with Cardinal Peak’s technical expertise, the product has made the mobile experience of Yonder as powerful as…
Adam Kidron founder and CEO, Yonder Music
The Cardinal Peak team played an invaluable role in helping us get our first Internet of Things product to market quickly. They were up to speed in no time and provided all of the technical expertise we lacked. They interfaced seamlessly with our i…
Kevin Leadford Vice President of Innovation, Acuity Brands Lighting
We asked Cardinal Peak to help us address a number of open items related to programming our systems in production. Their engineers have a wealth of experience in IoT and embedded fields, and they helped us quickly and diligently. I’d definitely…
Ryan Margoles Founder and CTO, notion