The TP4056 module is the standard way to add rechargeable power to a project. Plug in a 5 V USB cable, connect a single 3.7 V lithium-ion cell (an 18650 or a LiPo pouch), and it charges the cell safely to 4.2 V at up to 1 A, then stops. The red LED shows charging, the blue or green LED shows full.
There are two versions and the difference matters. The basic board has only the TP4056 charger chip. The more common protected board adds a DW01A protection chip and an FS8205A dual MOSFET that disconnect the battery if it is over-discharged, over-charged or shorted. This page explains both, how the charge cycle works, how to change the charge current for small batteries, and how to power an Arduino or ESP32 from the cell.
TP4056 at a glance
Specifications
- Charger chip
- TP4056 linear Li-ion charger (NanJing Top Power)
- Input voltage
- 4.5–5.5 V (USB 5 V); absolute maximum 8 V
- Charge voltage
- 4.2 V ±1.5 %
- Charge current
- 1 A with the stock R3 = 1.2 kΩ; adjustable to about 130 mA
- Charge method
- Trickle below 2.9 V, then constant current, then constant voltage
- Charge termination
- When current falls to 1/10 of the set value (about 100 mA)
- Over-discharge cut-off
- about 2.4–2.5 V (DW01A, protected boards only)
- Over-charge cut-off
- about 4.3 V (DW01A)
- Over-current trip
- about 3 A load (DW01A + FS8205A)
- Input connector
- Micro-USB or USB-C, plus IN+/IN− pads
- Board size
- about 26 × 17 mm
Charger figures from the TP4056 datasheet; protection thresholds from the DW01A datasheet. Exact values vary slightly between module makers.
Pads and LEDs: what connects where
The protected board has six solder pads. Two take power in, two go to the battery, and two feed your project:
TP4056 module pinout
| Pad | Connect to | Notes |
|---|---|---|
| IN+ | 5 V input | Same as the USB connector; use one or the other |
| IN− | Input ground | Shared with B− and OUT− |
| B+ | Battery + | Directly to the cell's positive terminal |
| B− | Battery − | Through the protection MOSFETs on the protected board |
| OUT+ | Load + | Same node as B+; feed your boost converter or regulator |
| OUT− | Load − | Protected negative: switched off when the cell is empty or shorted |
What the LEDs mean
| Red (CHRG) | Blue/green (STDBY) | Meaning |
|---|---|---|
| On | Off | Charging |
| Off | On | Charge complete |
| Off | Off | No input power, or the chip is in thermal shutdown |
| Flashing | On or flashing | No battery connected (the output oscillates around 4.2 V) |
Warning
Load on OUT, never on B. On a protected board, connect your project to OUT+ and OUT−. Wiring the load to B+ and B− bypasses the over-discharge cut-off: the project keeps draining the cell below 2.5 V, which permanently damages lithium cells.
How the TP4056 charges a cell
Lithium cells need a specific charge profile, and the TP4056 handles all of it:
- Trickle. A deeply discharged cell (below about 2.9 V) gets only 1/10 of the set current until it recovers.
- Constant current. The full set current, 1 A on a stock board, flows until the cell reaches 4.2 V. This is where most of the charge goes in.
- Constant voltage. The chip holds 4.2 V while the current gradually falls.
- Termination. When the current drops to 1/10 of the set value, charging stops and the LED changes colour. If the cell later sags to about 4.05 V, it starts again.
A 2000 mAh cell at 1 A takes roughly 2.5 hours to charge fully: the constant-current phase does the bulk in about 1.5 hours, and the constant-voltage tail adds the last 20 %.
The TP4056 is a linear charger, so it turns the difference between 5 V in and the battery voltage into heat. At 1 A into a 3.6 V cell that is about 1.4 W, and the board gets hot. The chip protects itself by reducing the current above about 120 °C, so a hot board charging slowly is normal, not a fault.
Changing the charge current
The stock 1 A suits 18650 cells of 1000 mAh and up. Small LiPo pouches should charge at no more than about 1C (their capacity in mA), so a 400 mAh cell wants 400 mA or less. The current is set by resistor R3 (the PROG resistor, usually marked 122 = 1.2 kΩ) next to the chip: replace it to change the current.
Charge current by R3 (PROG) value
| R3 | Charge current | Good for |
|---|---|---|
| 10 kΩ | 130 mA | Tiny LiPo, 100–150 mAh |
| 5 kΩ | 250 mA | 250–300 mAh LiPo |
| 4 kΩ | 300 mA | 300–500 mAh LiPo |
| 3 kΩ | 400 mA | 400–600 mAh LiPo |
| 2 kΩ | 580 mA | 600–1000 mAh |
| 1.66 kΩ | 690 mA | 1000 mAh+ |
| 1.5 kΩ | 780 mA | 1000 mAh+ |
| 1.33 kΩ | 900 mA | 18650 cells |
| 1.2 kΩ (stock) | 1000 mA | 18650 cells, 2000 mAh+ |
Values from the TP4056 datasheet's R_PROG table. The relationship is roughly I (mA) = 1200 / R (kΩ).
Powering a project from the cell
A lithium cell gives 4.2 V when full and about 3.3 V when nearly empty, so it rarely suits a project directly:
- 5 V projects (Arduino Uno, Nano, relay modules, servos): add an MT3608 boost converter set to 5.0 V between OUT+/OUT− and the board's 5V pin.
- 3.3 V projects (ESP32, ESP8266): use a low-dropout regulator such as an HT7333 or ME6211 into the 3V3 pin, or boost to 5 V into VIN. A common AMS1117 needs about 4.4 V, so it drops out long before the cell is empty.
- Charging while running works, since the load sits in parallel with the cell. But if the load draws more than about 100 mA, the charger never sees the current fall and may not terminate. For always-on projects, a dedicated power-path module is better.
Troubleshooting
Both LEDs off
- Likely cause
- No 5 V input, or a weak USB cable
- Fix
- Measure 5 V on IN+/IN−; try a short, thick cable
Red LED flashing
- Likely cause
- No battery, or a cell below the protection cut-off
- Fix
- Check B+/B−; a protected cell may need a brief charge to wake
Board very hot, charging slowly
- Likely cause
- Thermal regulation at 1 A
- Fix
- Normal. Lower the current with R3, or add airflow
Output dead, battery reads 3.7 V
- Likely cause
- Protection tripped by a short or overload
- Fix
- Remove the load and plug in USB to reset the DW01A
Charges forever, never shows full
- Likely cause
- Load on OUT draws over 100 mA during charging
- Fix
- Turn the project off while charging
Battery swells or gets hot
- Likely cause
- Damaged cell or charge current far above 1C
- Fix
- Disconnect immediately and replace the cell
Frequently asked questions
Can the TP4056 charge two cells in series? No. It charges exactly one cell to 4.2 V. Two cells in parallel (same voltage) work as one bigger cell; two in series need a 2S charger with balancing.
Can I charge LiFePO4 cells? No. LiFePO4 needs 3.6 V, and 4.2 V overcharges it. Use a LiFePO4-specific charger.
Can I use a solar panel? Only through a 5 V regulator. The TP4056 has no maximum-power-point tracking. For direct solar charging, the CN3065 is designed for it.
How do I know the battery level? Measure the cell voltage with an ADC through a divider (see the board guides below), or use a fuel-gauge chip such as the MAX17043 for a proper percentage.
Tip
Board guides: TP4056 with Arduino Uno runs an Uno from an 18650 through an MT3608 boost and shows the battery level. TP4056 with ESP32 covers the right regulator for 3.3 V and battery monitoring on the ADC.
Wiring & code
Board integration
Library
None needed by Arduino core
No library required: the battery meter uses analogRead(), which is built into Arduino.
This guide runs an Arduino Uno from a rechargeable 18650 cell. The TP4056 charges the cell from USB, an MT3608 boost converter lifts the cell's 3.3–4.2 V to a steady 5 V, and the Uno reads its own battery level on A0. The same wiring works for a Nano or Pro Mini (5 V). Read the TP4056 overview for what each pad does.
Parts
Arduino Uno (or Nano)
- Qty
- 1
- Notes
- 5 V board
TP4056 module, protected version
- Qty
- 1
- Notes
- Six pads: IN, B and OUT
MT3608 boost converter
- Qty
- 1
- Notes
- Set to 5.0 V before connecting the Uno
18650 cell with holder
- Qty
- 1
- Notes
- Use a genuine cell, 2000 mAh or more
10 kΩ resistor
- Qty
- 1
- Notes
- Series resistor for the A0 battery input
Multimeter
- Qty
- 1
- Notes
- To set the boost output
Warning
Set the MT3608 first. New boost modules often ship set to 9–12 V, which destroys an Uno on its 5V pin. Connect the battery, measure the MT3608 output, and turn its trimmer until it reads 5.0 V before the Uno is connected. Full steps are in the MT3608 guide.
Wiring
Wiring: TP4056, MT3608 and Arduino Uno
| From | To | Note |
|---|---|---|
| 18650 + | TP4056 B+ | Battery positive |
| 18650 − | TP4056 B− | Battery negative |
| TP4056 OUT+ | MT3608 VIN+ | Protected battery output |
| TP4056 OUT− | MT3608 VIN− | Protected ground |
| MT3608 VOUT+ | Uno 5V | Exactly 5.0 V, set beforehand |
| MT3608 VOUT− | Uno GND | Common ground |
| TP4056 OUT+ | 10 kΩ → Uno A0 | Battery voltage for the meter |
Tip
Unplug the battery supply before connecting the Uno's own USB for uploading. Feeding the 5V pin while the USB cable is also connected puts two 5 V sources in parallel. Charging through the TP4056's USB port is fine at any time.
Battery meter sketch
The cell's voltage (at most 4.2 V) is below the Uno's 5 V reference, so A0 can read it without a divider; the 10 kΩ resistor only limits current if something goes wrong. The sketch averages 20 readings, converts them to volts and estimates the charge from a typical 18650 discharge curve.
// Battery meter: 18650 via TP4056 OUT+ -> 10k -> A0, Uno powered at 5.0 V
const int BATTERY_PIN = A0;
const float VREF = 5.00; // measure the Uno's 5V pin and put the real value here
// Typical 18650 resting voltage vs remaining charge
const float VOLTS[] = {4.20, 4.05, 3.95, 3.85, 3.78, 3.72, 3.65, 3.50, 3.30};
const int PERCENT[] = { 100, 85, 70, 55, 40, 30, 20, 5, 0};
float readBattery() {
long sum = 0;
for (int i = 0; i < 20; i++) { sum += analogRead(BATTERY_PIN); delay(2); }
return (sum / 20.0) * VREF / 1023.0;
}
int toPercent(float v) {
if (v >= VOLTS[0]) return 100;
for (int i = 1; i < 9; i++) {
if (v >= VOLTS[i]) {
// straight line between the two nearest points
float f = (v - VOLTS[i]) / (VOLTS[i - 1] - VOLTS[i]);
return PERCENT[i] + f * (PERCENT[i - 1] - PERCENT[i]);
}
}
return 0;
}
void setup() {
Serial.begin(9600);
}
void loop() {
float v = readBattery();
Serial.print("Battery: ");
Serial.print(v, 2);
Serial.print(" V ~");
Serial.print(toPercent(v));
Serial.println(" %");
if (v < 3.4) Serial.println("Low battery - plug in USB to charge");
delay(5000);
}The percentage is an estimate: a cell's voltage drops under load and rises while charging, so read it with the project idle for the most stable value. For accuracy, measure the Uno's 5V pin with a multimeter and enter that value as VREF.
How long will it run?
An Uno draws about 45–50 mA on its own, and the boost converter loses about 15 %. From a 2000 mAh cell that gives roughly 30–35 hours. Add a display, LEDs or a servo and it drops quickly. For projects that must last weeks, use a Pro Mini or ESP32 with deep sleep, which can sleep at microamps.
Troubleshooting
Uno doesn't start
- Likely cause
- MT3608 output not 5 V, or the boost isn't on OUT
- Fix
- Measure VOUT; check OUT+/OUT− go to VIN+/VIN−
Uno resets under load
- Likely cause
- Weak cell or long, thin wires
- Fix
- Use a good 18650 and short wires; add 100 µF at the Uno's 5V pin
Battery reading too high or too low
- Likely cause
- VREF not the real 5 V value
- Fix
- Measure the 5V pin and set VREF
Reads about 0 V
- Likely cause
- A0 wired to OUT− or B−
- Fix
- Connect the 10 kΩ to OUT+