Sleep time accuracy
-
I have 1h sleep time.
#define SLEEP_TIME 300000*12
However, it takes 1h14min30sec to report to Domoticz the next value.
I am running atmega328p 8Mhz internal clock.How can I improve a sleep function accuracy please assuming the node is used internally (20-22C and 2-3V voltage range)
-
@alexsh1 divide the selected sleep time with the actual time and adjust the number?
When the atmega328 is sleeping, the watchdog timer is used to measure time spent. It is not designed to be accurate.
A rtc module can be used to get more exact timing.
-
@mfalkvidd Yeah, that's what i started doing and ended with 459059 for 10 minutes. Let's see if this is more accurate.
Appreciate it is not designed to be super accurate, but 15 mins every hour is just too much imho.
-
@then you'll need to get a mcu that is more accurate or get a rtc.
http://www.avrfreaks.net/forum/improving-watchdog-timer-accuracy describes a calibration method that might be useful.
-
@mfalkvidd I may look at Anarduino - they come with RTC:
ATmega328, 16Mhz LDO Voltage Regulator 128 Mbit flash memory Real Time Clock (RTC) 64B RTC Static Ram Tactile Reset Switch Wireless Transceiver Size: 33 x 22.8mm