Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By dynek
#34167 Hello all,

For a project I'm working on, I'm trying to have an ESP-07 wake up every hour.
So what I have done so far is call ESP.deepSleep and subtract micros() from the sleep interval (1h):

unsigned int sleeptime = SLEEP_INTERVAL - micros();
ESP.deepSleep(sleeptime, WAKE_NO_RFCAL);

I understand I won't get perfect accuracy but what can I expect from that ?
It doesn't seem to be that accurate :-(

Thank you
User avatar
By torntrousers
#34230 From what i can tell the few ESPs i've tried the clock runs a little slow, so in 24 hours its slow by about 7 minutes, which i guess is about 18 seconds per hour. I don't know if thats just coincidence on the ones i've tried or that the design really is that they are all running a little slow. It also seems to take take a few hundred milliseconds to go to sleep after the deepSleep command is issued which i guess could start to add up to 7 seconds or so per day if you're doing it every hour.

What sort of accuracy are you seeing and what are you expecting?
User avatar
By Eyal
#34237 I have projects that wake up every 1m or 5m. I run them for a day and then set a multiplier on the sleep time. I get a reasonable accuracy of a second or two per day. It seems to change slightly during the day, may be due to temperature variations.

Code: Select allsleeptime = SLEEP_INTERVAL*factor - micros()

I usually end up with a factor of around 1.02 - 1.04 - so far they are all (about 10 different ones) slow.
User avatar
By dynek
#34283 Hello,

What value does SLEEP_INTERVAL have in your case? 3'600'000'000 ?

Even though it runs as expected, I'm wondering if batteries have an effect on that :?
I had better accuracy sometimes but since few days it's getting .. weird:
Code: Select all2015-11-15 18:36:28
2015-11-15 19:35:31
2015-11-15 20:35:33
2015-11-15 21:35:48
2015-11-15 22:36:09
2015-11-15 23:36:19
2015-11-16 00:36:01
2015-11-16 01:35:59
2015-11-16 02:36:08
2015-11-16 03:36:27
2015-11-16 04:36:42
2015-11-16 05:36:54
2015-11-16 06:37:00
2015-11-16 07:37:09
2015-11-16 08:37:06
2015-11-16 09:37:24
2015-11-16 10:37:37
2015-11-16 11:37:49
2015-11-16 12:37:57
2015-11-16 13:38:08
2015-11-16 14:38:21
2015-11-16 15:38:34
2015-11-16 16:38:43
2015-11-16 17:38:48