Source: https://mokxi.com/parts/tp4056
Updated: 2026-11-10

Part

# Li-ion charger, TP4056

Charges one lithium-ion cell at up to 1 A to 4.2 V. What goes into the cell comes in at the input.

See every part

- 4 pins
- In 2 projects

Drawn live by the editor's own code, at the size you see it.

At a glance

## The Li-ion charger, TP4056 in brief

What it is, and where it sits on the bench.

The TP4056 module is the small board with a USB socket that charges one lithium-ion cell, usually an 18650. It is a linear charger: it holds the cell at 4.2 volts and never passes more than its programmed current, which the module’s 1.2 k program resistor sets at 1 amp. Its pads are IN+ and IN- for 4.5 to 8 volts in and BAT+ and BAT- for the cell. Mokxi charges at constant current until the cell reaches 4.2 volts, then tapers, through a 600 milliohm pass transistor, so a solar panel that can only give 170 milliamps charges at 170, its voltage pulled down to just above the cell’s. Nothing happens below 3.8 volts on IN, and the cell does not drain back when the input is gone. The red lamp is lit while charging and the blue once the cell is at 4.2 volts and the current is under a tenth of the programmed one. This is the version without the protection chip and OUT pads. Trickle charge, thermal regulation, and the cell’s charge actually rising are not modeled.

Family

Power and wiring

Pins

4

Pins

## 4 pins

Named as the editor names them, so a wire lands where you expect it.

Pin

What it does

IN+

The input, 4.5 V to 8 V (the USB socket is the same input).

IN-

Input ground, joined to BAT- on the board.

BAT+

The cell's +.

BAT-

The cell's -.

How to use it

## How to use the TP4056 charger with an Arduino

Wire the source to IN+ and IN-, the cell to BAT+ and BAT-, and take the board’s supply from the cell’s rail through a regulator. The project here charges an 18650 from a 6 V solar panel, and an MCP1700-3.3 low dropout regulator makes 3.3 V for a Pro Mini and an AHT20 sensor, because an AMS1117 would need a volt more than the cell has.

Drag the panel’s slider from full sun to dark: the charge current on the TP4056 follows the panel, and in the dark the cell carries the node alone. Two dividers let the Pro Mini read the cell on A0 and the panel on A1.

Part pin

Board pin

IN+

Solar panel +

IN-

Solar panel -

BAT+

18650 V+, the cell rail

BAT-

18650 V-, ground

Click to open it in the editor

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

How it is modeled

## What is true about the Li-ion charger, TP4056, here

In its help article’s own words: what the simulation gets right, and where it stops.

### Modeled

Constant current, then constant voltage. Up to 1000 mA (the module's 1.2 k
program resistor) until the cell reaches 4.2 V, then less and less. A half-empty
18650 on a stiff supply takes the full amp.

Weak sources. The pass transistor is 600 milliohm, so from a solar panel the cell
charges at what the panel gives, with the panel's voltage pulled down to a little
above the cell's.

Lockout and no drain. Nothing below 3.8 V on IN, and with IN gone the cell
does not discharge back through the module.

The lamps. The done lamp lights once the cell is at 4.2 V and the current has
fallen below a tenth of the programmed one, which is where the chip ends a charge.

The figures are from the TP4056 datasheets (4.2 V float, 3.8 V lockout, 600 milliohm
pass transistor, the current set by 1200 V over the program resistor).

### Not modeled

The trickle charge below 2.9 V, the chip ending the charge and restarting it 200 mV
lower (the lamp shows the end, but the current tapers on its own), the thermal
regulation that cuts the current when the chip gets hot, and the 150 mV input to
cell lockout. The module modeled is the one without the DW01 protection chip and
its OUT pads. The cell's charge does not change as it charges: set it with the
battery's charge property.

From TP4056 charger, in full.

Projects

## See the Li-ion charger, TP4056 in a project

2 built-in projects use it. Each opens in the editor, already wired.

Boards

## The boards it is shown on

This board has a built-in project with the Li-ion charger, TP4056 in it.

- Arduino Uno R3

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## Wire up the Li-ion charger, TP4056

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building free Open the editor
