Log and view data from a node-red flow to thingspeak graphs
Raspberry pi running node-red, and an internet connection.
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:
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.