Count elapsed hours | ThingSpeak API | Forum

Avatar

Please consider registering
Guest

Search

— 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
Avatar
viiartz

Silver
Forum Posts: 6
sp_UserOfflineSmall Offline
1
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?

Avatar
cstapels

Gold
Forum Posts: 39
sp_UserOfflineSmall Offline
2
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.

Avatar
viiartz

Silver
Forum Posts: 6
sp_UserOfflineSmall Offline
3
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 https://goo.gl/u63bwU

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:
17 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 247

Vinod: 140

piajola: 71

vespapierre: 63

Adarsh_Murthy: 59

chrisjmears: 54

Newest Members:

DFence

HariKrishan

guya

Vicky66

RobO

Gottmoz9

Forum Stats:

Groups: 4

Forums: 17

Topics: 1209

Posts: 4235

 

Member Stats:

Guest Posters: 1

Members: 5480

Moderators: 0

Admins: 2

Administrators: Hans, lee