BBGW And MQTT Broker Using Desktop

In the previous post we have seen different ways to connect BBGW – BeagleBone Green Wireless board with Wi-Fi and unboxing BBGW for the fist time. This post is about how to test BBGW and MQTT Broker using desktop or laptop.

When building IoT applications it is good practice to send test data using your desktop or laptop. This makes sure that your IoT application built using either flutter or android works fine. This will also help to reduce the waiting time for actual firmware and hardware getting ready. The mobile application developer can test and run his application without actual hardware. This technique can save you a lot of time and energy for the rest of your project development.

MQTT Setup On Desktop

To perform this test driven development of your IoT product using MQTT we need some MQTT broker. I have installed MQTTLense a chrome extension for testing MQTT applications.

MQTTLense is Google Chrome application, which connects to a MQTT broker and is able to subscribe and publish to MQTT topics. This will help for using the MQTT Monitor to view messages to the MQTT broker.

MQTTLense Installed

On your BBGW board install mosquitto service and confirm if its running. I assume you have already installed mosquitto broker on your BBGW.

t@beaglebone:~# sudo service mosquitto status
● mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
Loaded: loaded (/etc/init.d/mosquitto)
Active: active (running) since Sat 2021-07-03 02:20:34 UTC; 12h ago
CGroup: /system.slice/mosquitto.service
└─340 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Jul 03 02:20:33 beaglebone mosquitto[318]: Starting network daemon:: mosquitto.

After installing and launching the application, click on the “+” button to add a new connection. Fill in the connection name as BBGW. This name can be anything of your choice. Fill in the IP address of beaglebone green wireless board. Rest other details are not required to update, click on the “CREATE CONNECTION” button.

MQTT Lense Create connection for BBGW

This will create new connection with BBGW and if it is success MQTT Lense will show it as Connection established to 192.168.0.106. Here 192.168.0.106 is my BBGW IP address.

MQTT Lense Connection established to BBGW

Send And Receive Message

Now connection is successfully established to MQTT broker running on BBGW, I can send (publish) data to BBGW device. On BBGW side I have subscribed to “test” topic. From MQTT Lense send message on this topic. This will receive message to BBGW device side.

@beaglebone:~# mosquitto_sub -h localhost -t "test" -v
mosquitto received message on BBGW

To send data from BeagleBone Green Wireless device to MQTTLense, First MQTTLense should subscribe to topic from BBGW board. Here I have created new topic as “test_bbgw” on MQTTLense and click on subscribe. On BBGW side publish message on this topic.

beaglebone:~# mosquitto_pub -h localhost -t "test_bbgw" -m "testing from BBGW"
From BBGW to MqttLense

The message payload and topic can be complex, in this example I have used simple topic name and message payload. Now you are sure that your application modules setup works fine over mqtt. This method helps you to debug MQTT programs and test it. Hope you have enjoyed this post on BBGW And MQTT Broker Using Desktop.

Leave a Reply