IoTa + MQTT

MQTT: The other protocol

The open-source Particle Photon (and it's CoAP protocol implementation) is a great IoT platform, with plenty of options for scalability and support for transitioning your prototypes into reality. This is especially true if you intend to spin off your projects into mass-produced commercial ones.

MQTT is another open-source implementation. It has much less hardware integration compared to the Particle ecosystem because it's simply an elegant, lean messaging protocol that allows any hardware capable of TCP/IP to leverage it. What you get is an easy-to-use, standardised means to communicate between hardware devices, in particularly low-power, intermittently-connected ones.

More information about MQTT can be accessed here:


Processing MQTT data on IoTa

Now that you have a connected device subscribed to an MQTT topic and publishing data, you need to set up a flow to connect to the MQTT server. This will then allow you to relay messages between devices and machines through the IoTa interface.

Using the MQTT nodes in IoTa/node-RED

Below is a very basic example of how MQTT message transmission can be understood. You have an MQTT input/send node, and an MQTT output/receive node. The two inject nodes are sending basic text strings: a “hello” message and a numerical timestamp. The MQTT receive node, if configured correctly, will ‘catch’ these messages and send them on through to the Debug node, which is a handy way of tracing various points in your flow:

Basic MQTT demonstration, using the Inject and Debug nodes

This flow looks self-explanatory; what's more crucial are the settings that you must configure within the MQTT nodes. You should also refer to the Information sidebar to get further online help on what the node is supposed to do.

Server configuration

Server configuration is done through what we call a configuration node – an ‘invisible’ node that stores secure credentials and settings that other relevant nodes can connect to. This allows you to connect re-use the same configuration and avoid entering credentials repeatedly.

In our BORB example, I have created a server configuration named iota.mdit.space. Click on the edit icon to open the configuration screen:

Testing basic operation

Once you have the nodes added and configured, click on the red Deploy button on the upper right corner of the interface. The flow will now execute on the server and become ‘active’. Open the Debug tab on the sidebar (the one that looks… like a bug). When you click on the inject buttons, you should be able to see the output emerging from the debug nodes.

Debug sidebar showing the output of the MQTT send node, via the MQTT receive node.

Once you have this basic connectivity tested, you now have yourself a blank canvas for sending data streams between multiple devices! Have a break and holler out your window if you'd like!


Video walkthrough

Basic MQTT operation

The following video walks you through the above process of configuring your MQTT server. In addition to what was covered above, it also demonstrates the use of MQTT wildcards to allow message filter by virtue of the message topic:

Putting it all together: IoTa MQTT + mote mini

This is the final fun part in getting everything to come together.