skip to Main Content

RPi Node Red: Logging Data to Thingspeak

Setup thingspeak, an online data logging service that allows you to create and view graphs online. Send data from node-red to thingpseak and log your own data online.

What you will learn:
What thingspeak is, and how to configure node-red to send data to it.


Thing-speak is a free online service ran by IBM which accepts data from users, and allows them to publish graphs and charts. Thingspeak was designed to take data from IoT devices like fitbits or fridges, but it also accepts data from node-red perfectly well.


Raspberry pi running node-red, and an internet connection.

Getting Started:
Step one is setting up a thing-speak account, which is very easy. All you need is an email-address and a name.

Once you have created and logged into your account you can start setting up your first data-channel.

Come up to the ‘Channels’ menu, and select ‘my channels’. Then start creating a new channel in the channels page.

When creating a new channel the most important thing is to specify how many fields of data you want to log. In this example we are logging air-particulate which sends 3 fields of data representing 3 different types of air-particulate.


Setting up the flow:

When you have the thingspeak node dragged in, the most crucial option are these ‘topic’ fields.
It’s important to note that the ‘field topics’ entered here don’t have to be related at all the names of the fields you entered on the thing-speak website. I find it easiest to just use 1 .. 8 for these.

If the Topic for field one set to ‘1’; any data that is injected into the thing-speak node with a msg.topic of ‘1’ will be forwarded to field 1 on your thing-speak channel.

In the example flow we use a change node to make sure incoming data gets sent to the correct field.


Between your data and the thingspeak node drag a change node, and set it to modify the topic to match the thingspeak channel like in this example:


API keys:

The final ultimate step before you can see your data live on your thing-speak channel is setting up the private API key. Each channel only accepts data that has the correct API key attached, this is what stops random people from spamming your thingspeak with their own data.

All you need to do is copy the write api-key from the api-keys tab straight into the thingspeak node; and you’re good to go.
Don’t copy the API key from this screenshot!

Back To Top