Count elapsed hours | ThingSpeak API | Forum


Please consider registering


— Forum Scope —

— Match —

— Forum Options —

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

Register Lost password?
sp_Feed sp_TopicIcon
Count elapsed hours

Forum Posts: 9
sp_UserOfflineSmall Offline
August 8, 2017 - 11:39 pm
sp_Permalink sp_Print

Hi All, I have a ds18b20 temp sensor on an esp8266 -13 uP updating one of my channels every couple of minutes. The board is running from a 10000mAh power bank and based on my calculations it should run for about 200 hours. I'm just testing at the moment so I'm deleting all the data in the channel and starting afresh each time I replace the batteries. So, I wondering how I could keep track of how many hours I've been running with Matlab code and save the (count) calculation to a field on the channel. I'm already running code that looks up the max and min temp for the last 24 hours every five minutes so I could place the snippet of code there, I just don't know how to go about doing the counting of elapsed hours from initial power up, I do know how to save data to a field.

Any thought, ideas, hints, examples?

Forum Posts: 193
sp_UserOfflineSmall Offline
August 10, 2017 - 10:52 am
sp_Permalink sp_Print sp_EditHistory

If you are trying to do it on the device, I think you may be able to use the millis() function to do this task.  It gives the number of miliseconds since startup.  If you want to do it in MATLAB, now will give you the present time that you can save, and then use datetime to manipulate the dates.


Forum Posts: 9
sp_UserOfflineSmall Offline
August 13, 2017 - 2:44 am
sp_Permalink sp_Print sp_EditHistory

I decided to keep track of uptime on the device (ESP8266 ESP-13). I based my solution on a sketch I came across here

So, I generate a string (ie "2-21-45") where the first digit is the elapsed days next is the hours and the last digit is the minutes. Upload to field3 of my channel I use a bit of javascript generate the text posted on the web page (ie uptime 2 Day, 21 Hour, 45 Minute).

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
28 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:







Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565


Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee