The typical architecture of IoT solutions is often much more complex than that of most enterprise systems. One major factor contributing to the complexity of IoT systems is that the backend services in data centers (the core of most enterprise systems) are actually just a part of the larger IoT picture. With IoT solutions, we must handle a large number of devices operating on-site. Due to the nature of these devices being very different from web, desktop, or even mobile clients, we need an intermediary architecture that acts as a proxy between the world of on-site devices and enterprise data centers.
What we need is an IoT gateway.
Why IoT Gateways Are Needed
You may now wonder: what are the main reasons for introducing a gateway into your IoT architecture? Let me clarify this by discussing some of the most important aspects of how gateway architecture works.
Firstly, sensors typically have very limited capabilities in terms of network connectivity. Your sensors may use Bluetooth Low Energy (BLE), just like most beacons on the market; some of your sensors may also use the ZigBee protocol for connectivity. Many other protocols can also be found in Local Area Networks (LAN), Home Area Networks (HAN), or Personal Area Networks (PAN). All of these protocols have one thing in common – they cannot connect directly to large networks like Wide Area Networks (WAN) or the Internet. You need a gateway that can provide a single point of contact for your sensors with external networks using WiFi, GSM, or other types of connectivity.
Keep in mind that a gateway is not just a dumping proxy that forwards data from sensors to backend services. Sending all the information collected by sensors to data centers is very inefficient in terms of performance and network utilization. An IoT gateway is needed to preprocess on-site information before sending it to the data center. This preprocessing includes message filtering and aggregation.
The gateway should also serve as a single access point for monitoring selected areas of the operational field. You do not need to connect monitoring software to each sensor; monitoring the gateway is easier, and the gateway, in turn, is responsible for collecting all necessary data from the sensors.
Architecture Overview
The following gateway architecture diagram is the most common design, where the gateway itself is not equipped with sensors. The gateway software installed on devices is responsible for collecting data from sensors, preprocessing the data, and sending the results to the data center.
Keep in mind that variations can occur in this sensor architecture, where some sensors are located on the gateway device, as shown in the following diagram.
Embedded sensors in the gateway may include options like GPS units or temperature sensors connected to the gateway using GPIO interfaces.
Gateway Software
The software application is the core of the gateway. The gateway software is responsible for collecting information from sensors and storing it appropriately until it can be preprocessed and sent to the data center. The gateway software decides whether the data at a given processing stage is temporary or persistently stored in memory.
The design of the gateway software should take into account failure and disaster recovery. Since gateway devices typically operate on-site, you should prepare for less than ideal operating conditions. For example, the gateway software should be prepared for power outages or other operations that may disrupt the gateway’s processing. The gateway software should automatically restart immediately after power recovery and continue working from the point of interruption.
The gateway software should also be smart enough to handle system logging correctly. It must find the right balance between the number of log entries stored on the device and the number of log entries sent to the data center.
Software Installation and Updates
How does gateway software get onto the device? There are three main approaches to this question.
The first method is to pre-install the software on the gateway disk (or storage card). This method is called factory bootstrapping. As you might guess, if your solution consists of a large number of gateways, this technique does not scale well.
The second method is server-initiated bootstrapping. In this mode, a central software management server communicates with the gateway device and deploys the correct version of the software to it. This method scales better than factory bootstrapping but still requires server-side initiation of the deployment operation.
The third method is client-initiated bootstrapping. This mode assumes that the gateway is responsible for connecting to a central repository server and downloading the appropriate version of the software. In this case, the gateway needs to install lightweight bootstrap software so that it can communicate with the software management server. This method is the most scalable.
A very important feature of IoT gateways is the ability to download updates wirelessly. Keep in mind that once the gateway software is installed on the device and delivered to the field, your capabilities for maintaining the gateway software are very limited. From a security perspective, the ability to download software updates wirelessly is especially important, as it may affect the delivery time of critical security patches. Because it does not require any centralized coordination for deployment operations. Each gateway device downloads software immediately after power is turned on.
Sensor Consumers
If the software application is the core of the gateway, then the sensors are the eyes and ears of the gateway. Sensors are small hardware devices that can measure certain aspects of the real world. Common types of data collected by sensors include temperature, GPS coordinates, humidity, pressure, etc.
The messages collected by the gateway from sensors are usually quite small. For example, the current value of the temperature measured by a sensor is just a decimal number. GPS coordinates are two decimal numbers representing longitude and latitude. This is an important point to remember: the gateway operates on a large number of small messages.
While sensors themselves can generate messages frequently, it is important to predict how many messages we really need to collect from the sensors. For example, we can read a sensor’s temperature every millisecond, but do we really need that precision when measuring temperature changes? In most cases, reading the sensor value a few times per second is sufficient because we are more interested in metrics over a longer time frame. Gateway software typically polls sensor data at regular intervals. Good gateway software allows you to easily configure the polling interval for each sensor. You absolutely do not want to fill the gateway with unnecessary sensor data, as outdated messages can consume valuable processing power of the limited gateway device.
Gateway Data Transmission
Typically, gateways connect to the internet via GPS, WiFi, or Ethernet. Some gateways can also operate in both GPS and WiFi modes (for example, gateways installed on moving vehicles). Generally, non-GPS connections are prioritized for sending data as they do not require a paid mobile plan. Some gateways will connect continuously to a cheap local network, but those using GPS connections should be very conservative in terms of the data sent to the data center. Gateways should apply business logic to the data they collect to understand which messages should be sent over the expensive GPS network and which data can be cached on the device for delayed offline processing.
Conclusion
Gateways are a key component of every IoT solution. Before deciding which hardware to purchase as a gateway platform, take some time to analyze the data formats of messages and payloads, and try to filter or aggregate as much data as possible before sending it from the gateway to the data center. Additionally, while choosing the right hardware for IoT solutions is important, you must remember that selecting the right gateway software and management infrastructure (such as LWM2M servers for managing devices) will have a significant impact on your overall maintenance costs.
Long press to subscribe for more exciting content ▼