Using MQTT with Node-RED

Contents

Using MQTT with Node-RED#

We are going to show you how to send MQTT data to your Node-RED server

Requirements

  1. A Raspberry Pi (or other device) with Node-RED installed

  2. A device that communicates via MQTT (we used an Arduino UNO with a LA66 based Dragino LoRaWAN shield over TTN)

Guide#

We will set up Node-RED to receive data. First add a mqtt in node onto the flow

Node-RED MQTT set up

Open the node properties

Node-RED MQTT set up

Then next to the server drop down click the plus to add a new server.

We are going to fill the information from our TTN application.

The information can be found by going to Integrations, then MQTT in your TTN application page

Node-RED MQTT set up

where the server address is the TTN Public address

Node-RED MQTT set up

where the username is the TTN username in the MQTT settings and password is the Generated API key

On the first page set topic to #. This will subscribe to all topics, later on we can be more specific.

Click Update add a debug node and deploy

Node-RED MQTT set up

This will now recieve messages from TTN