Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By mat424
#82759 Has anyone been able to keep time roughly with the internal RTC after going to deep sleep? In my case I'm on the worst situation possible - a battery-powered device that already got a little bit too bulky, goes to sleep infinitely after an interrupt by a sensor sends a pulse to the reset pin, then measures from an accelerometer and writes to a csv in SPIFFS. All of this on an ESP12E.

Thing is, the device will only have a wifi connection once a day, and then has to keep the time for around a day (wouldn't mind a drift of 10 minutes or so, it's mostly to check intervals between deep sleep, and in addition having the rough time at which it was triggered wouldn't be bad at all).

So, the question remains: After looking around in these forums, there's seemingly no way to keep the time after a wake-up. Would love to avoid having to use an external RTC if possible. Is there any workaround for this, or I'm doomed?

On a side note, I think I could use short, 1 minute deep sleeps and a counter on RTC mem, then check reset cause, and determine if the reset was scheduled or because of the sensor. But I would need to reduce the boot time, which is still too long even having wi-fi off (WAKE_RF_DISABLED). Any tips? I think I've seen a modified bootloader with MUCH faster boot times but it had wifi off altogether
User avatar
By QuickFix
#82773
mat424 wrote:Is there any workaround for this, or I'm doomed?

Doomed is a bit strong, but yes: if you want more resolution/accuracy for deep sleep then you're out of luck without a workaround.

If you're willing to let an external RTC wake up the ESP, than it shouldn't be too difficult, when you only need the exact time (for instance for a timestamp), you can either use a time-server (no external hardware necessary) or an external RTC or GPS-module that can give you a precise time.
User avatar
By mat424
#82817
QuickFix wrote:
mat424 wrote:Is there any workaround for this, or I'm doomed?

Doomed is a bit strong, but yes: if you want more resolution/accuracy for deep sleep then you're out of luck without a workaround.

If you're willing to let an external RTC wake up the ESP, than it shouldn't be too difficult, when you only need the exact time (for instance for a timestamp), you can either use a time-server (no external hardware necessary) or an external RTC or GPS-module that can give you a precise time.


That's actually the point, I don't need any of those two... I need a very low resolution way of keeping the time (If it drifts some minutes per day it's not at all important) for a simple timestamp that gives me a rough idea of when something happened, or maybe just how much time the esp was on deep sleep, and I won't be waking up the ESP with it. The idea that I had was making the ESP sleep for 1 minute intervals and counting them after the reset cause wasn't deep sleep anymore, as this would give me a rough idea of the external (sensor+opamp+edge trigger) wakeup intervals. that's how low res i need it. But I've been trying to install MinEspSDK to lower the wakeup times (wifi off, but it's still slightly long with the stock firmware) and it's a little bit over my head unfortunately.