Software apps and online services
Help me grow and make new projects today by supporting me by becoming patron on patreon(https://www.patreon.com/techmirtz).
When it comes to portable electronics, one of the most important features is how to maximize the battery life. The ATmega328P, used on popular boards like the SparkFun RedBoard, Arduino Uno, and Pro Mini are actually quite power hungry. The RedBoard and Arduino Uno, draw around 15mA minimum, which doesn’t sound like much but as you’ll see in this project, we can drastically bring that down with just a few tricks. In this guide we’ll see if we can reduce the supply current to less than 10uA with a couple hardware and software tricks.
Making it seems to be difficult having a lot of components. No, actually most of the components of a Arduino board are for preventing short circuiting, damage control, etc. But, if you have basic knowledge and experience of working with Arduino then, you can avoid those parts and can check the circuit for any mishap.
So, let's see what can we remove to lower the power consumption on our homemade Arduino.
Remove the programmer IC
Every integrated circuit (IC) needs power to function. By reducing the number of ICs needed, you can save a bit of power. The Arduino Uno has a USB bridge that converts the USB signals to signals that the Arduino’s Universal Asynchronous Receiver Transmitter (UART) can use. This alone draws around 10mA. I will tell you other alternatives for programming the micro-controller later on.
No power LED!
We can also remove the power LED. It is just to show that Arduino is on or off. So, it will not reduce the functionality of the Arduino.
Ditching the Linear Voltage Regulator
Linear regulators are great. They’re cheap and can regulate a higher voltage to a lower voltage with as few as 3 pins (Vin, ground Vout). The downside of a linear regulator however is they can get pretty hot when you have a large difference between the input and output voltage, or if you’re drawing a lot of current. You can calculate the power that gets wasted in the form of heat with a simple equation:
Pwasted = (Vin - Vout) * I
For 5V output, 7V in given as input to to regulator. Means that Vin - Vout is 2V and the usual current drawn is 1A. Pwasted is 2 watt.
Linear regulators are, at best, only around 70% efficient. The more current you draw, the lower the efficiency.
For, supplying the 5V and 1A supply, we can use battery mentioned in the list above or we can also use 3x AA batteries. This makes 4.5V and ATmega328 can work on 1.8 V to 5.5 V.
Reducing the clock speed
In projects where the Arduino doesn’t need to execute a large number of instructions in a short amount of time or in projects where timing isn’t an issue, reducing the clock speed of the micro-controller can shave a few milliamps off the supply current. For example, running the Arduino at 5V and reducing the clock speed from 16 MHz down to just 8 MHz can drop the current needed from 12 mA down to about 8.5 mA.
To better understand the relationship clock speed has with the microcontroller, let’s look at the graph below.
As you can see, reducing the clock speed can triple the battery life. The trade off of course is that you won’t be able to execute as many instructions per second, and for some applications, this solution isn’t an option.
To know, how it can be done, click here.
So far we’ve talked about how to reduce the power of the Arduino, but we haven’t talked about why it uses the power it does. Inside the ATmega328P, lies a series of circuits that work together to offload work from the processor, and each of these draws some amount of power.
analogWrite() function, for example, doesn’t have the processor create a PWM signal by counting the clock cycles itself. Instead, the Arduino uses one of the built in timers to count clock cycles and send an interrupt request to the processor. From there, the processor stops what it’s doing and handles the interrupt by switching the pin’s state. By offloading some of the work, the micro-controller is able to do multiple things at the same time.
Some of the other circuitry built into the ATmega328P include:
- 3 timers
- Watchdog timer
- Brown-out detect
- Analog to digital conversion
Each of these independent components need power to work, and, unless you manually disable them, they will continue to draw power. The brown-out detection actively monitors the system voltage to ensure it doesn’t drop below its threshold. If it does, the controller powers down until the voltage is increased above that threshold. The analog to digital converter (ADC) does just as the name suggests, it take the analog voltage (which can be any value from 0V up to VCC) and converts it to a digital value that the micro-controller can use (0-1023 for 10-bit converters). If your project doesn’t need to use the ADC, disabling it will cut down on the power draw drastically.
But what if you still need the ADC? Thankfully there are registers where you can disable some of these circuits with software. Using software allows you to enable the circuits you need, when you need them, and, when you’re done, you can disable them again. All of the registers are well documented in the datasheet for the ATmega328P, but, if directly writing to registers makes you uncomfortable, there is a library available that you can download from the link.
This library allows you to set how long to enter into sleep mode, from a few milliseconds, up to indefinitely. It also allows you to specify which parts of the micro to disable, making it a pretty powerful and versatile library for your low-power needs.
Get all the stuff listed above in the list. Moreover, get a pin-mapping of the ATmega328P handy while making the circuit.
- Put the ATmega328P micro-controller (better if you get one already boot-loaded with Arduino UNO boot-loader) in the middle of the breadboard.
- Now, put the 16 MHz crystal between pin 9 (PB6) and pin 10 (PB7).
- Also, plug in the two 22pF capacitors from pin 9 to ground (GND) and from pin 10 to ground (GND). [If you don't get 22 pF capacitors, then, use four 100 pF capacitors in series to make 25 pF capacitors and make two such combinations]
- Attach both the GND and VCC to the power rails on the breadboard.
And, IT'S READY!
Just plug-out the micro-controller from the breadboard and replace it with the micro controller in the original Arduino board. Upload the sketch and take out the micro-controller back and plug it in the breadboard as it was initially. If you don't want to remember the position, use a 28 pin IC socket to plug the micro-controller while setting up the circuit.
After plugging the microcontroller back, connect the power lines of the breadboard to the battery terminals. If the other components are plugged in the pins according to the sketch and pin mapping, the sketch will run within seconds.
Using the FTDI 232RL breakout board!
Curious what all the pin outs are for the FT232RL breakout board, just simply flip it over! In this situation I'll be using VCC (to supply 5V from the USB port to your board), GND, TXD, and RXD. [Refer schematics]
- This board comes without the headers when bought from market. So, solder the male header and plug it in the breadboard.
- Connect RX of ATmega chip to TX of board and TX of Atmega chip to RX of the board.
- Connect VCC and GND to the power rails on the breadboard.
- Plug the USB mini type - B and connect it with your computer and upload the sketch. It will take power from the USB but after disconnecting the USB, you can plug the battery terminals to the power rails of breadboard.
And, the Arduino is ready. Now if you check the current drawn my ATmega while on standby, it's around 0.07 mA which is less than the original Arduino.
Upload the code given in the attachment as a blink program and the observe that the Arduino will go to sleep mode for 8 seconds by switching off all the peripherals. [Remember to install the Low Power library from GitHub, link below]
You can go to this link for further information: https://github.com/LowPowerLab/LowPower/tree/master/Examples