How to Subscribe MQTT Messages from LoRa Server



The purpose of this article is to subscribe to data messages from TTN nodes using the MQTT plugin in the data flow applicition Node-Red provided by TTN.

The experiment kit used in this experiment is HT-M02, and CubeCell-board.

Maybe you don’t have a real device. You can still test this solution through the simulation uplink provided by TTN. How to use please see below.


Download and install Node-red(takes a long wait)

If you are on a Raspberry Pi or any Debian-based operating system, including Ubuntu and Diet-Pi, you can use the Pi install script available here.

bash <(curl -sL

If you want to install to other operating systems such as Windows, RedHat, CentOS, please refer to the official installation guide of Node-Red:

Configure Node-Red

I access the web interface provided by Node-Red in ubuntu, so the port accessed through the browser is: localhost:1880

Then we need to download the TTN plugin in Node-Red.

Add TTN palettes to Node-red

  • Installation via user setting in Node-Red panel


  • Install from the command line

    npm install node-red-contrib-ttn@2.0.1

We need to configure the data source from TTN, such as APP EUI, APP KEY, DevEUI and other parameters…

We select INPUT-> ttn_message palette from the downloaded TTN plugin, which is on the left side of the panel. Drag it into the Flow panel on the right.


Next, Double-click it fill in the key parameters such as the application EUI, KEY, and Device ID that we registered in TTN.



Click Update after configuration.

Configure MQTT plugin

We need to configure the topic forwarded by the MQTT plugin.

For example, now I want to wrap the upstream message of a node into a topic named Node_uplink through the MQTT plugin and forward it to my private MQTT Broker.

First, select the OUTPUT-> mqtt palette in the left panel. Drag it into the Flow panel on the right.


Next, double-click it to fill in our reposted topic. In the end, you must fill in your target broker.



After filling all the palettes, we must connect them in Flow.


Please don’t forget to click the Deploy button in the upper right corner to make them effective after completing all the configurations.


View subscription

Then use MQTT.fx software to subscribe to this topic. If it goes well, we will see the default uplink data 1, 2, 3, 4.(ASCII: 31 32 33 34) of CubeCell-Board in MQTT.fx software.


We successfully subscribed the payload of the uplink data of the nodes in the TTN through MQTT.

If you don’t have a real device, you can use the SIMULATE UPLINK prepared by TTN for you, which can be used like this:


It’s in the Application-> Device page you created.

Click Send to simulate the node’s Uplink data.