How an IoT Gateway Device Works: Understanding the Architecture
[This is the 2nd blog of our ‘IoT Gateway’ series. You can check-out part 1 here – What is an IoT Gateway Device] .
In our quest to understand IoT Gateway devices better, we requested our IoT Software Developers to shed some light on the technology architecture of the IoT Gateway.
Following are the excerpts from this conversation. If you are an IoT software or hardware developer or an IoT enthusiast, this blog can serve as a good starting point for understanding the various software/hardware modules of the IoT Gateway
Understanding IoT Gateway Architecture – an overview
Design of an IoT Gateway is driven by the ‘Custom Application’ [e.g – fleet management, asset tracking, industrial automation, connected car, infotainment & more]
As an IoT developer, based on the requirement of the application one needs to calibrate the following:
- IoT Sensors range
- Power demands
- Scalability and security
In reference to the below IoT gateway architecture diagram, let us try to understand the various modules or building blocks of the IoT Gateway Device.
IoT Gateway Device Hardware
IoT Gateway Hardware comprises of processor/microcontroller, IoT sensors, protection circuitry, connectivity modules (e.g Zigbee, Bluetooth, WiFi and more).
Type of hardware (processor/microcontroller), processing speed and memory space is decided based on the Operating System of the IoT Gateway device.
The end-user application also has a big say in the design of the IoT Hardware.
A small to a medium scale application can run on a microcontroller; however if the gateway is expected to do complex operations a processor is needed.
This will have a direct impact on the cost of the gateway device.
As an IoT Development partner or vendor, one should always design hardware components by considering performance, cost and efficiency.
Selection of the Operating system is also largely dependent on the IoT application.
If the gateway is to be designed for a simple to medium scale application then a RTOS (Real Time Operating System) is used; however if the gateway has to perform considerably complex operations then Linux is preferred
For the applications like Car HUD or Infotainment systems that require rich GUI then Android OS is the preferred choice.
HAL (Hardware Abstraction Layer)
Hardware Abstraction Layer supports reusability and portability of the IoT software.
This layer makes the software design independent of the underlying hardware platform. Hence it helps to reduce the time and cost required to port the developed software application into a different hardware platform (during migration from the existing platform or re-design of the product line).
IoT Sensors Stack
This layer basically consists of software stacks that serve as interfaces with IoT sensors modules.
Specific stack(s) is/are integrated depending on the sensor interface the IoT Gateway has to support. Some of the populary integrated stacks are ZigBee, 6LoWPAN, EnOcean, BLE, Modbus, PROFIBUS and more.
Device Management and Configuration
An IoT gateway needs to interface with different types of Sensor devices and each sensor node (used for capturing distinct data) has different set of properties.
IoT Gateway device is required to keep track of all the connected devices/sensors.
In addition to this, all the devices/sensors management and configuration tasks are performed at the IoT Gateway.
Thus it is important that the IoT Gateway Device is easily configurable to manage IoT Sensor settings, properties and access control.
The configuration and settings of all the IoT Sensor Devices is stored in the gateway device memory. This ensures that the last saved settings are available after every re-boot.
Gateway security is one of the key considerations in IoT gateway architecture during the IoT Gateway design process.
The designed IoT gateway should ensure robust data security, device security and network security.
Device security and device identity is implemented in the gateway hardware using Crypto Authentication chips. To add further security to the IoT gateway hardware tampering is implemented.
Secure boot is also implemented to ensure that the gateway doesn’t boot from an unauthorized firmware.
All messages between gateway and cloud, and messages between Gateway sensor node is encrypted to ensure data integrity, and confidentiality of sensor nodes. Data to and from every node in a IoT application is encrypted to ensure network security.
Ensuring IoT Gateway security requires continuous and timely efforts; as an IoT Development Partner, one needs to keep fixing the security loop holes fixed and maintain device integrity.
Firmware Over The Air (FOTA) updates makes this possible! FOTA updates ensure that the IoT Gateway software is updated with latest versions of security patches, OS, Firewalls and more.
Within the IoT network, the gateway device periodically checks for firmware updates in the cloud and fetches the update.
In case of failure IoT Gateway reverts to the last best known state. Before the update process begins, IoT Gateway checks if the available firmware version is from a trusted source.
Data Communication Protocols
The IoT Gateway connects with the Cloud over Ethernet, Wi-Fi or a 4G/3G modem. Two way communication channel is established with the Cloud for data exchange and command(s) transfer.
The underlying communication layer is UDP or TCP IP protocol.
For ease of development and to maintain standardization, protocols like MQTT, CoAP, XMPP, AMQP are utilised. This is because handling and maintaining communication with cloud over raw socket is more complex process.
Protocol(s) is/are selected considering the amount and frequency of the data that has to be shared with the Cloud.
Data Management includes data streaming, data filtering and data storing (in case of loss of connectivity with the cloud).
IoT Gateway manages the data from sensor nodes to gateway and also the data from gateway to cloud.
The challenge here is to minimize the delay to ensure data fidelity.
Cloud Connectivity Manager
This layer is responsible for seamless connectivity with the cloud and also handles scenarios like reconnection, device state, heartbeat message, and gateway device authentication with the cloud.
IoT Gateway application is custom designed as per the business needs.
Gateway application interacts with services and functions from all the other layers or modules to manage data between sensor node and gateway and from gateway to cloud in an efficient, secure and responsive manner.
Gateway Data Transfer
IoT gateway can be connected to the internet for data transfer using Ethernet, 4G/3G/GPRS modem or Wifi. Non-GPRS network is the most preferred mode of internet connectivity. This is due to the cost effectiveness of the data transfer through Wifi or Ethernet.
The gateway should have in-built intelligence to analyze and decide which data should be transferred over the network for processing and which data can be cached for offline processing to save the data transfer cost and processing power of the main application.
After understanding the architecture, one realizes that the Design and development of an IoT Gateway device is a work of art!
As an IoT software and hardware developer, it is very important to understand the business needs (and logic) of the IoT Application.
This understanding of the IoT Application is an important factor that contributes to the development of a win-win IoT Gateway design
Though some very popular off-the shelf IoT Gateway solutions are available, but certain customization becomes a necessity to transform a product concept into business reality!