August 2, 2020
I am a Civil Engineer and has very limited knowledge about IOT.
I have set up a DS18B20 temperature sensor sending data to Thingspeak via a ESP8266 MCU.
The sensor is placed inside a concrete cube, measuring its setting temperature.
The measured temperature, lets call it Ta is to be used in the following equation.
M(t) = ∑ (Ta-Td) ∆t
Where M(t) – Maturity at age t (°C-Hrs)
Ta - Average Temperature in ° C
Td - Datum Temperature in ° C and is set to 0
∆t - Time Interval
As you can see Ta is the only measured data along with time interval between 2 readings (set to 30 minutes). I wish to create a MATLAB analysis wherein the measured temperature from the first channel is used to calculate M(t).
But I dont know how to code the above formula as it requires to add the calculated M(t) once every 30 minutes and tell the updated value.
I would greatly appreciate your help.
March 7, 2017
Set up the following MATLAB analysis
myTimeTable = thingSpeakRead(channelID, 'ReadKey', ''READAPIKEY", 'outputFormat','Timetable', 'numMinutes',1000);
%I presume your average means average temperature over the local time segment, so just the temperature value written.
% If we need to average over several values, that can be done as well.
timeDurations = diff(myTimeTable.Timestamps)
sumElements = timeDurations * myTimeTable.TEMPERATUREFIELDNAME; %replace TEMPERATUREFIELDNAME with your temp field
total = sum(sumElements);
Total will then be in units of scaled durations - i.e. hours and minutes times temperature. There are MATLAB functions to convert it to seconds or whatever units you like.
Then set up a timecontrol to call this code at whatever interval you like.
then you can even add a ThingSpeakWrite at the end to write the output to another channel each time the calculation runs.
FYI MATLAB answers is the preferred location for ThingSpeak support.
Most Users Ever Online: 166
Currently Browsing this Page:
Guest Posters: 1
Newest Members:bogart, estebanmateo93, mikewrite, onlinebusiness, winzy99, Zark_zeugan
Moderators: cstapels: 460
Administrators: Hans: 405, lee: 457