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.
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 |
Icharge = 1200 / Rprog (mA)
, where Rprog is in ohms.Q: Can I charge multiple batteries with one TP4056 module? A: No, the TP4056 is designed for single-cell lithium-ion or lithium polymer batteries.
Q: What should I do if the TP4056 is getting too hot during charging? A: Ensure that the charging current is not set too high for your application. Consider adding a heat sink or reducing the charge current.
Q: Can the TP4056 be used without the temperature sensing pin? A: Yes, the TEMP pin is optional. If not used, it should be left unconnected.
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.