Connecting to an MQTT broker
Now, let's send the sensor data on the Raspberry Pi to an MQTT broker via Node-RED. Here we will use the popular MQTT broker Mosquitto. In this chapter, we will go as far as preparing the device to send the device data to the server. The task of actually receiving and processing data on the server side will be demonstrated in a hands-on example in the next chapter. Therefore, here we will use Mosquitto just for checking the data transmission is performed correctly.
Mosquitto
Mosquitto is released under the open source BSD license and provides broker functionality for MQTT V3.1/v3.1.1.
It works on major Linux distributions such as RedHat Enterprise Linux, CentOS, Ubuntu, and OpenSUSE, as well as Windows. It also works on small computers such as the Raspberry Pi.
In this chapter, we will verify that the sensor data of the edge device can be sent via an MQTT broker to the localhost of the Raspberry Pi. This is very easy. I am confident that...