Skip to main content

BP Sensors to MQTT

Loading...

In this step, we modify the previous project to publish the sensor data to the MQTT server instead of saving it into the log.

MQTT is a popular protocol for machine-to-machine communications. It is often used to transmit sensor data. This project publishes the seven data streams from four Bus Probe sensors to a test server located at 104.40.239.93.

MQTT is configured on the MQTT page of the Features tab. Here is this application's configuration:

bpsensorstomqtt

Publishing of MQTT data is performed using the MQTT Publish block. This application has four such blocks, one for each data stream. Click on any block to inspect its properties:

bpsensorstomqtt

Testing MQTT

To see the application in action, you will need an MQTT client. We rely on the MQTT Explorer software -- it is free and simple to use. You can download it here:

http://mqtt-explorer.com/

Launch the MQTT Explorer and click + to create a new connection. Fill in the connection parameters as shown below:

bpsensorstomqtt

Click CONNECT. The sensor data will be under demo > devices > bpmqtt:

bp_mqtt_explorer