-->
Page 1 of 2

system_deep_sleep() bad accuracy

PostPosted: Thu Oct 05, 2017 10:14 am
by Niesma
Hello to the community, I am trying to improve the accuracy of the system deep sleep function. The problem that the esp8266 wakes up prematurely.
Could someone explain to me how this function works internally and the registers that it uses?
Thanks.

Re: system_deep_sleep() bad accuracy

PostPosted: Fri Oct 06, 2017 5:31 am
by schufti
as the used crystal is no precision part and heavily dependant on teperature, there is nothing much to improve. In average it wakes ~3% early ...

Re: system_deep_sleep() bad accuracy

PostPosted: Fri Oct 06, 2017 6:46 am
by andre_teprom
Niesma wrote:The problem that the esp8266 wakes up prematurely


As said above, some discrepancy is expected at all, since account is performed by an internal timer, but how much it happens ? What is the interval you have defined ? Unless you give more details, this question as posed is somewhat open ended.

Re: system_deep_sleep() bad accuracy

PostPosted: Fri Oct 06, 2017 4:36 pm
by Niesma
andre_teprom wrote:
Niesma wrote:The problem that the esp8266 wakes up prematurely


As said above, some discrepancy is expected at all, since account is performed by an internal timer, but how much it happens ? What is the interval you have defined ? Unless you give more details, this question as posed is somewhat open ended.

The sleep interval will be variable, the possible range will be from 1 minute to 60minute.
I think that: when the esp8266 is in deep sleep mode, the internal time is managed by a counter. The idea would be to compare the incremental value of the counter with an incremental real-time value before sleeping the esp8266. With these values, the counter and the real, would get a factor that would allow me to correct the time.