Some people have made Li-ion 3.7 V chargers with MCP73831 and LM358n.

The first link mentions that charging such a battery is sensitive to voltage and current:

Li-ion batteries need to be charged following a carefully controlled constant current/constant voltage (CV-CC) pattern that is unique to this cell chemistry. Overcharging and careless handling of a Li-ion cell can cause permanent damage, or instability and potential danger!

Is it possible to charge such a battery with a programmable circuit (Arduino, Adafruit Circuit Playground, Raspberry Pi, etc.) with a voltage divider on the 5 V output, and the current charge controlled by software?

If so, I would like to try it: can you add pointers for circuits, code repositories, or tutorials?

  • 2
    \$\begingroup\$ Unfortunately not a valid question for this site as it is likely to attract opinions and is basically a shopping question. \$\endgroup\$
    – Andy aka
    Dec 15, 2020 at 14:02
  • 5
    \$\begingroup\$ Is it possible? Yes. The rest of your question is too broad for this site. \$\endgroup\$ Dec 15, 2020 at 14:11
  • 1
    \$\begingroup\$ Yes, a circuit could be made that includes an Arduino or such but it will be very hard to make it better and more cost effective than a simple TP4056 based circuit that is designed to charge a Li-Ion cell. A voltage divider isn't suitable to charge a battery, a more complex circuit is needed. \$\endgroup\$ Dec 15, 2020 at 14:12
  • 4
    \$\begingroup\$ I suggest that you let go of insisting to make a Li-Ion charger using an Arduino or such. There are many projects that are better suited to using an Arduino. Only if you have the need for a specialist battery charger and are able to design the extra circuits that are needed for that yourself, then in some cases an Arduino (or similar) can be useful. If you just want to charge a battery, get a TP4056 module and use that. \$\endgroup\$ Dec 15, 2020 at 14:13
  • \$\begingroup\$ @Bimpelrekkie Can you write an answer and I'll accept it? \$\endgroup\$
    – emonigma
    Dec 15, 2020 at 16:46

3 Answers 3


It is possible to create a Li-ion charger using an Arduino, but you would still need a way to create a current source and a voltage source, and you would need measurements of battery voltage and current.

That's quite a bit of external hardware required; the Arduino would be used for measuring and control ie. implementing the proper charging protocol for Li-ion.

It will be hard to do well, and very hard to do it as well as an MCP73831 or similar IC can, and it would also be more expensive.

Also, if you don't get it right, it will be dangerous; Li-ion batteries should be handled with care and not be pushed beyond specs in any way.

So, I would say, just don't, and go for something else.

If you insist on trying, please test what you made outside in an open space without flammable materials nearby, and keep your distance.


Of course it can. But not directly. It still needs the actual analog and power electronics designed around it to do the actual charging. Fortunately Atmel has an hardware application note AVR450 that walks through how to design it.

So basically, no, a plain Arduino is not a charger and thus cannot charge batteries.


Dont use the Arduino to charge the battery , you need a way to monitor the voltage levels when charging and restrict the amount of current based on state of charge.

It would be probably safer to use a 3.3v power supply and pulse that on and off with the Arduino , than say, use the PWM output with a voltage divider to lower the voltage across the battery and charge that way.

Either suggestion from above is not ideal and not recommended


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.