DIY Arduino Smart BMS: 3S Li-ion Cell Monitor-Automatic Charger

 
Li-ion 3S Charger
1. Introduction

A standard charger is "blind"—it doesn't know if one cell is overheating or failing. This project creates a "Smart BMS" that monitors the individual health of every cell in a 3S (11.1V nominal / 12.6V max) Li-ion pack. It automatically manages the charging process and cuts off power if a "problamatic" cell is detected, keeping your battery pack healthy and safe.

2. Components

  • Arduino Uno

  • 12V Relay Module (To control the main charger)

  • ACS712 Current Sensor (5A or 20A version)

  • Voltage Divider Resistors: (6 Resistors: 10kΩ x 4, 20kΩ x 1, 30kΩ x 1)

  • 1N4007 Diode (For reverse protection)

  • 15V DC Power Adapter (Recommended for 12.6V Li-ion charging)

3. Circuit and Connections

Arduino Uno Pinout Diagram
Pinout Diagram of Arduino Uno

Pinout Diagram of Single Channel Relay Module
Pinout Diagram of Single Channel Relay Module


Pinout Diagram of ACS712
Pinout Diagram of ACS712

3.1. Relay Module (Single Channel)

Relay Module PinArduino PinConnection Description
VCC5VPower for the Relay Coil
GNDGNDGround Reference
IN / SignalD8Control Signal from Arduino
COM (Common)Connect to Charger (+)
NO (Normally Open)Connect to Diode Anode

3.2. ACS712 Current Sensor

ACS712 Sensor PinArduino PinConnection Description
VCC5VPower for the Sensor
GNDGNDGround Reference
OUTA3Analog Current Reading
Terminal 1From Diode Cathode
Terminal 2To Battery Pack (+) Main

 3.3. Voltage Divider 1 (Cell 1 Monitoring)

Divider 1 ConnectionArduino PinConnection Description
Resistor JunctionA0Middle point of 10k/10k resistors
Top ResistorConnect to Cell 1 (+) Tap
Bottom ResistorGNDConnect to Common GND

3.4. Voltage Divider 2 (Cell 2 Monitoring)

Divider 2 ConnectionArduino PinConnection Description
Resistor JunctionA1Middle point of 20k/10k resistors
Top ResistorConnect to Cell 2 (+) Tap
Bottom ResistorGNDConnect to Common GND

3.5. Voltage Divider 3 (Cell 3 Monitoring)

Divider 3 ConnectionArduino PinConnection Description
Resistor JunctionA2Middle point of 30k/10k resistors
Top ResistorConnect to Cell 3 (+) Tap
Bottom ResistorGNDConnect to Common GND

3.6 1N4007 Protection Diode

Diode LegConnection PointConnection Description
Anode (No Stripe)Relay NO PinReceives power from the charger
Cathode (Silver Stripe)ACS712 Terminal 1Sends power toward the battery

3.7. 12V/15V DC Power Adapter

Adapter WireConnection PointConnection Description
Positive (+)Relay COM PinThe "Input" power for charging
Negative (-)Common GNDConnect to Arduino GND and Battery (-)

4. Detailed Step By Step Circuit working

  • Voltage Tapping: Each cell's positive terminal is connected to an Analog pin. Because each tap has a higher voltage, we use different resistor ratios to keep the signal below 5V.

  • Current Monitoring: The ACS712 sits in the main charging line. It tells the Arduino exactly how many Amps are flowing into the cells.

  • Relay Switching: The Relay acts as the "Gatekeeper." If the Arduino detects a fault or a full charge (4.2V), it opens the relay to stop the flow of electricity.

  • Reverse Protection: The 1N4007 diode ensures that if the power adapter is unplugged, the battery does not discharge backwards into the circuit.

5. Libraries to be included

  • No external libraries required (Uses built-in Serial and Analog functions).

6. Code

const int relayPin = 8;
const float cellMax = 4.20; // Max voltage for Li-ion cell
const float cellMin = 3.00; // Min voltage for Li-ion cell

void setup() {
  pinMode(relayPin, OUTPUT);
  Serial.begin(9600);
  digitalWrite(relayPin, LOW); 
}

void loop() {
  // 1. Read Raw Values and reverse Divider Math
  float v1 = analogRead(A0) * (5.0 / 1023.0) * 2.0; // Cell 1
  float v2 = analogRead(A1) * (5.0 / 1023.0) * 3.0; // Cell 2
  float v3 = analogRead(A2) * (5.0 / 1023.0) * 4.0; // Cell 3
  
  // 2. Calculate Individual Cell Health
  float c1 = v1;
  float c2 = v2 - v1;
  float c3 = v3 - v2;
  float totalV = v3;

  // 3. Current Sensing (ACS712 Calibration)
  int rawCurrent = analogRead(A3);
  float amps = (rawCurrent - 512) * 0.0488; 

  // 4. Print Status to Serial Monitor
  Serial.print("C1:"); Serial.print(c1);
  Serial.print("V | C2:"); Serial.print(c2);
  Serial.print("V | C3:"); Serial.print(c3);
  Serial.print("V | Total:"); Serial.print(totalV);
  Serial.print("V | Amps:"); Serial.println(amps);

  // 5. Logic for Charging and Faults
  if (c1 >= cellMax || c2 >= cellMax || c3 >= cellMax) {
    digitalWrite(relayPin, LOW); // STOP: Full
    Serial.println("ALERT: CHARGE COMPLETE");
  } else if (c1 < cellMin || c2 < cellMin || c3 < cellMin) {
    digitalWrite(relayPin, LOW); // STOP: Problamatic
    Serial.println("ALERT: PROBLAMATIC CELL FOUND!");
  } else {
    digitalWrite(relayPin, HIGH); // SAFE: Charging
  }
  
  delay(2000);
}

7. Detailed Step By Step Code working

  • Reading and Scaling: The code reads three analog pins and uses multipliers to find the real voltage at each battery tap.

  • Cell Isolation: It subtracts the lower tap values from the higher ones to isolate the voltage of Cell 2 and Cell 3.

  • Current Logic: It reads the ACS712. If the amperage is correct, it continues; if there is a short, the relay can be programmed to cut off.

  • Safety Decision: The if statements monitor every cell. If any cell hits 4.2V, the relay stops the charger. If any cell is dangerously low, it flags a "Problamatic" cell.

8. Tips

  • Star Grounding: Keep all Ground wires connected to a single point to avoid "noise."

  • Calibration: Always verify the voltage with a multimeter and adjust the multipliers in the code (2.0, 3.0, 4.0) to match your specific resistors.

  • Li-ion Only: This project is strictly for Li-ion 3S packs. Do not use it for Lead-Acid batteries.

9. Uses

  • Building high-quality 12V Li-ion battery packs.

  • Real-time monitoring of solar battery banks.

  • Safety system for DIY electric vehicles or drones.

10. Conclusion

By combining monitoring and charging, you have created a system that is safer than most cheap commercial chargers. You can now identify a failing cell before it causes an accident, saving you time and money.

തുടക്കക്കാർക്കായി ഇലക്ട്രോണിക്സ് ലളിതമായി പഠിക്കാം.

Empowering students in Kerala with hands-on technical skills.