I 'm making a project where I want the Arduino to fall asleep and then wake up every 5 minutes.
I read that there is a library called 'Narcoleptic' that can do this.
And another way is a DS3231 RTC module which will wake it up.
Given the fact that I don't care grate time accuracy (I don't mind if it's waken up every 4.5 minutes), does the use of the Narcoleptic library have any more dissadvantages in comparison to the DS3231?
(a dissadvantage of the DS3231, for me, is the extra circuitry for it's connection)
I don't use the Narcoleptic library (I use SleepyDog) but it's probably using the AVR's watchdog timer (WDT) to sleep so the actual maximum time you can sleep will be 8 seconds but you can then just increment a counter and go straight back to sleep until the counter is 38 (38 * 8 = 304 seconds) and then stay awake long enough to do something useful before resetting the counter and starting again.
panoss:
Are you suggesting me to use SleepyDog?
(and certainly you don't see the need for an external RTC, right?)
I'm not suggesting you use SleepyDog instead but it looks a bit simpler to use after checking out the Narcoleptic library but both achieve the same results.
As your not to bothered about the duration I would say a sleep library will be fine and no need for an RTC.
panoss:
Does 'WatchDog.sleep()' allow the watchdog to reset the mcu in case it freezes?
I think you will need to switch between Watchdog.sleep() and Watchdog.enable()/Watchdog.disable() when awake as sleep is in effect locking up the MCU and relying on the WDT to kick it awake again.
Properly written code should not tend to allow lockups but if your code is that critical then maybe consider and external watchdog.