Using Freeboard.io to visualize devices with IBM Watson IoT MQTT messages

If you are looking for a quick and powerful way to visualize your IBM Watson IoT device messages using MQTT, I would highly recommend trying out freeboard.io. It is 100% open source and they even provide free online hosting if you do not wish to host it yourself.

You can see my live demo of my IoT freshwater aquarium dashboard on freeboard.io here: https://freeboard.io/board/l1XbFY

MQTT Freeboard.io IBM Watson IoT
MQTT Freeboard.io IBM Watson IoT

Unfortunately, there is no direct integration from Freeboard.io to support MQTT, but luckily they have a javascript developer console where you can integrate to anything! I have taken the Paho MQTT client and some similar open source code to make it work for my purposes. You can see the code here:

https://github.com/benjaminchodroff/freeboard-mqtt

If you would like to use this custom plugin, here is how to hook it up.

  1. Make sure you are signed into freeboard
  2. Click “Developer Console”

    Freeboard.io Developer Console
    Freeboard.io Developer Console
  3. Add the following two plugins and then click OK:
    1. https://rawgit.com/benjaminchodroff/freeboard-mqtt/paho-mqtt-default/ibm.iotfoundation.plugin.js
    2. https://rawgit.com/benjaminchodroff/freeboard-mqtt/paho-mqtt-default/paho.mqtt.plugin.js
  4. Under datasources, click “Add” and select the new “IBM IoT Foundation” datasource
  5. Configure the new datasource with your details, including which device to listen to
    Watson IoT Freeboard.io Configuration
    Watson IoT Freeboard.io Configuration

    Now that your Datasource is configured, you should start to see it update automatically every time a new MQTT message is received. You can add widgets which can visualize this data by adding a Pane, then adding a widget, and then selecting data from your MQTT message.

I would recommend using JSON encapsulated messages so that it is easy to extract and manipulate the data. For example, I have a message which contains the pH of water and I can add this to a widget by using the value:

(datasources["IOT"]["b827eb14cce9"]["water_ph"]).toFixed(2)

IoT MQTT pH value
IoT MQTT pH value

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.