Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use TP4056: Examples, Pinouts, and Specs

Image of TP4056Design with TP4056 in Cirkit Designer

Introduction

The TP4056 is a complete constant-current/constant-voltage linear charger for single-cell lithium-ion and lithium polymer batteries. Its SOP package and low external component count make the TP4056 ideally suited for portable applications. Furthermore, the TP4056 can work within USB and wall adapter power specifications. Common applications include portable devices, like DIY projects, microcontroller boards, and standalone battery chargers.

Explore Projects Built with TP4056

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

Pin Number Pin Name Description
1 BAT Battery positive connection
2 GND Ground connection
3 VCC Input power supply (4.5V-5.5V)
4 TEMP Temperature sense (optional)
5 PROG Charge current programming pin
6 STAT Charge status output pin

Usage Instructions

Connecting the TP4056 to a Circuit

  1. Power Supply: Connect a 5V power supply to the VCC and GND pins. Ensure that the power supply can deliver the necessary current for charging.
  2. Battery Connection: Attach the positive terminal of the lithium battery to the BAT pin and the negative terminal to the GND pin.
  3. Setting Charge Current: The default charge current is set to 1A. To adjust the charging current, place a resistor between the PROG pin and GND. The charge current is set by the formula: Icharge = 1200 / Rprog (mA), where Rprog is in ohms.
  4. Charge Status: The STAT pin can be used to indicate the charging status. When charging, the STAT pin will be low. Once charging is complete, it will go high.

Important Considerations and Best Practices

Troubleshooting and FAQs

Common Issues

Solutions and Tips

FAQs

Example Code for Arduino UNO

The following example demonstrates how to read the charge status from the TP4056 using an Arduino UNO.

// Define the STAT pin connected to the Arduino
const int STATpin = 7;

void setup() {
  pinMode(STATpin, INPUT);
  Serial.begin(9600);
}

void loop() {
  // Read the charging status from the STAT pin
  int chargeStatus = digitalRead(STATpin);

  // Check if the battery is still charging
  if (chargeStatus == LOW) {
    Serial.println("Battery is charging...");
  } else {
    Serial.println("Battery is fully charged or no battery connected.");
  }

  // Wait for a second before reading the status again
  delay(1000);
}

This code sets up the Arduino to read the charge status from the TP4056 and print the status to the Serial Monitor. The STATpin should be connected to the STAT pin on the TP4056 module, and the Arduino's ground should be connected to the module's GND pin.