18 thoughts on “Arduino power saving tutorial: clock pre-scale and sleep”
Thanks so much. Great idea for lower power consumption in less demanding applications without having to deal with waking up etc. Of course, I suppose you'd want to actually use sleep modes if you've gone that far, but definitely a good programming time/power savings ratio!
I always thought it was mad to include a deep sleep function that requires a physical interrupt to bring it back to life. Why not just deepsleep(1Hour)? Anyway, best way to do this is by removing the power completely to the Arduino with a TPL5110 power timer breakout chip – really easy to use. The only downside is it can only delay by 2 hours max. Data sheet for TPL5110 says 35nA when timing. In reality it is 20uA, which is pretty good!
Julian, have you produced a video on how to lower the brown out detector to 1.8 volts? Can you use another arduino to reset the bod or do you have to use programmer? Thanks.
Great video!! Have you tried waking up the mini with an interrupt using wd ? I am trying similar but having issues with configuration of wd with nano the nano just crashes
You can also use inline assembly for the sleep instruction. After setting up the registers just write the following line: _asm_ __volatile__("sleep"); Ok, unfortunately youtube makes the "asm" italic and removes two underscores. It's two underscores before and after asm. Also, if you wanna save power you should probably start with the simple stuff, like setting all your pins high or low, so they are not floating (as that causes the ATmega and many other microcontrollers to draw a little more power) and disabling peripherals like the ADC, UART and/or timers that aren't needed etc. (keep in mind that timer0 is used by millis, delay etc.) then if you wanna save even more power you can put the ATmega to sleep and get the current under 1 microamp if needed.
I also disabled the ADC and Brown-Out and got the board down to 22uA. I had trouble with the onboard Linear Regulator. Mine was a SOT23 L05 (3 Legs), yours is a SOT23-5 LG50. (5 Legs) It was drawing 2.2mA at start, but current draw kept increasing as time went by. I tried powering the board from 12V initially, but then I powered everything from 5V and I got the same 2.2mA current draw. So I started removing components from the board (Crystal, Linear Regulator, Resistors, Capacitors) I started looking into 7805 datasheets and I saw a Typical Quiescent Current of 3.2mA. So be aware of cheap Chinese boards if your are looking into Low Power stuff.
Thanks so much. Great idea for lower power consumption in less demanding applications without having to deal with waking up etc.
Of course, I suppose you'd want to actually use sleep modes if you've gone that far, but definitely a good programming time/power savings ratio!
I always thought it was mad to include a deep sleep function that requires a physical interrupt to bring it back to life. Why not just deepsleep(1Hour)? Anyway, best way to do this is by removing the power completely to the Arduino with a TPL5110 power timer breakout chip – really easy to use. The only downside is it can only delay by 2 hours max. Data sheet for TPL5110 says 35nA when timing. In reality it is 20uA, which is pretty good!
Julian, have you produced a video on how to lower the brown out detector to 1.8 volts? Can you use another arduino to reset the bod or do you have to use programmer?
Thanks.
Could you also disable the ADC to lower the power requirement?
Great video!! Have you tried waking up the mini with an interrupt using wd ? I am trying similar but having issues with configuration of wd with nano the nano just crashes
Does it makes any sense to put a (NodeMCU-8266 + MAX7219) project into Sleep mode if the display time is only updating every 1 minute?
Can the clock frequency be changed dynamically? Or can it only be changed at start up?
Ie, can I use this to reduce power consumption during ‘down time’ but speed it up during other times ?
Now that's a vedio worth subscribing
IQ +10 Thank you.
You can also use inline assembly for the sleep instruction. After setting up the registers just write the following line:
_asm_ __volatile__("sleep");
Ok, unfortunately youtube makes the "asm" italic and removes two underscores. It's two underscores before and after asm.
Also, if you wanna save power you should probably start with the simple stuff, like setting all your pins high or low, so they are not floating (as that causes the ATmega and many other microcontrollers to draw a little more power) and disabling peripherals like the ADC, UART and/or timers that aren't needed etc. (keep in mind that timer0 is used by millis, delay etc.) then if you wanna save even more power you can put the ATmega to sleep and get the current under 1 microamp if needed.
I also disabled the ADC and Brown-Out and got the board down to 22uA.
I had trouble with the onboard Linear Regulator. Mine was a SOT23 L05 (3 Legs), yours is a SOT23-5 LG50. (5 Legs)
It was drawing 2.2mA at start, but current draw kept increasing as time went by.
I tried powering the board from 12V initially, but then I powered everything from 5V and I got the same 2.2mA current draw.
So I started removing components from the board (Crystal, Linear Regulator, Resistors, Capacitors)
I started looking into 7805 datasheets and I saw a Typical Quiescent Current of 3.2mA.
So be aware of cheap Chinese boards if your are looking into Low Power stuff.
Great video 😉
you are setting CLKPR to two different values. Why?
try OBS screen capture or uploading you source code
Not for nothing but you do not show the power source hookup for us newbies so I give you one star
Great video – is there a way to sleep for a duration (eg. if you wanted to wake up and do something every 5 minutes)?
hello Julian i have tried this many times and one problem i have is that when in sleep mode i can not get below 2.06 ma no matter what i do.
Could you clockdown the processor on a wemos d1 mini pro although it has not an atmel chip?