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 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 Components
TP4056 module main components description. Note that there is also a USB C version available.

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.

intensity [mA]

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:

TP4056 module(5pcs) $7.99$0.52
Step-up 5V(5pcs) $7.29(5pcs) $1.80
LiPo battery ~2000 mAh$12.50$7.18
Arduino Nano(original) $13.00(clone) $2.45
On/Off button(100pcs) $7.99(20pcs) $0.64
Cable AWG 26 (0.13 mm)(6×32.8ft (10m)) $15.99(6×32.8ft (10m)) $13.38
Bill of materials

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.

The best 3D printer of 2021

Wiring diagram

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:

Sketch made in Fritzing with the connections of the different components needed to use a LiPo battery in our projects with Arduino.
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.

Other similar modules

On the market there is a lot of other modules that are similar to the presented. Usually all the cheapest solutions are based on some TP chip (TP4056, TP5000, TP5100) and include some less (eg. without battery protection) or extra features (eg. integrated pull up module). Among this I also have been working with this module based also on the TP4056 with an integrated pull-up circuit and it worked fine.

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:

Additionally if you want to continue with more advanced project, recently I’ve added a new post that adds a solar panel to this project in order to charge the battery using solar energy.

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.
They are affiliate links so every time you buy through them you will be helping a little bit to finance the project. Besides, it won’t cost you anything at all, since the price of each component won’t change for you and we take a small commission for each sale. Thank you in advance! (The price of each product is indicative and corresponds to the price given at the sellers page on September 2021.)


  • Thank you for this very interesting article! With this system, is it always possible to connect the arduino usb plug to the pc (to access ide arduino) or else we can no longer touch the project code once the battery is in place? So that makes a usb socket for arduino and a usb socket to charge the battery?

    • Thank you for reading! You can safely plug the board into the PC to re-program the Arduino. The board is protected against power flowing from the battery to the USB port.

  • Somewhat of a similar question – is there a way to wire/use the same USB port for charging and reprogramming to the arduino? Thanks for your thorough article – well done!

    • Hi, thanks for reading. Yes, in theory, you can plug the input of the TP4056 to the Arduino 5V port using a diode in between and change plug the step-up output to the Vin port. But I’ve never tried so maybe I’m telling some nonsense. Let me know if it works :).

  • Thanks for your reply! Will try it out!

  • Thank you for this nice and clear description. All is clear for me except the on off button. I see it is a 3 pin on off button are all grounds from arduino, pololu, tp4056 connected to an individual pin?

    • Hi, yes you can use switches also on the ground/negative pole. The point it is just to stop the flow of current. In fact electrons are moving from negative to positive so it is just a convention to put it on the positive side instead of the negative. You can put it also there if you want.

Leave a Reply

Your email address will not be published.