First of all, let’s try to define the internet of things. In simple words, its all about devices/sensors gathering information about their surroundings and sending it to the internet/cloud for processing and analysis, so that meaningful results can be derived from it.
That simple (?) definition tells us that there are a few tasks performed by an IoT system — collecting data, sending data to the cloud, processing and analyzing data, storage and reporting. We need hardware and software components, to perform each of these tasks, to come together to form an IoT system.
These are the devices which collect data about themselves and their surroundings. In general, they are low-power sensors, sensing data about a specific thing. For example temperature, GPS location, moisture, motion, etc. And, not to forget, this is the “things” part of Internet of Things.
2. Field Gateway
Field gateways or gateways are the smart devices which act as a bridge between the sensors and the cloud. This is needed because the sensors are light/low power devices and sending data over the wire is a power costly task. So, we need gateways to perform this task on behalf of the sensor. A gateway can also collect data from various sensors and send it to the cloud collectively.
Let’s look at a real life example — In almost every IoT training/presentation/knowledge session, etc. there is a mention of Raspberry Pi (Pi). Let’s say we connect a temperature sensor, humidity sensor, light sensor and motion sensor to the RasPi and then write a simple logic to read these values from connected sensors, then POST them to the cloud using _http(s)_ — In this setup the Pi acts as the field gateway.
Gateways are also used to enable IP communication between the devices and cloud. Most of the times the devices/sensors do not have the capability to communicate using an IP address and gateways act as a bridge in these situations.
Gateways are of two types — Transparent and Opaque. Transparent gateways let the device/sensor be identified in the cloud while opaque gateways don’t. There are different use cases where each of these gateway types is applicable. More on gateways in a dedicated post in this series; coming soon.
3. Cloud Gateway
Cloud gateway is the cloud entry point for messages coming from devices. This is the ingress point of the IoT system. It’s responsibility is to accept messages from authenticated devices and, in some cases, pass them to the respective message processors. Generally, it does not process the messages. This is the most important component of the IoT system and special attention should be paid for it’s scalability and disaster recovery while designing the system. If this fails, well, the whole system fails.
Some of the example PaaS solutions which can be used as cloud gateways are — Microsoft Azure IoT Hub, AWS IoT
4. Message processor
This is the business logic component. Here, the messages we received from different devices are decoded (decrypted), filtered on their properties (region, time, priority), processed for information retrieval and then finally stored in a structured way.
This component is generally custom developed as per the use cases. Mostly we would want to use a set of micro-services having responsibilities like message reading, message enrichment, message storage and anything that is needed. This component can become a bottleneck for the entire system if not designed to scale.
After all the processing and filtering, we will need some place to save the messages/data. That’s why we will need a storage component. In general, storage is of two types — hot and cold. Hot storage is used for frequently accessed data. It will have low latency and high throughput and hence will be costlier. Cold storage is used for long term data storage and analysis and will not be so fast in retrieval of data hence will be relatively cheaper.
6. Analytics Engine
This is the place where we will derive results from the data we received from devices. A data analytics engine will be used to identify patterns and abnormalities from the incoming data. This can also be a machine learning component. Basically, all we want is to make use of all the data we received and processed in the earlier steps.
7. Reporting/Monitoring Dashboard
Finally, everything we did, we would like to show it off in a structured way, hence the reporting component. This can be a simple excel sheet with some charts or it can be a BI dashboard in itself. Sometimes, we also build custom portals to represent information for easier consumption by the end users.
Apart from these, there are few other components which are also used in an IoT system — Caching, Authentication, User Management, APIs, etc, etc, which are generally common across cloud systems.