Introduction: Dual Power for Your Portable Micro-Controller Project
Often you want to be able to optionally power your project device by either battery or AC adapter, and you would also like to be able to quickly download new firmware. Given the right battery charging board you can fulfill the first two desires. This instructable addresses combining of all three of these capabilities.
Step 1: Concept
The key here to dual powering operation, with communications, is the use of a MCU like an Arduino Nano 3.0, a micro Li-ion charging board (TP4056) a Li-ion battery and a low voltage drop 1N5818 diode. Nano Arduinos allow for USB powering as well as software updates and serial I/O; and are small enough for portable devices while having plenty of resources (memory, I/O etc).
By adapting these or similar components into your micro-controller project's design you'll enjoy flexible operation. Check out the attached video.
Step 2: Componets to Acheive the Goal
aka: Parts list:
Nano 3.0 a compact, low voltage MCU (eg: Atmega328P) with integrated USB powering and communication (for updates), http://www.ebay.com/itm/112027339132 or similar.
A Charge circuit e.g. http://www.ebay.com/itm/172434586776
1N5818 Diode e.g. http://www.ebay.com/itm/272109377237
4.7-5.6 ohm 1/4w resister
Electrolytic capacitor 100-1000uf e.g. http://www.ebay.com/itm/171309958798
Misc: wiring and I/O subsystems as desired.
Step 3: The Block Diagram Circuit Design
The schematic here, provides for DC and AC adapter operation, as well as charging of its battery while a USB adapters is attached.
One trade-off of this configuration, having the external USB connector go directly to the MCU, means that your device can't switch itself off while its connected to an external power supply. I find this completely acceptable, at least considering my intended use profile.
While powered via the USB connector, on the Nano 3.0 MCU, the TP4056 charging PCB charges the Li-on battery. If the DC power switch is ON the 1N5818 diode will be reverse biased, not conducting but blocking current flowing through the switch. Therefore having no operational effect, at this time. The resister (~5 Ohms) on the + input to the charging circuit limits the current being pulled through the MCU board to a maximum of about 100ma. Without it I measured over 0.4A charging a low battery. Not needing a quick charge, I added the resister. I then verified that charging is still fully done to 4.2v without over charging.
During portable operation, USB disconnected, the battery will power your device. This is done through the switch and the 1N5818 which is a very low voltage drop diode (approx. 0.25V). The device will receive 3.0 to 3.9 V (depending on the level of charge of the battery) to the '5V' pin of the Arduino broad. Note that the ATmega-328P operates fine on 3volts. You should test the full set of electronics (certainly LED brightness) in your project with a battery supply voltage down to 3.2, or even 3.0 if you like, to ensure satisfactory operation.
A large capacitor should be on the '5v' line so that poor USB AC adapters don't cause things like LED flickering. The size needed depends on the expected quality of power supplied and the amount and nature of output through the I/O pins.
Step 4: Power Up Your Project
Integrate the above power scheme to your project, to enjoy portable operation as well as easy updates along with automatic charging. As I did for my earlier inline LED game project.
Please share your results with us all.
Refer to the block diagram/schematic and my photos for an example implementation.