Sleep time is not actual sleep time
-
Hello,
I use Sleep on one of my nodes and then wake up to report to GW.
It is set to sleep 3600000 which should equivalent to 1 hour (10006060).
However, I can see that this is not the case.
My node wakes up, but about every 1hour 9 minutes instead to report.
I'm using a arduino pro mini (chinese) so obviously this could be the culprit.
Just wondering if anyone else has seen this
-
@Nicklas-Starkel yes that is very common. The Arduino doesn't really know anything about time. It just knows how much time a clock cycle usually takes. But that varies with temperature, voltage and maybe some other factors.
If exact sleeping time is important, add a rtc module. See https://www.mysensors.org/build/display for an example.
-
@Nicklas-Starkel The sleep() function will use the watchdog timer to wake the ATmega from deep sleep again, not the regular oscillator.
This watchdog timer, contrary to the oscillator, can be off by +/- 10% (which is an ATmega limitation; it has nothing to do with Chinese origin), which roughly matches the time you measured.
The actual deviation depends on a number of factors, as @mfalkvidd already indicated.If however it is quite constant in your situation, you could simply corrrect for this offset by lowering the sleep time for your node.
E.g. try 60/69 * 3 600 000 = 3 130 435 and see if it now wakes up close to 1 hour.
-
@Yveaux and @mfalkvidd thanks!
It's not important for me, just curious to know why
Suggested Topics
-
Day 1 - Status report
Announcements • 23 Mar 2014, 22:45 • hek 24 Mar 2014, 20:12 -
Arduino nano and Uno in same My sensors network with NRF24L01+
Troubleshooting • 26 Jul 2024, 10:30 • DIY89 27 Aug 2024, 09:59 -
NODs stop responding, but ping works.
Troubleshooting • 20 days ago • Marcin 20 days ago -
Raspberry Pi 5: invalid GPIO 9
Troubleshooting • 27 Aug 2024, 13:20 • igo 27 Aug 2024, 13:20 -
Echo request is not set
Troubleshooting • 12 Aug 2024, 15:36 • kamilb85 3 Sept 2024, 08:58 -
Compiling Sensor code using BME280 and ESP8266
Troubleshooting • 26 Feb 2025, 00:32 • dpcons 26 Feb 2025, 06:22