Tutorial: Connect to an MQTT Broker

Using Mosquitto MQTT on the FATBOX G3 to connect to your own MQTT Broker


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). 

Prerequisite: Installing and Running 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

Option 1: Using the Web Configuration MQTT Client on the G3 Gateway 

Log in to the FATBOX G3 web configuration menu and go to the “IoT Client” tab and enter the details of your Broker IP and Broker Port following the example configuration below.

Note that this is a basic MQTT client to broker implementation and not recommended for sensitive data unless connected over a secure VPN network if security is required.

Once this is set up, the JSON data to the test MQTT Broker running in AWS​ (or your own broker set up) automatically.

Option 2: Using our sample Linux BASH Script

For users who want more autonomy (i.e. to run their own security certs) we also have a sample Linux BASH script.

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

cd /etc

sh MQTTclient "file of data to send" "mqtt subscriber at AWS" "mqtt server IP port#"

i.e. sh MQTTclient /tmp/dataq.txt mqtt 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. 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. 

mosquitto_sub -t “topic”

i.e. mosquito_sub -t mqtt 


Congrats! You have successful connected your data and from here you can further process it e.g. piping the data to another application. 

Ask Us Your Questions

Get a prompt response to your query.



E-commerce Shop


Leasing Plans


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