TNS
VOXPOP
Which agile methodology should junior developers learn?
Agile methodology breaks projects into sprints, emphasizing continuous collaboration and improvement.
Scrum
0%
Kanban
0%
Scrumban (a combination of Scrum and Kanban)
0%
Extreme Programming (XP)
0%
Other methodology
0%
Bah, Waterfall was good enough for my elders, it is good enough for me
0%
Junior devs shouldn’t think about development methodologies.
0%
Edge Computing / Linux

Off-The-Shelf Hacker: Mosquitto on the Bone

MQTT is a well-established way of distributing data between physical computing devices and machines. We explored using a CHIP single board computer to run a Mosquito MQTT broker, back in 2017.
Oct 19th, 2019 6:00am by
Featued image for: Off-The-Shelf Hacker: Mosquitto on the Bone

MQTT is a well-established way of distributing data between physical computing devices and machines. We explored using a CHIP single board computer to run the Mosquitto MQTT broker, back in 2017. While the gadget worked fine, it got pushed to the back of the desk due to other projects.

Sad to say, the CHIP-based broker gave up the ghost about six months ago. The board no longer boots and the vendor has also since gone out of business.

What to do with a few new MQTT projects on the horizon? The old BeagleBone Black in the parts bin should make a fine MQTT broker. This week’s installment covers the essentials of running the Mosquitto broker on the “Bone.”

Why the Bone and Not a Pi?

The BeagleBone was way ahead of its time when it first came out. It used eMMC flash memory to house the Linux operating system, instead of the usual micro-SD card. The CHIP had a similar arrangement.

I always liked the idea of running Linux on a microcontroller board, with no moving parts. I consider a micro-SD card a moving part. If you aren’t careful the card will pop out of the slot unexpectedly and move to someplace never to be found again. I’ve resorted to putting a piece of tape over the card as extra insurance that it will stay put, especially when doing tech talks at conferences. Many boards use a “non-clicking” socket now, which probably lessens card loss. I use tape on all my Pi boards. Don’t need any on the BeagleBone.

Some other single board computers use flash memory, as witnessed by the recent Rock Pi 4 review sample, I received last week. Linux can be flashed onto the removable eMMC memory from a micro-SD card, similar to the BeagleBone. I’ll give it a workout as soon as I round up a 5-volt, 4-Amp power brick with a USB-C connector.

BTW, the Raspberry Pi compute modules uses eMMC memory for Linux. As far as I know the Raspberry Pi Foundation has no plans to move away from the micro-SD card storage setup on their traditional lineup.

Updating Linux on the Bone

Putting Linux on an old BeagleBone Black was pretty straightforward and is covered very well on the BeagleBone page.

Go to the BeagleBone site and download the latest copy of Debian Linux. You can run others if you like and the process is the same. I chose the Debian 9.5 2018-10-07 4GB eMMC IoT Flasher (download) version. This one is set up for headless operation and doesn’t have any of the normal desktop features. It is compact and you can use apt-get on the command line to install the Mosquitto broker and client. I’ll maintain the device via SSH over the network after installation.

Once the .xz file is downloaded to your Linux notebook, unzip it using the unxz program. This will generate the .img file needed to go on the micro-SD card. Yes, we still need a micro-SD card to update the Bone, but won’t use it after the installation. I used a generic 8GB card plugged into a USB SD card adapter.

Next, we install the balena-etcher program to copy the .img file onto the card. After writing the image to the card, it can be removed and inserted into the unpowered BeagleBone Black’s micro-SD slot.

I temporarily hooked up a monitor to the micro-HDMI port, on the BeagleBone, along with a Logitech wireless keyboard/mousepad then held the USER button (above the SD card slot on the top of the board) and applied power using a 5-volt, 2.5 Amp wall wart with a barrel connector.

You can release the button when the four blue LEDs come on and the micro-SD card will then do its thing. Linux will automatically flash over to the Bone and it will power down once the operation is completed. Remove the SD card. Without holding any buttons reboot the Bone. You should get a login prompt on the monitor. Plug a working network cable into the Bone’s Ethernet port. Use “debian” and “temppwd” to log in. You should change the default password.

Adding the Mosquitto Broker and Client

Mosquitto isn’t included with the image so it’s installed using apt-get.

First, add the Debian testing repository.


Add “deb http://httpredir.debian.org/debian stretch main contrib non-free” to the bottom of the file. Write and close the file.


Log out and then back in.

Use ifconfig to find your network address.


The BeagleBone showed 192.168.1.101. The Mosquitto broker is configured to start automatically at bootup, so we can now use it to pass messages.

Go to another Linux machine on your network and subscribe to the Bone’s MQTT broker. We’ll watch the “message” topic.


Now go back to the BeagleBone monitor and publish a message to the broker.


The “otsh” text should immediately pop up on the Linux laptop’s screen.

At this point simply power down the BeagleBone using shutdown.


Remove the HDMI cable to the monitor and the wireless keyboard transmitter from the USB port. Reboot the Bone and start sending MQTT messages to your hearts content.

What’s Next?

I plan on putting the BeagleBone in some kind of enclosure so I can use it to consolidate MQTT messages from my sprinkler controller and outdoor intrusion detection grid. It would certainly be nice to also start logging inside lighting use with my ESP8266-equipped lamps.

Catch Dr. Torq’s Off-The-Shelf Hacker column, each Saturday, only on The New Stack! Contact him for consultation, speaking appearances and commissioned projects at doc@drtorq.com or 407-718-3274.

Feature image by skeeze from Pixabay.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Shelf, Torq, The New Stack.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.