Is it possible to build a battery charger with just an arduino UNO board (and perharps some passive components)?. It's a 3.7V 550 mAh LiPo Battery. I understand I need to monitor the charge and the current flowing into the battery to properly (as in safely) charge it.

2 Answers 2


I'll assume that you are trying to charge from a 5V "USB" source.

If you only want to use a UNO + passive components then the hardware intensive method of application note AVR146: Lithium-Ion Battery Charging via USB with ATmega16/32U4 which Ignacio suggests does not meet your need. This is a capable charger but the UNO would not be the major part of it.

"Normal" charger

The use of any of the available LiIon charger ICs is an easy and low cost way of adding a charger. These ICs and all related components can cost as little as a few dollars. But ...

UNO + one resistor very low current charger:

If using a UNO with no external active parts the current drive rating of the UNO pins limits the maximum current able to be provided. If you really want to meet your specification you can achieve a few ten's of mA charge using with a UNO and a few resistors (possibly just one.)

Super simple good capability charger

But, a good compromise can be achieved using a UNO (or similar) + one transistor plus a few resistors and capacitors. This can achieve all the usual basic capabilities

  • Low current "trickle up" for very low voltage cells

  • Constant current charge until Vmax is reached

  • Constant voltage charge until I_cutoff is reached.

  • Terminate and stay active until recharge needed.

I will only outline the basic system here. More can be said as and if required.
The main point of note s that in its simplest form the charger uses a linear charging mode so a modest amount of heat needs to be dissipated in the control transistor. Max power dissipation for a A max charge rate would be 2 Watts when the battery was at 3V and full charge was wanted from 5V in.
Power dissipation = (Vin - Vbattery) x Icharge
Worst case here = (5V - 3V) x 1A = 2 watts.
A buck converter could be used (UNO controlled) if desired.

A transistor Q1 connects Vin to battery

Q1 can be PWM controlled by the Uno.

Battery current is monitored by a small resistor Rcur from B- to ground (or in B+ lead)

Vbattery is monitored with an ADC channel (ADC1 or ADC_V)

Current is measured by measuring voltage across Rcur with an ADC (ADC2 or ADC_I).

If Rcur is from B- to ground then V Rcur = V ADC2. If Rcur is in B+ lead V across Icur = V_ADC2 - V_ADC1.

Q1 on state can be varied by PWM from Uno to control battery current. PWM voltage is smoothed by an RC low pass filter to allow smooth DC control.


The following steps constitute the standard LiIon charging algorithm implemented by most charger ICs. Variations can be made.

  • If Vbat < 3V set Ichg to Itrickle by PWMing Q1 and reading battery current.

    While 3V <= Vbat <= 4.2V chg at Imax for battery.

    When Vbattery = V-max = 4.2V adjust Ichg with PWM to hold Vbat at 4.2V until Ichg falls to desired fraction of Imax.

    Turn off chg voltage fully and monitor Vbat to restart charge at Vbat = Vrestart - maybe 4.0V or as desired.


Yes, it is. AVR146 describes how to charge a battery using a ATmega16U4/32U4 (Leonardo), but there is nothing specific to that chip regarding the actual charging, and the serial communication can easily enough be ported to the ATmega328P.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.