Connecting ModbusTCP slave devices to azure iot hub using Moxa UC-8112A IIoT Gateway running Microsoft Modbus Container (Azure IoT Edge + ThingsPro Edge)
- Install ThingsPro Edge v2.0.0
- Deploy Modules from Azure Portal
- Verify Modules on UC-8112A IIoT Gateway
- Setup Modbus Slave Simulator
- Monitor ModbusTCP Sensor D2C Telemetry data to Azure IoT Hub
- username/password: moxa/moxa
- IP LAN1 192.168.3.127
- IP LAN2 192.168.4.127
Reset to factory default
If the unit has been installed prior, we should reset it back to default before installing ThingsPro Edge. The commands listed below is for armhf
and UC-8100A series gateway
mx-set-def
Note: Make sure to have a console cable conected to the device or login via ssh
Remove docker folder
rm -rf /overlayfs/docker /overlayfs/working/docker
Note: This will wipe out all the data on the device!
dhclient eth0
Note: Make sure there is a dhcp server on LAN1
- armhf:
wget https://thingspro.blob.core.windows.net/software/edge/V2.0.0/update_2.0.0-1511-uc-8112a-me-iotedge_armhf.deb dpkg -i ./update_2.0.0-1511-uc-8112a-me-iotedge_armhf.deb
Click on the url below or copy url it on your web browser which starts downloading thingspro software, it takes 10~12 minutes depending the network speed of your internet connection.
https://thingspro.blob.core.windows.net/software/edge/V2.0.0/update_2.0.0-1511-uc-8112a-me-iotedge_armhf.deb
After the download is completed, copy .deb package file on the UC gateway via FTP
Hint: On Windows10 use WinSCP tool. It is free tool available on the url below.
https://winscp.net/eng/download.php
- armhf:
dpkg -i ./update_2.0.0-1511-uc-8112a-me-iotedge_armhf.deb
journalctl -u update -f
Note: The entire process will take about ~11 minutes depends on the hardware/model. When it shows "Stopped MOXA ThingsPro Updater", you can reboot the device by command listed below. The SSH service will be disabled after TPE is installed.
sudo reboot
-
IoT Edge Module Name & Image URI
- Image URI:
- armhf:
moxa2019/thingspro-agent:2.0.0-528-armhf
- armhf:
- Image URI:
-
- Container Create Options:
{ "HostConfig": { "Binds": [ "/var/thingspro/apps/cloud/data/setting/:/var/thingspro/cloudsetting/", "/run/:/host/run/", "/var/thingspro/data/:/var/thingspro/data/" ] } }
-
IoT Edge Module Name & Image URI
- Image URI:
mcr.microsoft.com/azureiotedge/modbus:1.0
- Image URI:
-
- Module Twin Settings:
{ "PublishInterval": 1000, "SlaveConfigs": { "Slave01": { "SlaveConnection": "192.168.2.200", "HwId": "GasTank-34:48:ED:98:9B:7C", "Operations": { "Op01": { "PollingInterval": "1000", "UnitId": "1", "StartAddress": "400001", "Count": "1", "DisplayName": "Temp" } } } } }
-
-
NAME:
route
-
VALUE:
"FROM /messages/* INTO $upstream"
-
NAME:
modbusToIoTHub
-
VALUE:
"FROM /messages/modules/Modbus/outputs/modbusOutput INTO $upstream"
-
Note: After successfull deployment the iotedge device pull the module images specified in the deployment manifest and start the conatiner from the image. This takes 4~5 minutes depending on the network speed. The iot edge device sends the status updates via reported properties to azure iot hub.
Default credentials
- username/password: admin/admin@123
https://www.modbustools.com/modbus_slave.html
Note: There is a 10 minutes from connection limit. After 10 minutes the connection is disconnected. Re-starting the application will initiate another 10-minutes demonstration period. After 30 days it is not possible to make a connection. The license key is valid for both versions.
Note: TCP/IP Server is the IP address of the Ethernet Interface of your notebook. Make sure the notebook IP address is on the same local network. In my case notebook IP address is 192.168.2.200 and UC-8112A LAN2 IP address is 192.168.2.127
Note: Press Ok, On successfull connection to the IIoT gateway you'll see the following output
https://github.com/Azure/azure-iot-explorer/releases