React for dawn determination | ThingSpeak Apps | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
React for dawn determination
No permission to create posts
November 12, 2018
7:49 am
Avatar
cYnd

Silver
Members
Forum Posts: 5
Member Since:
November 12, 2018
sp_UserOfflineSmall Offline

Hi all,

i am using a BME280 and BH1750 to gather some environment data and sending them to thingspeak. Working fine so far and i am really happy with thingspeak so far.
However i'd like to calculate the dawn so i can display it on a little webpage where i display all the other data.

The brightness is measured every 30 sec and send to a Thingspeak Channel as field5.

So my idea was to check at which moment the brightness has for 10 minutes an average of under 5 lux and save this moment as the dawning point. Then i can display this on my website.
I know that i can query the average of the via API request. So i thought of sending the query every X seconds to thingspeak, check if the value is below 5 and if so, send an field update to save this moment.

However i just discovered the Plugin React and ThingHTTP. So my question is, can i do this within Thingspeak? That would be really elegant not to send data from my sensor to Thingspeak, query these data on my raspberry and send them back to Thingspeak.

Thansk in advance and regards,
Jens Smile

November 12, 2018
10:44 am
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

I'm pretty sure you can do what you want to do (you can do some pretty elegant stuff), but can you clarify what you want the result to be?
"... not to send data from my sensor to Thingspeak, query these data on my raspberry and send them back to Thingspeak."

You can set a react to trigger when the field value is over a set threshold, or you can set a react on data insert that runs a MATLAB analysis that calculates the recent average. Then it could post the result to a webpage if criteria are met.

You could also use ThingHTTP to query a weather API, and compare your calculated dawn to the published value for that location.

November 12, 2018
11:03 am
Avatar
cYnd

Silver
Members
Forum Posts: 5
Member Since:
November 12, 2018
sp_UserOfflineSmall Offline

I don't want to call an external weather API since the lux from my sensor are sufficient 🙂

I want to determine the moment when the average 10 entries of a channel field is below 5. If this is the case, i just want to send the current datetime to a field on the same channel.

So i could use a cronjob to check every 10 minutes (or any other interval) to check if the feed of the follwoing query is below 5:
https://api.thingspeak.com/channels/622696/fields/5.json?results=1&average=10

However i am looking for a way to do it with thingspeak because otherwise i read the data from the sensor, send it to Thingspeak then query the data every 10 minutes and check if the value is below 5 and send it back to Thingspeak. Is there a way to do this directly with Thingspeak or MathLab?

November 12, 2018
11:17 am
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

You can set up a MATLAB analysis that reads the thingspeak data and calculates the average.

Data=thingSpeakRead(...)
aveData=mean(Data);
if aveData<5
%do stuff
end

If the value is below 5, then it can send data back to thingspeak, or trigger some other notification.
You can use TimeControl to call the MATLAB analysis every 10 minutes.
https://www.mathworks.com/help/thingspeak/timecontrol-app.html

The Getting started tutorial covers much of this and it doesn't take to long to do. It might give you more ideas about how you can use ThingSpeak.
https://www.mathworks.com/help/thingspeak/getting-started-with-thingspeak.html

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
15 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

qkpham, SANGAMNATH B, swatiiot, kalyanigaware16@gmail.com, Romi, Drakan01

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457