IoT gateways have become a critical component of IoT deployments today. In this post, we try to understand the need for IoT Gateways and the role they play in an IoT solution architecture.
Integrating ‘Things’ With the Cloud
Some IoT appliances are sufficiently advanced to support the full extent of the TCP/IP stack and to securely communicate directly with your IoT Cloud.
However, we often encounter lightweight IoT sensors and actuators that support local communication interfaces only – such as Zigbee, Bluetooth, RS232, RS485 etc. They do not have the capability or the compute power to support a full TCP/IP stack.
In such cases, an IoT Gateway acts as an intermediary device that is deployed on the field. It provides multiple local interfaces – sensors and actuators connect to these local interfaces:
- Digital IO
- Analog-to-Digital Converter (ADC)
The software on the gateway is then responsible, to aggregate information from sensors and dispatch it to the IoT Cloud. Also, the gateway may receive commands from the cloud, which it relays further to the sensors and actuators via the local interfaces.
IoT Gateways takes care of the protocol impedance mismatch between your IoT Cloud and your sensors (or actuators).
An IoT gateway filters data at the network edge so that only relevant data is dispatched to the IoT cloud. Here are some examples where this is useful:
- Sensors often ‘chirp’ data periodically. A sensor may emit data a much higher frequency than actually needed by your application.
- Data from sensors may include edge values and boundary-conditions which could be ignored.
- Sometimes sensors misfire or provide bad sample values which can be discerned and ignored at the outset.
If all such sample values are dispatched to the Cloud it consumes additional network bandwidth; And such data may not be useful to your application at all.
An IoT gateway allows you to specify filtering rules, so that only useful data is sent to the cloud.
Edge filtering helps sanitize your sensor data before dispatching to the IoT cloud.
In addition to filtering sample values, an IoT gateway also offers some stream processing capability to aggregate and to shape data coming from the sensors. For example:
- Some sensors offer non-linear response curves. Their sampled values may have to be transformed to a linear scale before transmission to the IoT Cloud.
- Sensor response may be within a very wide bit range (Say 128 bits) and needs to be scaled down (Say to 16 bits), since your application does not need such a high resolution of measurement.
- Sensors may exhibit hysteresis, which needs to be compensated for.
- Sensors may exhibit temperature sensitivity, which needs to be compensated for.
- A sensing element may need an average of 5 sample measurements to determine a more precise answer.
Data shaping ensures that any quirks and idiosyncrasies in your sensors are handled before sample values are dispatched to the IoT Cloud.
Most IoT applications involve some kind of a ‘control loop’. For example, if the temperature reaches a certain threshold, we need to shut-off the furnace.
A typical control loop involves one or more sensing element, a decision tree (rules engine), and a command to the actuator. Any control loop exhibits a latency of its own.
While the business logic of the control loop could be implemented on the IoT Cloud, certain applications may require a much faster response time.
In such cases, the business rules (decision making) are localized to the IoT gateway itself. A gateway can trigger an actuator based on certain conditions.
IoT Gateway enables tighter control loops with low response latency.
Aggregating and rolling-up data at the edge (field) before sending it to the Cloud saves substantial bandwidth. IoT gateways often provide data aggregation and analytics capabilities so that only concise information is dispatched to the cloud for further processing and archival.
Enterprise systems often need to ingest telemetry data from the field. However, we need to ensure that appropriate enterprise security mechanisms are enforced before data can be ingested.
For example, lightweight IoT sensors may not have the capability to support TLS, HTTPS, Client Certificates, VPN tunnels etc. which are a standard part of enterprise security today.
An IoT gateway can provide such capabilities which integrating with your enterprise system or with the IoT cloud.
IoT gateways support the necessary enterprise security standards to ensure that only data from trusted client devices is ingested by your enterprise systems.
IoT Cloud platforms support a variety of protocols such as HTTPS, WebSockets, MQTT, AMQP etc. IoT Gateways provide the ability to connect to an IoT Cloud platform over these protocols.
Another role of IoT Gateways is to monitor the health of deployed sensors on the field, and to notify the IoT Cloud in case of an errant sensor.
IoT Gateways referred in this post are often called as Field Gateways, as they are often installed on the field (such as a factory floor).
Field gateways are different than Protocol Gateways which are a common component of IoT Cloud platforms. Protocol gateways are software components which run in the IoT Cloud (not on the field), and offer termination for various IoT protocols such as HTTPS, WebSockets, MQTT etc.
Field gateways can integrate with Protocol Gateways too!
Components of An IoT Gateway
- Compute Capabilities: CPU, Memory, Persistent Store.
- Interface Capabilities: RS232, PCI, Zigbee, Bluetooth etc.
- Network Capabilities: Ethernet, WiFi.
- Embedded OS: Hardened OS such as WindRiver Linux, Ubuntu Core.
If you’re building smart solutions that involve primitive sensors and actuators, IoT Gateways can be an indispensable part of your solution. They offer the ability to integrate with your sensors locally, support multiple cloud protocols, and an ability to filter and shape your data before transmission to the IoT Cloud.