I took up a challenge from an oil/gas client to revive a GSM based SCADA system that they had inherited, and to do so at very low cost. The existing RTUs at the remote sites used GPRS which is no longer available. 3G, however, is available at all sites. Fortunately, the existing RTUs have the ability to be programmed as Modbus RS485 slave devices. So the solution is to use the Arduino MKR 1400 to interface with the existing RTU devices and then have them connect to a cloud service and send MQTT updates. At the base, Node-Red will be used to connect to the cloud service and subscribe to the data points and expose them to the HMI which is a very old version of Wonderware Intouch. The diagram below shows the proposed set up.
The video below gives more details of the proposed solution:
PART 2In this part, I set up the hardware and write the Arduino code to enable the MKR 1400 to read a single Input Register via Modbus from the MT-102 slave device. The Arduino code is attached below as "ModbusReader01.ino".
Here is the wiring diagram.
The video below gives a deeper explanation of what I am doing.
PART 3In this part, I expand the Arduino code. The MKR 1400 connects to the 2G/3G data network and publishes the single data value to a mqtt topic in the free mosquitto eclipse mqtt broker. I then use Node-Red to subscribe to the topic to verify that the data is reaching where it is supposed to. The video below gives a deeper explanation of what I did and the Arduino code for this part is attached below as "ModbusMQTT01.ino".
PART 4 - FINAL!In this last part, I write a small.NET forms application that reads the single topic from the cloud MQTT broker and exposes the value via a Modbus TCP Server so that a very old version of Wonderware Intouch would be able to read it. To create the.NET application, I used two libraries as follows:
EasymodbusTCP... http://easymodbustcp.net/en/
M2Mqtt... https://www.nuget.org/packages/M2Mqtt/
Comments