Researcher working in the domain of IoT, Cyber Physical Systems, and Edge Computing
This article explains how to install Mqtt broker on Siemens Simatic IoT2040. In this article Mosca Mqtt broker is used.
The Modbus Energy Meter is used as client that publishes Voltage, Current, and Frequency values to Mosca broker installed on Siemens Simatic IoT2040. The broker on Simatic will then publish the data to NETPIE APP ID that is subscribed to the same topic as publisher.
The Simatic IoT2040 works based on Yocto Linux, the image need to be installed on SD -card and should be inserted into Simatic. The detail instructions of installing Yocto Linux and connecting Modbus Energy Meter to Simatic can be found here.
Installing Mosca on Siemens Simatic IoT2040:
Install Mosca on Simatic using npm as described below
npm install mosca bunyan -g
To test Mosca, run the below command
mosca -v | bunyan
If you get the output similar to below picture, “Congrates”, you have successfully installed Mosca on Simatic IoT2040.
Installing nodes on Node-Red:
Install netpie node
npm install -g node-red-contrib-netpie
Install Mosca Mqtt broker node
npm install -g node-red-contrib-mqtt-broker
Install modbus node
npm install -g node-red-contrib-modbus
For transfering data from broker (installed on Simatic) to NETPIE, first the Simatic should be authenticated by NETPIE, for this purpose microgear node (netpie) is used. Once the device is authenticated, connection between Simatic and NETPIE establishes and data gets transmitted using Mosca mqtt broker. Modbus node is used to read data from Modbus Energy Meter.
Mosca Broker Node:
Mqtt out node (publisher):
Mqtt in node (subscriber):
The data read from Modbus Energy Meter will be enclosed in brackets (Ex: Voltage value: ). To remove brackets and extra characters on data we use function node.
Create Application Id on NETPIE that is subscribed to same topic as publisher node.
Creating Data Source:
Level up your reading game by joining Hacker Noon now!