In the previous article, we wet through the devices layer of the architecture. In this article, we would go over the communication layer.
The device layer earlier discussed different types of devices with different networking abilities. Devices will communicate with communication layer to set up network connectivity and send the data to the Internet. This section will feature different communication strategies that one can use based on the available device. We will also discuss different communication protocols.
The section discusses different communication strategies that can be used with IoT devices. It will depict how devices will communicate with the Internet to transmit or send data. The communication strategy is devised based on the networking capability of each device. Talking about device networking capability, hosts of IoT devices by itself are unable to route data directly to the internet due to protocol incompatibility. Though there are some that may be able to connect directly to the Internet. Devices that are unable to connect directly to the Internet make use of something called ‘gateway’ or a ‘hub.’ We will talk about device gateway in detail in next section.
An IoT Device gateway is a device that glues or connects incompatible networks or protocols and provides a means to connect devices to the internet. Low powered devices like sensors connect to a gateway through protocols like Z-wave or Bluetooth LE protocol, which in turn will communicate with the broadband router to route the messages to the internet. A broadband router could use WLAN or WI-FI to connect to the internet. Protocols like ZigBee or Z-wave by itself are not equipped or capable of talking to the internet directly, and therefore gateway device is used. The gateway will translate the incoming ZigBee data into IP data that can be then routed to the internet. Gateways can also act as a firewall thereby securing the devices from any malicious attack.
Smart Gateway We could also have something called as ‘smart’ gateways. Such gateways have their own local storage and embedded application to perform analytics on data streamed directly from the devices. These are also called edge gateways. They are configured right at the edge of the device so that the data need not be sent over the network to the internet and can be analyzed or filtered close to the device in the gateway itself. The concept is also called ‘fog computing’ – a term devised by Cisco. The benefits of edge gateways lie in reduced network traffic and bandwidth, increased efficiency in terms of core data processing and delivering real -time processing.
Tip – Eclipse Kura is an open source project that provides a platform for building IoT edge gateways. It is a smart application container that enables remote management of such gateways and provides a wide range of APIs for allowing you to write and deploy your own IoT application. We would revisit Kura in Chapter 3.
Smartphone as a gateway
Another form of communication could be through the use of smartphones. Instead of the gateway, a device can talk to a smartphone through say Bluetooth protocol and the data can be then channelized to the cellular network through a SIM card. This way a Smartphone can act as a gateway and eliminates the need of having a dedicated gateway device or a broadband router. A limitation to this approach is that smartphone by itself will not automate the process of data communication from the device to the internet. Manual intervention is required to set up the process of communication, for instance launching the corresponding application on the phone.
Certain devices have the capability to connect directly to the Internet without the need of any gateway. It could be either through Wi-Fi or cellular network. Modern day microcontrollers are equipped with a Wi-Fi capability that enables devices to broadcast itself over the internet. The obvious advantage is that there is no need for any dedicated gateway thereby saving that one extra hop to send the data to the cloud or internet.
Another form is a device-to-device communication. This form of communication defers the process of relaying data to the internet. Devices communicate with each other to form a mesh network. Devices communicate to collect information, report their existing states, send alerts or perform discovery routines. The communication could be with or without the human intervention. For example, a home security system may connect with a nearby alarm system to alert if someone approaches a door. The alert then can be sent to the internet so that if you are outside the home, you can get the status update.
API-based communication is the new talk of the town. In this approach, devices communicate its state to an internet service provider (say A) which then uses an API (often a REST URL) to communicate to another service provider (say B) which then triggers action to another device. This kind of API-based communication eliminates the need of installing a shared gateway. This mode of communication is handy when there are multiple disparate devices associated with a vendor service that needs to shake hands to realize a use case.
Communication protocol is responsible for network connectivity. In the parlance of IoT, we will define two forms of communication protocols, one that provides direct Internet connectivity and another that requires some form of gateway to route the data to the Internet. Let’s first look at the protocols that enable us to connect directly with the Internet. The following diagram shows a typical IoT communication model.
Wi-Fi protocol needs no introduction; we can’t imagine a world without Wi-Fi. With Wi-Fi protocol, you can connect any device securely to a Wi-Fi gateway using security options supported by the gateway. Wi-Fi devices consume a lot of power and may not be a good option when it comes to connecting small constrained devices as it can quickly become an overhead for these devices. There arises a need to create a standard like Wi-Fi protocol which makes it easier to discover and connect devices seamlessly with the IoT network. Hopefully, in future, we would have new standardized protocols like Wi-Fi, which caters to requirements of low power consumption, longer battery life, etc. for connected products.
Ethernet Ethernet provides a wired option where devices need to be physically connected to communicate over the network. This option might work for connected solutions like home/office, where devices are generally fixed, but this is not an option for most of the IoT applications, as it makes devices immovable.
Tip – LoRaWAN (Long Range Wide Area Network) is the latest addition to the new set of protocols to address the unique requirements for IoT. It is optimized for low power consumption and to support large networks with millions and millions of devices. The LoRa® Alliance @ https://www.lora-alliance.org/ plans to standardize the Low Power Wide Area Networks being deployed around the world to enable Internet of Things application.
Cellular communication protocols include the connectivity options like 2G, 3G, 4G, LTE, etc. that your phone uses to connect to the cellular network. Similar to phones, this requires a data subscription package from a cellular network provider. From an IoT perspective, a device should not solely depend on cellular protocol but also allow itself to connect to other protocols like Bluetooth LE or Wi-Fi, so as to use existing connectivity options wherever available.
The second form of communication protocols requires a gateway to translate device specific commands into IP equivalent. Let’s look at some of these protocols:
Bluetooth Low Energy as the name suggests is a power efficient version of the standard Bluetooth protocol, specifically designed for devices where power consumption is a key requirement. With Bluetooth LE supported on most of the new generation mobile platforms and operating systems, it provides an option for Bluetooth LE devices to connect to Bluetooth LE mobiles and devices instantly and connect to the cloud platform or interact with the mobile application. Products like health devices or smart watches can use Bluetooth LE and connect with a Smartphones to send data to the cloud for further analysis.
RFID protocol is used to communicate data between RFID tags and readers. RFID tags described earlier in Device Layer section are primarily used for tracking objects, while RFID readers read the unique tag value, which is then further processed by the system. A typical example of RFID in the context of IoT is to track and trace assets or products, where products are tagged by RFID tags and device gateway is installed at entry and exit points which also act as a reader. The data (possibly depicting movements of assets) is read by the reader and sent over to the cloud platform, which can trigger warnings like an unauthorized movement of a particular asset.
Near Field Communication (NFC) is similar to RFID protocol with an exception that the NFC device can act as a tag as well as a reader. NFC is also used for peer-to-peer communication between devices like NFC-enabled Smartphone, which can share data if the devices are near to each other.
NFC-enabled phones can communicate with other NFC-enabled devices and appliances like washing machine, microwave, etc. by installing the required application on the phone, which can help control the device or appliance remotely.
ZigBee / Z-wave ZigBee and Z-wave protocols are used with devices having constrained environment like low processing power, memory and battery life. These protocols are typically used in home automation to create smart homes. They operate on low-frequency radio networks. The frequency can be increased by forming a mesh network topology (connecting similar devices to form a mesh thereby extending communication range). ZigBee and Z-wave cannot directly connect to the internet as they do not support IP networking. You would need a gateway device to route the data to the internet.
In the next article, we will look at some of the communication protocols for IoT.