12:16 pm

August 2, 2020

Hello,

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.

11:50 am

Moderators

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 Online:

23 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:

swatiiot, kalyanigaware16@gmail.com, Romi, Drakan01, majidkhan7, atharvganlaModerators: cstapels: 460

Administrators: Hans: 405, lee: 457