MATLAB Answers

ThingSpeak : Read & Write Multiple Field

62 views (last 30 days)
Ravi Ghimire
Ravi Ghimire on 27 Jan 2021
Commented: BEHNAM MOBARAKI . on 20 May 2021 at 14:49
Hello, Could you please recommend me best method for multiple fields read & right in ThingSpeak?
  1. I want to write in MATLAB Simulink via ThingSpeak Cloud from MIT APP Inventer Application , 4 fields with ( digital write 0,1)?
  2. I want to read 3 field value and read it from MIT App inventor via ThingSpeak Cloud?
i have problem in reading and writing multiple channels , can somebody recommend be the best way.

Answers (2)

Christopher Stapels
Christopher Stapels on 27 Jan 2021
Can you describe the data flow a bit more?
"in MATLAB Simulink via ThingSpeak Cloud from MIT APP Inventer Application "
What is the MIT App interacting with? Is it a deployed simulink model on hardware?
The MIT app will support POST commands (I'm pretty sure), you can post to you channel using the REST API write endpoint. You can update multiple fields simultaneously.
POST https://api.thingspeak.com/update
api_key=XXXXXXXXXXXXXXXX
field1=73
field2=37
etc...
You can also use the GET command and append additional fields
Similarly, you can read the whole feed (all fields ) at once with read data. I would use the JSON format, then you can parse the response for the fields you want.
https://api.thingspeak.com/channels/<channel_id>/feeds.<format>

BEHNAM MOBARAKI .
BEHNAM MOBARAKI . on 20 May 2021 at 13:28
Hi every body.
I am sending temperature measurement of 3 sensors to 3 fields of a channel in ThinSpeak (through NODEMCU ESP8266). What I need is that to do calculation of data from these 3 fields. For instance, I need to take the average of temperature of the 3 sensors at time n, then taking average the 3 measurements at time n+1 then at time n+2. Finaly illustrate the average curve on a single graph.
Could you please help me in this way?!
  2 Comments
BEHNAM MOBARAKI .
BEHNAM MOBARAKI . on 20 May 2021 at 14:49
Many thanks Christopher,
I folloewd the example and it was very usefull. This example takes the average value of the measurements in a single field (lets say a single sensor). In my case, I have 3 fields (each filed is receiving temperature measuremnt from individual sensor). All the sensors have the same measurement frequency. What I need is that to read/take the temperature at time N from all the 3 sensors (in 3 fields), take the average of them and send the average value to a new channel. The second input of the new channel gonna be average value of temperature from the 3 sensors at time N+1.
I mean I wanna do calculation on the inputs of multiple fields and send it to another channel.
Thanks in advance for your help

Sign in to comment.

Communities

More Answers in the  ThingSpeak Community

Community Treasure Hunt

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

Start Hunting!