Gateways

An IoT solution, such as in a home, may be relatively simple, with a few devices easily communicating with each other. However, larger and more complex IoT solutions may contain numerous sensors spread across a wide area. These sensors read multiple environmental parameters and send the data at varying intervals, sometimes even continuously in real-time.

When the network of sensors is large and complex, rather than transmitting data directly to the processors, the data is sent to intermediary systems referred to as Gateways.

Gateways can perform several actions before the data is passed on to the processor. They can filter out bad data (referred to as noise) or aggregate data. They can authenticate the sensors to make sure the data is authentic. This pre-processing reduces the load on the processor which plays a vital role in analysing the data, making decisions, and taking actions by sending signals to controllers.

Functions of a Gateway

Data can be sent from one system to another in a synchronous or asynchronous manner. In both approaches, the sending system calls functions or services on the receiving system using APIs. The difference is that in the synchronous approach, the sending system waits for an acknowledgment or a response from the receiving system before continuing its processing, while in the asynchronous approach, the sending system continues its processing without waiting for an acknowledgment or a response from the receiving system.

A synchronous approach is necessary if the sending system expects or needs a response from the receiving system to proceed with its processing. Synchronous exchanges are relatively slower since it takes some time, however small, for the sending system to process the data and send back a response.

In the case of sensors, the only thing they need to do is read the data related to the physical property (such as temperature, light, sound, and so on) they are designed to sense, and pass it on to some other system (usually a processor). They do not need or expect an acknowledgment from the receiving system.

Sensors have to keep reading the physical property continuously. If they have to spend time waiting for an acknowledgment after transmitting the data, they could miss reading new data. Therefore, for sensors, the asynchronous approach is more efficient.

A gateway provides this service, where sensors can pass their data quickly to the gateway and move on. The gateway then queues up the data and passes it to the processor. A simple gateway may pass on the data as received. A more complex gateway may pre-process the data to filter bad data (extreme values that don't make any sense, which is probably due to a sensor error), perform security checks to ensure only data received from authorized sensors is passed on, or aggregate the data over a time interval and only send the aggregated values to the processor.

Gateways are often physically located close to the sensors to reduce data transmission latency, while processors can be located anywhere in the network and even in the cloud. In a distributed network application, computing that happens in close proximity to the source of data is referred to as edge computing. Today, for distributed applications, remote computing is increasingly happening on the cloud.

When high volumes of data are pre-processed at the edge, it reduces the volume of data that needs to be forwarded to the cloud. In turn, this reduces processing time and network transmission costs, which are two extremely critical parameters and challenges for IoT solutions.