MQTT IoT Gateway
For Modbus TCP/RTU, Serial & CAN Bus devices
Suitable for cloud monitoring & management of Modbus TCP/RTU, Serial RS485/232 & CAN Bus devices
DESIGNED IN AUSTRALIA & MADE IN USA.
The Mosquitto MQTT Client on board the FATBOX G3 industrial IOT gateway router enables data aggregated from industrial devices operating Modbus TCP/ Modbus RTU/CAN Bus/RS485/RS232/Ethernet protocols to be sent to a MQTT broker via cellular (4G LTE/3G) or ADSL/Fiber backhaul. From there a subscriber can utilise the data sets with their own cloud applications (i.e. AWS apps).
Tutorial:: Deploy an AWS Solution on the FATBOX G3 using Mosquitto MQTT
In this tutorial, we will run through the setting up of the Mosquitto MQTT client on the FATBOX G3 side to publish remote IoT device data to a MQTT broker running in AWS. From there the JSON message stream can be ingested by a MQTT subscriber and further processed (e.g. sent to a real-time dashboard for visualization).
1. Install and Run Mosquitto MQTT in Amazon AWS
There are plenty of other tutorials out there about installing an instance on AWS (or you are already adept at it) so we will not be going through this in detail. For our simple demo, we created a 512MB Ubuntu (OS Only) instance and installed Mosquitto as follows:
sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
sudo apt-get update
sudo apt-get install mosquitto
sudo apt-get install mosquitto-clients
After installing, the Mosquitto broker will automatically start and listen on port 1883. If needed you can change this using
mosquitto -p "port number"
i.e. mosquitto -p 1885
2. Install and Run the Mosquitto MQTT client on FATBOX G3
You will first need to enable SSH on the FATBOX G3. You can do this in the “Management” tab of the web console.
Then SSH into your FATBOX G3 gateway, (e.g. using PuTTY SSH client [for Linux] to your device via ETH0, for instance to 192.168.1.1 port 22). Please change your default username and set a strong password to ensure security.
Then run the following:
opkg install mosquitto mosquitto-client libmosquitto
3. Run sample MQTT script to test connection to AWS MQTT broker
We have a sample Linux BASH script (/etc/MQTTclient) to get you started. It reads 'data' JSON messages from the buffer file FIFO and send each data JSON string to the MQTT broker we have installed earlier. After each JSON line has been sent, that string will be deleted from the buffer file.
Make sure your IoT device data buffer file (i.e. /tmp/dataq) is being updated with data from the attached devices. See FAQ.
Then run the following
sh MQTTclient "file of data to send" "mqtt subscriber at AWS" "mqtt server IP port#"
i.e. sh MQTTclient /tmp/dataq.txt mqtt 220.127.116.11 1883
From your AWS instance you can now test the data sent from your FATBOX G3 by starting a Mosquitto subscriber to the topic you set above
mosquitto_sub -t “topic”
i.e. mosquito_sub -t mqtt
<SAMPLE OF JSON DATA STRING RECEIVED ON AWS>
Congrats! You have successful connected your data and from here you can further process it e.g. piping the data to another application.
A Linux IIoT Gateway
The FATBOX G3 is an OpenWRT IIoT Gateway with inbuilt 2GB storage to enable edge applications such as:
BUY or LEASE
The FATBOX G3 Linux IIOT Gateway
PURCHASE AS AN ASSET
Test an IIOT application from a Modbus device using our Azure or Ubidots Starter kit.
LEASE AS A SERVICE
Learn more about leasing the G3 IIOT Gateway + data (with no lock in contracts) for your deployments