Count elapsed hours | ThingSpeak API | 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
Count elapsed hours
No permission to create posts
August 8, 2017
11:39 pm
Avatar
viiartz

Silver
Members
Forum Posts: 9
Member Since:
July 5, 2016
sp_UserOfflineSmall Offline

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?

August 10, 2017
10:52 am
Avatar
cstapels
Moderator
Members


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

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.

August 13, 2017
2:44 am
Avatar
viiartz

Silver
Members
Forum Posts: 9
Member Since:
July 5, 2016
sp_UserOfflineSmall Offline

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

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

BrightfuryAboth, jaxs, WilanashAboth, TygolarAboth, HossokAboth, DoluneAboth

Administrators: Hans: 387, lee: 457