Custom MQTT Broker, Client and Dashboard Demo (Analog )
This week I developed a solution to send data up and down to a broker using a custom MQTT implementaltion using Mosquitto MQTT on a Raspberry PI 4. I used the code from the microbit cloud gateway board as a starting off point. I substituted the green DFRobot extension board block to a 'serial write line' block and the rest of the code had been left untouched. This means that the gateway microbit forwards radio messages from the client microbits to the Raspberry Pi. On the Raspberry Pi side of things, a python script has to run in order to log serial messages from the microbit gateway. The messages are logged and the raw numerical values are extracted and stored as a variable. The script then forwards that stored variable and inserts it into a shell command: $ mqtt_pub raspberrypi.local -t "test/demo" -m $VAR The script runs in an infinite loop, logging serial and repeating shell commands to the self-hosted MQTT broker running on the raspberry pi. This broker can now ...