Home › Forums › Mayfly Data Logger › Sleep Mode Low Power. › Reply To: Sleep Mode Low Power.
There are several different methods you can use to wake a sleeping processor using a realtime clock. The example I posted uses the method of triggering an interrupt pin on the processor by using a quick pulse that the RTC puts out every minute. By doing this, the processor can wake up each minute and then it’s up to the user’s code to examine the current time and either do something or go back to sleep and wait another minute. I used this example since it’s the easiest for other people to choose whether they want to do something every minute or every 5 minutes or any other interval. You could certainly wake the processor only at select times by using the alarm feature of the RTC. It looks at the current time (3:30 for example), then adds a specific interval (15 minutes) to determine what time the next wakeup event should be (3:45), then puts the processor to sleep and it won’t wake up again until that interrupt at 3:45. There are some other Arduino libraries that you can use for interacting with the RTC and setting alarms instead of using the Sodaq_DS3231 library that I used in that example. Just search the web for example sketches for setting alarms on the DS3231. Keep in mind that the Mayfly board’s default pin is A7 for reading the square wave alarm output from the DS3231, which is why you also need the Sodaq_PcInt library (this library allows other pins to be used as interrupts besides the board’s regular hardware interrupts of D0, D1, and D10). If you really want to use a hardware interrupt instead of the pin change interrupt, you can modify the solder jumper SJ1 on the back of Mayfly boards version 0.4 and greater by cutting the trace to the A7 pad and solder jumpering to the D10 pad.
But I prefer to just wake it up every minute since it’s simpler for my purposes. When using this method, the processor is really only awake for a few milliseconds each minute, and it’s so quick that you can’t see it when looking at the board’s current draw on an ammeter. So waking a Mayfly for a few milliseconds each minute really has no greater draw on the overall power consumption than than letting it sleep continuously and only waking at longer intervals.