As of recently there have been a lot of new IoT products and services emerging ranging from Microsoft’s Azure, to Amazon’s AWS, to various home appliances in the home. Ever wondered how these systems work or how to create your own system that does something similar? Most of these systems use techniques which as existed for some time and just connecting various ideas together to create a complete IoT solution. I am hoping to go over some of the basic functionality of these recently emerging IoT systems. The vary basic concept is some kind of sensor (or actuator) that is connected through the internet to a server. This server contains various software to store, analyze, display, and perform actions based on this sensor input data.

Proposed new IoT system
Proposed new IoT system

As a personal project and to begin working on possibly starting up a company I have begun work on a new IoT system based on experience from the past decade. This system would allow small IoT battery powered devices (or mains powered devices), such as sensors and actuators, to connect to a central server to record data and receive commands. The server could also include logic to automatically perform operations based on data received.

The basic description of the system and proposed hardware/software is as follows. There would be various sensors (such as temperature, humidity, light level, wind speed) connected to a low powered wireless chip (referred to as a node) which will be wirelessly connected to a lower powered wireless mesh network. The mesh network design would allow nodes to use other nodes to pass data through the network if a node can not directly connect to the gateway device.

This wireless mesh network would be based on low powered MCUs providing a way to pass data wirelessly from the sensor to the gateway, and ultimately through the internet to a server for storage and display. Similar famous mesh networks, such as Zigbee, are commonly applied in home automation systems, but operate on 2.4GHz radio band, shared with WiFi. The proposed mesh network design would be similar to Zigbee but operate on the 900MHz band to allow more range and reduce congestion issues that occur with WiFi.

Each node would contain a number of sensors (or actuators) and be connected to the internet through a gateway device. The gateway would facilitate message passing between the low powered mesh network and the internet, ultimately allowing connectivity to a server.

The gateway could use various means to establish a connection to a server, but the MQTT protocol is proposed due to being a light weight protocol, minimal header, and ability to encrypt and secure the connection with SSL/TLS certificates. The gateway runs an MQTT client that connects to the MQTT server (or MQTT broker) to facilitate message passing. The proposed MQTT broker is mosquitto, an open source MQTT broker project. The MQTT protocol is based on a publish/subscribe model with multiple topics, in which data can be published by an MQTT client on various channels, can then listened to or received by another MQTT client which has subscribed to said channel. This works similar to an internet chat room where various clients connect and can participate (talk or listen) to various channels (or topics) which are of interest.

From here the data has arrived to the server and it is proposed to create a Python script that will contain an MQTT client. This MQTT client will connect to the above mentioned MQTT broker and subscribe to topics where the sensor data is being published. The raw data is then organized, checked for consistency, and assigned the correct ids for later sorting and display, then written to a mySQL database. The id assignment would consist of data stored in the customer settings database.

This brings up the question of the various information coming from the sensors and the ids that are added to the data as it passes through each part of the system starting with the sensor id, node id, mesh coordinator id, gateway id, etc. The ideas behind the various ids and how to assign them will be discussed in the next post.

Leave a Reply

Your email address will not be published. Required fields are marked *