How to add a LiPo battery in our Arduino projects

In the next Bike Pixels version I want to integrate a rechargeable battery so you don’t have to rely on an external power source. In principle, this might seem trivial, but it’s not. Lithium-polymer batteries (or LiPo) are very dangerous if they are incorrectly charged, overcharged, overheated or stored incorrectly they can explode. Luckily to make things easier for us and allow us to use a LiPo battery in our Arduino projects we have several modules that can do some of the work for us. One of these modules is the TP4056.

TP4056 module specs

The main element of the module is the TP4056 chip itself. This chip is a programmable linear current and constant voltage charger for single cell LiPo batteries. The module also integrates two LED indicators of the state of charge and two additional chips in charge of the protection of the battery. Although there are versions of the module that do not have these chips, in this case we will use a version that does have these elements like the one described in the image.

TP4056 module main components description.

The module performs the charging process. First it ensures a constant current until the LiPo battery reaches 4.2V. Then, it gradually reduces the charging intensity until the battery is fully charged and ends the charging cycle when the charging current drops to one tenth of the programmed value. It supports input voltages up to 8V so it can be used directly connected to a USB port or a mobile charger up to 1.2A.

R3

[kΩ] Charging

intensity [mA] 10 130 5 250 4 300 3 400 2 580 1.66 690 1.5 780 1.33 900 1.2 1000

By default it is programmed to charge batteries with an intensity of up to 1Ah although it is possible to reduce this value by replacing resistance R3 with one of a higher value. If you use batteries with a capacity close to 2000 mAh or higher you can leave the resistance used by default, otherwise it is necessary to modify it.

Typically LiPo batteries have a maximum charge and discharge current value of 0.5C, i.e. we can apply a charge current less than half its capacity. Using higher currents can reduce battery life or even destroy it. Therefore, depending on the maximum intensity of intensity that we can use in our battery it will be necessary to modify the resistance R3 by one with the value that adjusts to the intensity given in the adjacent table.

In addition, the TP4056 also guarantees the safety of the battery. The DW01A chip is designed to protect from damage and degradation of LiPo batteries due to overcharges, over-discharges or current peaks. On the other hand the FS8205A is a chip with a double MOSFET. It is responsible for cutting the power supply to the battery when the charge is complete and prevent its discharge if its voltage drops below 2.7V. A lower value can shorten its life and even render it unusable.

Required parts

Apart from the TP4056 module, we obviously need a LiPo battery and an Arduino board or a clone. In addition, as Arduino boards normally work with a voltage of 5V, it is necessary to add a voltage regulating module to increase the voltage of the LiPo battery. For the example I have used a Pololu U3V12F5 which is more expensive but very small and also very efficient offering up to 1A output. Anyway any step-up module that converts the LiPo battery voltage to 5V and provides a current around 500mA will do. Furthermore, unless we want our Arduino to be on until the battery is completely discharged we will have to add a switch to be able to turn it off and on when we need it. Next I leave you a list with different links to stores where you can buy all these elements:

Componente Amazon.com AliExpress TP4056 module (10pcs) $9.99 (10pcs) $2.00 Step-up 5V (5pcs) $7.29 (5pcs) $1.80 LiPo battery ~2000 mAh $9.89 $3.69 Arduino Nano (original) $13.00 (clone) $2.45 On/Off button (50pcs) $5.99 (20pcs) $0.64 Cable AWG 26 (0.13 mm) (7×32.8ft (10m)) $16.99 (6×32.8ft (10m)) $13.38

As you can see for just a few bucks, not including the price of the battery we can have Arduino running on a LiPo. But, I repeat, you have to be very careful with it when connecting all the elements.

Wiring diagram

Luckily the connection is quite simple. We just have to connect the battery and the step-up module together with the switch to the TP4056 module. Then you will only need to connect the output of the step-up module to the Arduino board. This requires the step-up module to be connected to the ground and 5V pins. Note that normally it is not recommended to use this port but as in this case as the voltage is regulated by the step-up module we can use this port without danger. All the connections look much clearer in the diagram below:

Connection diagram with the TP4056 module to the LiPo battery, a step-up module and an Arduino Nano board.

In addition, if we upload to the board the code that makes blink the integrated LED, after connecting all the elements we can test directly if everything is in order. In my case, after soldering all the elements I have something like this:

Arduino Nano running on a LiPo battery ready to charge with a TP4056 module.

As you can see including a LiPo battery our Arduino projects is quite simple and cheap. The only limitation is in the maximum intensity supplied by the step-up module. In projects that require higher intensities this solution may not be adequate.

More info

If you want to know more about each of the chips that make up the TP4056 module below I leave a series of links with the cards of each of them:

Of course if you have any doubt, found any fault or want to purpose a possible improvement do not hesitate to leave your comment at the bottom of this post. Also, if you want to stay in touch or receive any news from us don’t forget to signup to the newsletter.

When I say explode, it’s that they explode and can cause fires. It is necessary to avoid any short circuit, overheating, incorrect application of voltages and intensities during recharging and store them in a dry and warm place.