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 커뮤니티
참고 항목
카테고리
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!