July 12, 2018
I am collecting sensor data that I am plotting to Thingspeak.
A particular sensor gives me 0 or 1 depending on the status of an electrical relay.
I am recording the time when the relay turns ON (value 1). Then I want confirmation that the relay turned OFF (value 0). This is expected to happen twice a day, every day.
Although I am keen to record / display the data to ensure the relay goes ON and OFF when it needs to, I am trying to minimise the data plotted as I have more than one sensor, and the website where I display the plots struggles due to the number of points.
I am aware of the min / max function that allows to eliminate "bad" data, but I need to see both 0 and 1 in my case, so this isn't an option unfortunately. I also cannot use the average function since I wouldn't know if I could have missed a "relay=ON" event.
Is there an easy way to only plot points that are different from one time iteration (t) to the next (t+1)? This would minimise significantly the number of points I want to display.
I am already using all the fields possible in my channel, so I don't think I can do a calculation in Matlab to then write onto a new field.
If removing duplicates is not an option, do you have any other suggestions?
Many thanks in advance.
March 7, 2017
Even if your fields are full, you can read data into a MATLAB visualization and plot it. Then you can add the visualization to the channel.
This is pseudo code, but hopefully will give you the idea.
myData=thingSpeakRead (channel, options...);
for i=1:length(myData)-1 % loop through data
FYI, MATLAB Answers is now the preferred location for online help regarding ThingSpeak topics.
Most Users Ever Online: 166
Currently Browsing this Page:
Guest Posters: 1
Newest Members:Abdallah, stonde, aster, R.Colombo, Ben-med, tcpipchip
Moderators: cstapels: 460
Administrators: Hans: 405, lee: 457