Edge device is one of the core component of the overall IoT & IIoT implementation. Edge devices is the key source of data for the IIoT Implementation. The first important thing you have to keep in mind is nothing is reliable. The nothing mainly constitutes the Power and the Internet.
There are two kinds of devices with respect to power. First one is connected to the electricity and the later is without any continuous power source. The second ones runs on batter. In the former case, there is no need to worry about the usage of the power.
When you create a device that runs on power, you need to make sure, the number of cycles you run per second determines the power consumption. In one of the implementation, we enabled the communication of the remote device with the central server only when there is a change in the data. But the device will monitor the condition every few seconds. This will increase the battery life and at the same time save a lot of network traffic.
The device cannot take the Internet connectivity for granted. You should optimize the device for reconnections. So the reconnection should be made smoother with longer intervals, so that there is not surge in the drain of battery.
The device should be connected with MQTT WILL Messages so that the interested parties or the device manager will notify every one with the device disconnections once it happens.
Heat dissipation is one of the most important aspect to be considered for the device development. Even a very small heat generated in the micro controller should be properly let out. If not done properly may lead to Fire hazard. It becomes more important when you develop devices that works on the high voltage lines.
IIoT Implementation – Software:
Most MQTT servers supports two forms of connecting to the Central broker.
- TCP Connections
- Web Socket
The remote devices should implement the tcp form of connections. The web browser based clients or communication when the applcaition is open can use the Web socket. But for mobile offline messaging, developers should strictly use the other tools like Firebase Cloud messaging.
MQTT Connection Security:
Most MQTT Server can be run in Non TLS or TLS mode. We recommend you to run the platform enabling the TLS mode in the configuration. The TLS enabled broker will listen at port 8883. You can refer to our previous article on creating SSL Certificate for MQTT Communication for generating and using TLS Certificates. The above article also provides steps to add the client certificate in your client folder and connect it to the central Server.
client = MQTTClient(“Secure_Client” , 1883 , “40” , “broker.bevywise.com” , 0)
PS:- Even though the MQTT Platforms support TLS modes, we run them as NON TLS mode on our server for ease of development.
MQTT Device Authentication:
TLS data transfer provides the option to transfer the data securely. But the MQTT Authentication will provide an additional level of security. The Authentication also provides a level of access Prineville on who can publish and who can receive data from the MQTT Broker. The access restrictions will be defined at the MQTT Broker level and the clients can use the device authentication as needed for the implementation.
client = MQTTClient(“Secure_Client” , 1883 , “40” , “broker.bevywise.com” , 0 , “authentication_key”, “authentication_value”)
Setting WILL Details on Connection:
Setting the WILL messages will help other devices / applications in the network know the status of the device that sends the WILL details to the Broker. The WILL message will be triggered when the device disconnects with a notice to the broker. To connect the client to the broker, you can connect using the following method.
client = MQTTClient(“Secure_Client” , 1883 , “40” , “broker.bevywise.com” , 0 , “auth_key”, “auth_value” , True , 0 , 0 , “/will/device/” , “Device down”)
You can use the following prebuilt clients on Python to connect to any standard MQTT Broker via TCP.
You can have the following import and then write the above code.
For the Websocket based client, you can use the following client.
Bevywise Networks is an end to end solution provider for IoT & IIoT Implementation for any vertical from Edge devices to IoT Cloud Platform. We would be happy to help you get your solution tailored by us.