After summarizing the architecture that we are implementing in the previous article
Mqtt with Beaglebone and ESP8266-Architecture
We proceed now with the installation of the MQTT broker on Beaglebone Black with the following version of Debian
1 2 3 4 |
root@beaglebone:~# cat /etc/dogtag BeagleBoard.org Debian Image 2016-11-06 root@beaglebone:~# uname -a Linux beaglebone 4.4.30-ti-r64 #1 SMP Fri Nov 4 21:23:33 UTC 2016 armv7l GNU/Lux |
The image used is the following
We proceed to the configuration as described in the article
Debian sd card setup for Beaglebone Black
Proceed to extend the space on the SD card with the application gparted in a linux host or using the grow_partition.sh tool on BeagleBone in the /opt/scripts/tools folder
1 |
root@beaglebone:/opt/scripts/tools# ./grow_partition.sh |
Performing the upgrade with this image we have had space issue with 4Gb partition.
The message broker we’ll use is mosquitto
The version of Mosquitto with Debian Jessie doesn’t not have the Wesockets services, which we’ll use for the Dashboard. For this reason, we have to install a more recent version of Mosquitto (or recompile it from source).
Log on as root in a command shell on BeagleBone and add the Debian testing repository
1 2 |
cd /etc/apt vi sources.list |
1 |
deb http://httpredir.debian.org/debian stretch main contrib non-free |
Run the following
1 2 3 |
apt-get update apt-get install mosquitto apt-get install mosquitto-clients |
After the installation comment the reference of the debian testing repository in /etc/apt/sources.list
1 |
#deb http://httpredir.debian.org/debian stretch main contrib non-free |
and run
1 |
apt-get update |
We test at this point if the server is installed correctly by running in a shell the subscription to a topic
1 |
mosquitto_sub -h localhost -t "topic/test" |
In another command shell run the publishing on topic “topic / test”
1 |
mosquitto_pub -h localhost -t "topic/test" -m "Prova" |
The first shell has to show the message “Prova”
With MQTT protocol we can define different QOS, as described in the Mosquitto FAQ
With QoS = 0 the message is sent only once and is not required confirmation of receipt by the subscribers; the MQTT implementation in these articles is without protection with name/password or ssl channel encryption and with QOS=0.
In the next article we’ll proceed to the preparation of ESP9266 module with the Mqtt lua library inside the nodemcu firmware