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 ?

37 views (last 30 days)
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
Alaa
Alaa on 27 Jul 2022
Edited: Alaa on 27 Jul 2022
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,

Sign in to comment.

Answers (3)

Christopher Stapels
Christopher Stapels on 28 Jul 2022
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
Christopher Stapels
Christopher Stapels on 2 Feb 2023
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.
ynit
ynit on 29 May 2023
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.


loli
loli on 14 May 2023
Edited: loli on 14 May 2023
% 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
ynit
ynit on 29 May 2023
hi, i'm quite new to thingspeak. i would just like to ask how often does it update and write data to channel 1?
Christopher Stapels
Christopher Stapels on 30 May 2023
Edited: Christopher Stapels on 30 May 2023
@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.


loli
loli on 14 May 2023
% 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

Categories

Find more on Read Data from Channel in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!