Send "sensor error" to ThingSpeak
1 次查看(过去 30 天)
显示 更早的评论
Hello!
I'm using this simple code to send data to ThinkSpeak (ESP8266):
GET /update?key=xxxxxxxxxxxxxxxx&field1=025.0
It's working fine, no problem.
How can I send "sensor error" message to ThingSpeak? For example, the measured temeprature is out of range, unable to get temeprature data from the sensor etc. I would like to see errors in the graph, like in the attached picture. Is it possible?
Thank you!

2 个评论
Christopher Stapels
2020-2-22
You will most likely want to use the MATLAB visualizations app to make a custom visualization.
One method would be to use the another field to write the error code. I am assuming the error comes from the sensor. If not you can also use MATLAB to pre process your data and find the mising data. (like here)
So assuming your sensor writes the errors, it can write using the same url above, but use of '&field5=myerror'
Now you can create a new MATLAB visualization from your channel view or from the pulldown apps menu.
Use thingSpeakRead to get the data fro your channel. (you can read the last few days of data or minutes, or just the last x number of points).
I'd aslo use 'outputformat' 'timetable' in the thingSpeakRead command. Then you can plot the time and the data points.
for example:
mydata=thingSpeakRead(<channelID>,'readkey','xxxxxxxxxxxxxxx','outputformat','timetable');
plot(mydata.timestamps,mydata.field1name);
text(mydata.timestamps,mydata.field5name);
I haven't tried that though. It might put NULL everywhere there is no data in field 2. Then you might have to do some extra filtering.
回答(0 个)
社区
更多回答在 ThingSpeak Community
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Visualize Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!