How Low Can It Go? Pro Mini XL (ATmega1284p) and Low Power
In The Beginning
The Pro Mini XL is built to be as low power as possible.
There’s no voltage regulator.
No power LED.
Only a user-programmable one attached to a single GPIO.
The only other components sprinkled around the board are those associated with the:
- Automatic/manual reset circuitry for FTDI uploading.
- External crystal oscillator running at 20 MHz.
- Decoupling the direct power supply to VCC, AVCC and AREF.
To prove-the-pudding, I initially made this YouTube video of a one powering down to ~137 nA and then waking up again:
In the above video, the Pro Mini XL, running at 1 MHz from a 3v supply, starts up with it’s LED on drawing around 3.2 mA.
The LED is then turned off, lowering the current to just under 1 mA.
Finally, the ATmega1284p is configured to wake-up through an interrupt on pin 2 and then put into power-down mode.
The power-down current in this state is around 0.137 µA (137 nA).
Looks good, but is it still alive?
Simply touching (grounding) pin 2 of the Pro Mini XL wakes the microcontroller up from power-down.
It then powers up the LED again, thereby bumping up the current draw back to 3.2 mA.
Now, 137 nA is actually slightly lower than the datasheet says is typical at this voltage (150 nA), so your mileage may vary:
Since then, I’ve been able to get even better results with some low power tricks and careful silicon selection.
My current (-no pun intended!) personal best is 95.5nA running at 1 MHz from a fresh 1.5v battery:
Various customers have since asked for help with how to best operate the Pro Mini XL in the lowest possible power state.
And the answer (like most questions of this type) is…
No wait – that’s the other one! 😉
The answer is…
On a lot of things actually.
Here are just a few:
- Speed (frequency) you need the ATmega1284p to run at.
- Voltage you need the ATmega1284p to operate at – as well as anything else connected to it.
- Which internal modules you’re making use of (e.g. ADC, I²C, SPI, UARTs, etc.)
- Which timers you need to keep running (e.g. WDT, Timers 0-3, etc.)
- Do you need to use the built-in Brown-out Detection (BoD)?
I could go on, but you get the point.
Now, there are lots of resources around on the Internet about power saving with AVRs.
Not least, you know, the actual microcontroller datasheet itself!
(I can hear the cries to RTFM ringing in my ears already…)
But then again, it is 461 pages long – and well, that’s usually not what you come to the Internet for, right?
(Just-in-time vs. just-in-case information anyone?!)
But I’ll still add a selection of resources for you at the end of all this, that I’ve personally found super-helpful.
So at the risk of re-inventing the wheel…
I’m planning to produce my own series of posts exploring the subject practically but specifically with the Pro Mini XL.
Many of the practical applications also apply to the original Pro Mini 328p and microcontrollers in general.
If you’d like to be notified when these new posts arrive, please check back regularly…or Subscribe!
I’ll also post cut-and-paste-able code you can use, and probably end up putting some Arduino Sketches on Github.
One Caveat (at least!)
I don’t know it all.
Nor do I claim to.
If you read something here you think I’ve gotten wrong, could be improved, needs correcting, etc. please let me know!
I know enough to do what I’ll demonstrate here and (hopefully) you’ll find that helpful.
But I’m still learning too – so I invite you to come alongside me and join the (never ending) learning journey!
Right, where to begin…
My current plan is to start with the techniques that typically have the biggest impact.
And split those up according to hardware and software categories.
But there’s definite overlap here so it won’t be a hard-and-fast rule that I’ll hold myself to.
It might be helpful to think of these techniques more as “tools-in-your-toolbox” to apply in your projects accordingly.
I’ll use this first post as a sort of table of contents and update it with direct links to each subsequent post as I go.
So far, the plan is:
Part 1 – Hardware: Frequency and Voltage Scaling (Upcoming…)
Clocks are power hungry beasts – all that current-induced level-toggling. You do know you don’t have to run the Pro Mini XL at 20 MHz, right? Save yourself some mA (and volts, maybe) and run slower…if you can. But remember that if you run faster, it also means that you can get done what you need to quickly and then go faster…to sleep!
Part 2 – Hardware: GPIOs and Feature Ferreting (Upcoming…)
Microcontrollers can be a bit like Swiss Army Knives. They contain lots of “tools” you may (or may not) need in any given situation. So what do you do with the tools you’re not using? Same thing you do with the lights when you leave the room. Turn them off! And save a few more mA. Your parents will thank you…maybe.
Part 3 – Software: Delays are Evil (Upcoming…)
Want to waste power? Go tell your 20 MHz Pro Mini XL to twiddle it’s thumbs for a while before moving on to something else. That’s what your delay(time_in_ms); code is basically doing. But what else can you do instead? Take a quick nap! But don’t forget to tell something to wake you up later…
Part 4 – Software: Timers vs. Interrupts (Upcoming…)
Bit of a tricky one and very much related to Part 3. Many existing software libraries and external hardware make use of Timers and Interrupts. Which ones are you currently using? When should you use them? Which power saving modes support waking up from which sources? What are the caveats? Questions, questions, questions…and some responses.
Part 5 – External: Power Gating (Upcoming…)
So you’ve taken care of your Pro Mini XL, but what about everything else it’s connected to? Can you just “sing it a lullaby” and send it to sleep too? Or maybe cut off its power entirely? What about powering it up again? Sure, you could use MOSFETs for this, but you might even be able to power it from a GPIO and save yourself some componentry!
Part 6 – External: Ultra Low Power Alarm Clocks (Upcoming…)
Internal Timers like Watchdogs typically need feeding µA to keep them regularly “barking” your Pro Mini out of its slumber. But there are lower power alternatives to choose from. For a few extra pieces of hardware, your little MCU can remain in nA power-down territory and still wake-up after a timed delay. Pretty cool, eh? There are caveats of course…
Part 7 – Bonus: Libraries That Do It All For You (Upcoming…)
Throw out your direct register bit manipulations for some simple function calls and quickly integrate low power into your projects. Consider using a Real-time Operating System (RTOS) to balance parallel processing and time spent asleep. Or maybe make your own libraries to fine-tune power savings for your specific project.
How does that sound?
Did I miss anything? Anything else you think I should be covering?
If there is, please let me know.
In the meantime, have fun and I’ll see you in the next post.