There is no doubt that industrial communication has a promising future.
And for the most part, it's due to the ongoing initiatives such as Industry 4.0 and Industrial IoT.
But at the backdrop of all this, the stark reality is that most of industrial data remain trapped behind walls of point-to-point protocols. And consequently, there's no meaningful information being generated from the dpata.
One such protocol is Modbus TCP/RTU. In fact, data in Modbus devices is so siloed such that even two devices from different suppliers that both talk Modbus cannot easily exchange data without knowledge of each other's unique register mapping. But yet, it remains the most widely used industrial communication protocol to date.
Hence, in the past few years, we have seen a proliferation of gateway devices or protocol translators to convert from Modbus to internet protocols.
In the Node-Red flow below, I demonstrate how Node-Red simplifies the integration of data from legacy Modbus devices into sophisticated enterprise platforms such as Azure IoT Cloud. Instantly turning the data into a valuable resource.
[{"id":"fc01a126.f555b","type":"tab","label":"Modbus To Azure","disabled":false,"info":""},{"id":"79591d2c.fd0d64","type":"modbus-flex-getter","z":"fc01a126.f555b","name":"","showStatusActivities":false,"showErrors":false,"server":"3c961ae6.dee696","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":450,"y":240,"wires":[["26adf95.2cae006"],["577038d4.e11138"]]},{"id":"16ef7339.f7666d","type":"function","z":"fc01a126.f555b","name":"Modbus Message","func":"\nmsg.payload = {\n 'fc': 3, \n 'unitid': 110, \n 'address': 4096 , \n 'quantity': 2 } \n return msg","outputs":1,"noerr":0,"x":240,"y":240,"wires":[["79591d2c.fd0d64"]]},{"id":"ef24b2d3.dc958","type":"inject","z":"fc01a126.f555b","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":180,"wires":[["16ef7339.f7666d"]]},{"id":"577038d4.e11138","type":"modbus-response","z":"fc01a126.f555b","name":"","registerShowMax":20,"x":640,"y":300,"wires":[]},{"id":"e40c5dcd.dbbf4","type":"debug","z":"fc01a126.f555b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":720,"y":160,"wires":[]},{"id":"26adf95.2cae006","type":"function","z":"fc01a126.f555b","name":"Convert To Float","func":"\nvar rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar floatView = new Float32Array(rawData);\n\nintView[0] = msg.payload[1]; //high\nintView[1] = msg.payload[0]; //low\n\nmsg.payload = floatView[0];\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":160,"wires":[["9d8b9a26.f9d658"]]},{"id":"9d8b9a26.f9d658","type":"function","z":"fc01a126.f555b","name":"Azure Message","func":"\nmsg.payload = {\n 'deviceId':"Device001",\n 'key':"5mEQvHwPg6E3Bd6+rFd69e3Vtl0ieN41WejZRm4Dmjg=",\n 'protocol':"mqtt",\n 'data':msg.payload\n}\nreturn msg","outputs":1,"noerr":0,"x":570,"y":80,"wires":[["7a35cc63.51e994"]]},{"id":"7a35cc63.51e994","type":"azureiothub","z":"fc01a126.f555b","name":"Azure IoT Hub","protocol":"mqtt","x":740,"y":105,"wires":[["e40c5dcd.dbbf4"]]},{"id":"3c961ae6.dee696","type":"modbus-client","z":"","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"192.168.1.77","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectTimeout":"2000"}]