In thingspeak , how can I visualize two or more channels on one page so I can view different fields from different nodes at a time ?

I'm working on a project that contains several distributed nodes. I assigned one channel for each node. my question is " how can I visualize the data coming from different channels on one page?

3 Comments

Use custom MATLAB visualizations to read the data from other channels and show it on a combined channel. You can create multiple visualizations on the channel, or use one visualization to read multiple channels and combine the output into one plot. Or you can use tiledlayout to product multiple plots in one figure. Use the provided template code to build visualizations if you dont have MATLAB experience.
They will referesh manually on page refresh. If you have a paid license, you can check a box to have them automatically refresh.
Thank you Mr.Stapels
You are right . this is first time to work on MATLAB.
Kindly, can you guide me to the "provided template code" you mentioned and any available previous similar projects?
also, I'm planning to buy a student license. can I get "automatically refresh" with this type of license?
Regards,
Yes, paid licenses allow you to create visualizations that automatically refresh.

Sign in to comment.

Answers (3)

In the tabs on the top of the ThingSpeak site, Click on Apps > MATLAB Visualizations then click the green 'New' button, and you will see choices for template code. You can do the same thing to get MATLAB analysis template code as well. The apps are similar, but you need the visualizations app to do visualizations and you can only use code writte in the analysis app for a trigger in React or TimeControl.
For other great examples, see the doc, and click the examples tab. There is an example relating to each of the template codes, for example this one on multi-day visualizations.

3 Comments

this doesnt answer the question "How to visualize data from TWO different channels. ie Temperature from Channel 1 filed 3 vs Humidity from Channel 2 field 5? I dont see any examples for this in the answer about.
the example " this one on multi-day visualizations." is not an answer.
To read multiple channels, change the channel id in the thingSpeakRead function. The multi day visualizations does in fact help answer this question in that it shows you how to make consecutive calls to thingSpeakRead, and shows a way to assemble the data. If you take that example and use consecutive reads with different channel id's (and perhaps different field id's), you will have what you indicated in your question. If you are still stuck, please consider starting a new question and describing your issue in detail.
hi, i'm quite new to thingspeak. i would just like to ask how often does it read data from other channels and write data to another channel?

Sign in to comment.

% Replace the placeholders with your ThingSpeak channel IDs
channelID1 = 12345; % Channel 1 ID
channelID3 = 67890; % Channel 3 ID
channelID4 = 98765; % Channel 4 ID
% Replace the placeholders with your ThingSpeak read API keys
readAPIKey1 = 'YOUR_READ_API_KEY1';
readAPIKey3 = 'YOUR_READ_API_KEY3';
readAPIKey4 = 'YOUR_READ_API_KEY4';
% Read the data from channel 3
[data3, time3] = thingSpeakRead(channelID3, 'ReadKey', readAPIKey3);
% Read the data from channel 4
[data4, time4] = thingSpeakRead(channelID4, 'ReadKey', readAPIKey4);
% Combine the data from channel 3 and channel 4
combinedData = [data3, data4];
combinedTime = [time3, time4];
% Write the combined data to channel 1
thingSpeakWrite(channelID1, combinedData, 'WriteKey', readAPIKey1, 'TimeStamp', combinedTime);
here i write a code To show channel 4 and channel 3 data in channel 1 on ThingSpeak, you can use MATLAB code or the ThingSpeak API. Here's an example of how you can achieve this using MATLAB code:
i hope you can get it ..

2 Comments

hi, i'm quite new to thingspeak. i would just like to ask how often does it update and write data to channel 1?
@ynit Perhaps start a new thread or question. Then you can describe specifically what you mean and we can help you best.

Sign in to comment.

% Replace the placeholders with your ThingSpeak channel IDs
channelID1 = 12345; % Channel 1 ID
channelID3 = 67890; % Channel 3 ID
channelID4 = 98765; % Channel 4 ID
% Replace the placeholders with your ThingSpeak read API keys
readAPIKey1 = 'YOUR_READ_API_KEY1';
readAPIKey3 = 'YOUR_READ_API_KEY3';
readAPIKey4 = 'YOUR_READ_API_KEY4';
% Read the data from channel 3
[data3, time3] = thingSpeakRead(channelID3, 'ReadKey', readAPIKey3);
% Read the data from channel 4
[data4, time4] = thingSpeakRead(channelID4, 'ReadKey', readAPIKey4);
Channel ID must be a positive integer.
% Combine the data from channel 3 and channel 4
combinedData = [data3, data4];
combinedTime = [time3, time4];
% Write the combined data to channel 1
thingSpeakWrite(channelID1, combinedData, 'WriteKey', readAPIKey1, 'TimeStamp', combinedTime);

Communities

More Answers in the  ThingSpeak Community

Asked:

on 27 Jul 2022

Edited:

on 30 May 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!