# Periodic waking up from deep sleep

what are the main used ways of how to handle deep sleep of some microcontroller (atmega or a cortex m0/m0+) with waking up periodically? Right now, I'm building a Sigfox GPS tracker that should send GPS position every ~10 minutes and this interval should be configurable. I solved this problem in previous projects either by using external RTC IC (temperature compensated for great precision) or counting of 8sec intervals (let's see https://github.com/rocketscream/Low-Power). What are the other ways and their advantages? My plan is to either stick to the Arduino ecosystem or switch to the STM32 world (maybe with a bit of help of mbed platform). I really appreciate all your feedback.

• How much power will the GPS receiver use in relation to the uC? – JimmyB Mar 21 '17 at 16:10
• Counting 8 sec. intervals should be almost perfectly efficient. This way you'll probably be deep sleeping 99.9999% of the time. Not much more to be gained here. – JimmyB Mar 21 '17 at 16:13
• Thanks for the feedback. GPS chip (Ublox NEO-M8N or Quectel L86) shall be turned off or in sleep mode while uC is sleeping. I suppose it should be OK to start with the counting of intervals (because it's simple) and after a few tests decide what to do next. – Jaryn6909 Mar 21 '17 at 16:28
• Notice that many AVRs have one timer that supports an "asynchronous mode" where the timer is clocked by an independent external watch crystal (32kHz). This timer runs in deeper sleep modes and can wake up the CPU in flexible intervals defined by the prescaler and TOP value of the timer. – JimmyB Mar 21 '17 at 16:33
• I ask about the GPS chip because I assume that it will take several seconds of relatively high power consumption to (re-)acquire the position after 10 minutes, which may make any power saving in the uC futile. – JimmyB Mar 21 '17 at 16:35

Generally an RTC interrupt is the best way to go for a long period in deep sleep. If you can use the RTC built into the micro this will generally give you a simpler implementation but may not be the absolute lowest power possible or most accurate.

If you do go the mbed route then this library will probably be of use. However take care, some of the boards are not really well designed for lower power, while the processor will go into deep sleep on just about all of them some of the boards can't shut the rest of the circuits into low power modes and so the total system deep sleep power draw can be far higher that you'd hope for. Other boards are better able to cope with this and can get down to tiny power consumptions.

• Thanks for the link. I'm going to explore the 32kHz crystal way more closely in the future. I used external RTC for outdoor weather sensor (temperature range from -25°C to 40°C). Reporting was performed once every hour. So I suppose that was perfect use case for such external IC. – Jaryn6909 Mar 21 '17 at 16:20
• +1 for mentioning the significant amount of power wasted by the support boards (looking at you, Arduino). A single "power on" LED can take more current than the uC running full throttle. – JimmyB Mar 21 '17 at 16:41
• I had fun once with an mbed board where the deep sleep power consumption was 60 times higher than it was supposed to be. It ended up being the internal pull up on an unused input pin fighting the external pull down on that pin to set the boot mode. Configuring that pin to disable the default pullup cleared the issue. It's the sort of detail that is so easy to overlook and when running it's a drop in the ocean. But when you are aiming for 2uA current draws it doesn't take much to ruin things. – Andrew Mar 21 '17 at 16:52

Your problem here is your 10 minutes mark, because (as you already know) the maximum interval of the watchdog timer of ATmega MCU is just 8 seconds.

One option would be to use a low-power, programmable, external timer like TPL5110. You can set an interval of up to 120 minutes by selecting the appropriate value of the programming resistor.

This kind of timers can be used to drive the gate of a logic-level P-channel MOSFET that acts as a switch for the power line of the Arduino (and for other parts of the circuit, if you want to cut down power consumption), like this:

Then, you simply you do all your stuff on the setup() function and leave loop() empty. You can switch off the Arduino by sending back a DONE signal to the TPL5110 at the end for your setup().

• Thanks a lot for the feedback. "You can set an interval of up to 120 minutes by selecting the appropriate value of the programming resistor.". So I would need a digital potentiometer for the DELAY pin to be able to change the interval. – Jaryn6909 Mar 21 '17 at 16:40