Increasing Battery Life of Your Arduino Project
by arduinocelentano in Circuits > Arduino
502 Views, 2 Favorites, 0 Comments
Increasing Battery Life of Your Arduino Project
If I may be as brutally honest as possible, Arduino development boards are not exactly supposed to be used in final devices. Their purpose is to facilitate prototyping. That is why they are called development boards. You have to design a specific PCB for each particular project to ensure power efficiency. Nevertheless we often embed development boards into our hobby devices since they are cheap and… just work. Let’s see what could be done to optimize their power consumption.
⚠️ The author reserves the right not to be responsible for any damage or your action caused by the use of this instructable. However, you may use it on your own hardware at your own risk.
Supplies
- Arduino board and external modules
- Batteries
- Multimeter
- As for components desoldering, you could use different techniques. If you don’t have a heat gun, you may simply cut PCB traces with a scalpel or a needle
Choosing the Right Board
When it comes to power consumption, the boards differ dramatically. Even the boards with equivalent microcontrollers.
First, most development boards use linear voltage regulators. They are cheap and protect the board, however what they basically do is convert extra energy into heat.
Moreover some boards have a dedicated USB bridge chip. It is very handy for development, but it also constantly drains current. Some boards, like MH-Tiny and Digispark ATtiny85, implement USB connectivity with software, which makes them more battery-friendly. Arduino Pro Mini does not have an embedded USB bridge at all, making it a good choice for a battery powered project, especially the 3.3V board version.
Note that boards usually have several power inputs. Apart from USB, you could power an Arduino board via VIN, which is connected to a power regulator, or 5V (3.3V on 3.3V boards) pin, which powers the MCU directly and therefore could burn your MCU in case of overvoltage.
Choosing the Right Batteries
🔋 Power bank. A regular power bank has decent capacity and could give you 500mA at 5V. So you could use a 5V pin of your board directly and don’t need a voltage regulator. However some power banks turn off when the current is as low as 200mA. Moreover, power banks have 3.7V internal battery and a step-up 5V converter which draws extra current. It’s not an ideal solution for low-current devices.
🔋 9V batteries. Obviously you ought to use a voltage regulator, so you should connect the battery to the VIN pin of your board. Moreover, 9V batteries typically have a low capacity. So this option is doable but it is far from an effective use case.
⚠️ Do not connect a 9V battery to a 5V pin directly!
🔋 Lithium batteries. They usually deliver 3.7–4.2V. Technically you could connect one directly to a 5V pin of your board. However some external 5V units may not work. You’ll get a perfect power saving but probably unstable work when the battery is low. Lithium batteries could also be connected directly to a 3.3V board (like Arduino Pro Mini 3.3V). Note that you’ll need an external charge protection circuit to prevent deep discharging if your board does not have one.
🔋 AA or AAA batteries. They have decent capacity and are affordable. 3 batteries give you 4.5–3.0V which is doable, but may cause unstable work of a 5V board at low current. Four brand new batteries supply 6V, which is an absolute maximum for ATmega328, so technically this setup could be connected to the 5V directly, but use it cautiously.
🔋 Coin cell batteries deliver 3V and have low capacity. They are good for very small projects.
Hardware: Switching to 3.3V
If you start a new battery powered project, consider using a 3.3V board and components whenever it’s possible. It would significantly reduce the power consumption. Usually it leads to clock speed decreasing, so it depends on your specific project. Moreover some external modules may not support 3.3V.
Hardware: Voltage Regulators
Consider removing the voltage regulator. For example, if you use a power bank, it guarantees you reliable voltage. Alternatively you might want to replace the regulator with a more efficient one, for example a switching regulator.
Hardware: LEDs
There is a power indicator LED on most development boards. Removing it would save you some milliamps. If your project still needs LEDs, consider using less powerful ones. For example, you usually don’t need bright LEDs for indoors usage. This includes LEDs in external modules. For example, LCD backlights consume more power than LCD itself.
Hardware: USB Connectivity
If you are not going to update the firmware, you might not need a USB-UART. You could always use an external one. For example, the Arduino Pro Mini does not have an embedded USB bridge.
Hardware: Board Specific Tricks
There are other board specific tricks that are impossible to cover here. Just one example, one of my favorites. MH-Tiny bare bones board with ATtiny88 MCU. It is bloody cheap, has more GPIO pins than its ATtiny85 peers and could be hacked to achieve extremely low power consumption, namely less than 1mA current draw. Apart from the voltage regulator and power LED, you may desolder the clock oscillator and USB D- resistor. Of course you lose USB connectivity and have to use an internal oscillator. But you still have ISP interface to program it.
Software: Turning Off Unused Peripherals
With power management libraries you could easily turn off unneeded subsystems like ADC, SPI, USART etc. The following example will disable all subsystems at once.
#include <avr/power.h>
void setup ()
{
power_all_disable();
}
Please check out the documentation to learn how to control particular peripherals.
Some external modules and chips have Enable (EN) pin to turn them off when not needed.
Software: Sleep Modes
Forget about delay() function! It makes the processor consume power without doing something useful. Use sleep modes instead. This topic is platform specific, but if we consider the most popular ATMega328, it has several sleep modes. The “deepest” is SLEEP_MODE_PWR_DOWN. You could use a watchdog timer to wake it up. So your sketch might look like this:
#include <avr/wdt.h> //watchdog timer library
#include <avr/sleep.h> //sleep library
void setup() {
wdt_enable(WDTO_8S); //setup watchdog timer to 8 seconds
set_sleep_mode(SLEEP_MODE_PWR_DOWN); //set sleep mode
}
void loop(){
//do something
sleep_mode(); //go to sleep
}
Final Thoughts
Of course this guide is far from complete. I just wanted to show very general techniques to achieve decent power efficiency with a regular development board. Feel free to share your experience regarding power saving in Arduino projects. After all, constraints force us to be more creative, right?