Saturday, January 17, 2015

What makes up the IoT: The digital chatter

Hello Internet. In the last post, we saw some common types of devices on the field, as well as what methods are used to convert them from standalone units to connected devices. Today we will see how the devices actually communicate with each other and how they shoot off their data to the big bad cloud.

Who speaks to who

IoT is a complete ecosystem of devices collaborating with each other to make things smarter. It is important to classify the different types of sources and targets of these collaborations. There are namely the following directions of communication.
Device to device: This involves devices on the field communicating with each other. Typically this happens when one of the devices senses something and it must make sure that all the devices in the field must know about it. Such an intercommunication is called meshing. A network where devices on the field are capable of communicating with each other is called a 'mesh network'.
A typical mesh network
Image courtesy: indigosystems.net.nz
Device to cloud: This is the most frequent communication. Once devices gather info, they must send the info over to the cloud for further analysis. Most of the time, the analysed data never needs to be sent back to the device and is just crunced on the server to show insights to a data analyst. But in some systems, the server needs to process device-sent data immediately and react back to the device. E.g. route calculation on a map to determine the next turn. The system needs to be extremely reactive when the driver takes a wrong turn. Typically, routes are recalculated to keep the driver driving in the same direction instead of making him take a U-turn.
Cloud to device: There are times when a user would like to send instructions to the field to behave a certain way. The same way, some conditions can trigger automated changes to the field. E.g. When a user leaves his office, the heater at his home should be turned on. For these situations, a message is sent over from the cloud towards the field. The field then reacts to such messages and aligns its devices to perform the desired action.

Methods of communication used

Device to device

There are three widespread communication media used for device to device communication: Bluetooth, Zigbee and WiFi. The first two protocols have fixed instructions and fixed formats for the data that can be sent between devices. These are documented in their respective standards. WiFi sets the standards for the hardware, but leaves the data format free to be chosen and hence is preferred over the other two media for a much more generic system. WiFi uses the same communication standards as used by the Internet itself. So by using WiFi, we can think of the devices in the field as a small local network like the one found in your office -- except that these devices operate without much human intervention. In case of WiFi, then methods of communication used are similar to the ones used for Cloud-to-Device, which we will see below.

Cloud to Device

Since the cloud to device communication is the Internet, the standard message passing communications which are used on the Internet are also applicable here. Lets look at the most popular ones.
Chat: Chat protocols are extremely popular and time-tested and can be easily ported over to the IoT scene. Think of the cloud and the devices being on each other's friends list and chatting away all day long. The most popular chat protocol used here is XMPP, also called Jabber, which is the go-to protocol used by popular services like the erstwhile Gtalk (Hangouts has dropped support for Jabber) and Facebook chat. Not only does this protocol offer chat support, but also presence support, i.e. whether a device is offline or online (similar to users). This can be used to determine if a field device has gone down and needs repairs.
Publish / Subscribe: Publish / subscribe is a popular method used by news channels to push the latest news to subscribers. If we use popular news apps on our phones / tablets, we will occasionally see notifications for new news articles. This is publish / subscribe or pub-sub in action. Here the participants subscribe to an entire channel or certain topics and receive notifications when something new is ready. The model can be used on IoT as well, wherein devices can subscribe to new instructions from the cloud and instructions can be sent over. The most popular protocol used here is MQTT (Messaging Queue Telemetry Transport).

Device to Cloud

The cloud to device methods are symmetric methods and can be used for device-to-cloud communications too. But there are a lot of devices in the market which do not need a two way communication and they only need to send data one way (ie. device to cloud), while only receiving an acknowledgement response from the other end. E.g. a weather sensor does not need to pick instructions from the cloud and only needs to send over data. For such purposes, using a two way protocol will be wasteful. So a simple HTTP communication will suffice. HTTP communication is easy to build since it is the most popular protocol on the Internet and the most widely supported. It is easy to find services which offer HTTP off the shelf without installing any custom software modules and drop-dead simple to find engineers to write web services.

Conclusion

We have looked at how the field and the cloud communicate with each other. In the next post, we will see how the cloud gathers the data and what technology is available to store, number crunch and present meaningful and insightful information to the user.

No comments:

Post a Comment