Using the programable FATBOX G3 IOT gateway to control and monitor Modbus floodgates and pumps.

The Challenge


The ability to write commands to downstream Modbus output devices and aggregate predictive monitoring data at the same time is useful for applications like flood run off management.


Flooding causes major damage to critical infrastructures such as building, agricultural crops and also pose a threat to lives. To ensure that critical run off intervention can be made in a timely manner, the remote control of assets like flood gates and pumps spread out in a large geographical area is essential. This remote access also helps to avoid exposing ground crews to dangerous challenges when the physical access of these assets is limited by terrain or flood waters.

For these critical systems it is also imperative to monitor the health of the system and especially be able to pinpoint any damage sustained after events of flooding. To run analytics for our predictive or condition monitoring we need the data from our sensors to be in time series when they are sent to data lakes so the system can make useful comparison.


And finally, security is a paramount requirement for the implemented solution to ensure the smooth running and prevent hacking of these critical assets.

The Challenge


  • remote control of downstream modbus assets spread over a large geography

  • parse time stamped data from sensors for predictive analysis.

  • security to ensure smooth running and integrity of the system

The Solution


With the FATBOX G3 programmable gateway, Python/Lua API scripts is used to control Modbus devices from the user’s cloud application. The delivery of the triggers goes via Ethernet WAN connectivity or cellular LTE/3G/GPRS for asset in more remote, unconnected locations. The G3 gateway also has an automatic EthWAN-to-3G failover feature for an additional layer of network redundancy to prevent any disaster situation.


The Modbus controlled floodgates and pumps are triggered by receiving signals from the G3 gateway via serial/Ethernet port connection. A custom Python/Lua script is used to send this trigger signal.


Users will need to add a specific action command that is passed to the script during runtime. Below are the action commands currently supported by Azure ‘message-to-device’.

Action Command


Action Command



Write value to coil/register of slave unit.


Write value to coil/register of slave unit.





MBR=Modbus/RTU over serial port

MBT=Modbus/TCP over Ethernet port

UNITADDR=Address of Modbus unit

MBFC=Modbus function code (5,6,15,16 supported)

REGSADDR=Address of coil/register

VALUE=Write value in decimal number

The reliability of the solution is aided by the weather resistant enclosure that ensure that the G3 gateway is protected from the elements and continues to be operational in inclement conditions.


With an embedded RTC (Real Time Clock), the FATBOX G3 gateway also parses the data aggregated from Modbus/ZigBee/Ethernet sensors measuring metrics such as vibration and flow into time-series data. This formatting allows the data to be directly utilized by Predictive Monitoring applications without any additional hardware. Sending to the cloud is via the integrated MQTT client using the true cloud protocol. For application using server based data center, security can be handled using Strongswan IPSEC for the encryption of the data.


The G3 also has a 2 x Ethernet interface that can be used to connect to IP surveillance cameras that can give the control room or engineers visual access to the sites around these assets.

The FATBOX G3 Gateway integrates the above-mentioned features that allows for the robust and remote control and monitoring of disaster management assets using IOT applications.


  • Integrated device server for scheduled poll and read from attached equipment

  • Multi-port support - RS-232/RS-485 (e.g. MODBUS), Ethernet, CAN Bus and USB (for Zigbee/BLE/WIFI transceiver)

  • Integrated MQTT Client to connect to cloud services 

  • Azure IoT Hub client to integrate with your Azure cloud resources  

  • Ubidots IoT Client for integration with Ubidots Platform

  • User scripts supported for cross compile of C-program/ custom Python, LUA scripting 

  • 2GB of on-board storage 

  • Parse Time Series Data for analytical applications

  • SNMPv2 for management

  • Persistent LTE and 3G data connection with network watch-dog

  • Dual SIM & WAN-to-3G failover redundancies

  • Wide power supply 5~30VDC (12/24V) ensures stability of operation

  • Industrial temperature -40C to 75C and robust aluminium enclosure 

  • Weather resistant enclosure for wet or corrosive environments


Engineering Notes


To run and test your solution on console, enable SSH and log in as ‘root’. We will then need to run the azuremsgbot script with the specific action command:


# python /scripts/python/ MBR,1,6,8,1


# python /scripts/python/ MBT,,6,9,1


# lua /scripts/azuremsgbot.lua MBR,1,6,8,1


# lua /scripts/azuremsgbot.lua MBT,,6,9,1


To use Azure’s Device Explorer “Messages to Device”, the G3’s Azure IoT needs to be enabled and actively connected to Azure cloud server. This can be verified by looking at the specific device status in Device Explorer’s Management tab.


Clicking the “Send” button will initiate the message to be sent from

Device Explorer à Azure IoT Hub (cloud) à internet à cellular data network à G3 iotclient à runs azuremsgbot trigger à sends signal to Modbus output device à trigger on/off action on Modbus coil


Other useful commands supported by Azure’s “Message to Device” functions.

Action Command



Reboot the G3 Router



Action Command



Blinks the signal LEDs on G3



Have a question for us?
As featured in 


E-commerce Shop


Leasing Plans

FAQ on leasing


Custom the G3


Sales Enquiries

Technical Enquiries

Amplified Engineering Pty Ltd  

Suite 4 Enterprise Unit 3,

9 De Laeter Way,

Bentley WA 6102, Australia

ABN 44127163035