## Thursday, March 9, 2023

Today we try a circuit from the internet for charging batteries, a BMS or battery management system. I'll show you a schematic for only one cell and scale it up for any amount of batteries if you want a 2S battery pack, 3S, and so on. The function of this circuit is to charge the batteries, protect them from overvoltage, limit the current and also balance the batteries in the case of more than one cell. Is it not the best circuit or the most compact, but does it work? Well, stick till the end to find out. I'll show to the components we need and what each part will do in the circuit and by that, how the circuit works. We mount it on a PCB and test it out to charge and balance our batteries. This circuit is not my idea, there are already a lot of similar circuits on the internet such as this one. So guys, let's get started.

Part 1 - Why do we need a BMS?

What's up my friends, welcome back. This below the PCB we will analyze today and learn how it works. Will this simple circuit be able to limit the current, control overvoltage and balance the battery pack? Well, let's see. Lithium ion or LiPo batteries are very popular, especially with makers like us for small robots, portable devices, RC toy cars and drones and so on. But these batteries are also very sensitive and dangerous. If you don't control the process of charging and discharging such batteries, they will stop working or get worse. The battery cells can swell and even explode from overcharging, and a deep discharge can make the battery fail.

That's why these batteries should go together with a battery management system unit or BMS. This will control the voltage and current of the battery and keep them safe. Usually, the nominal voltage of a LIPO battery is 3.8 volts and 4.2V when fully charged. So, as soon as the battery cell will reach this value, the charging process should stop and that's what this circuit should do.

Part 2.1 - 1S Charger

When you have only one cell, you only care about the maximum voltage and the current limit to protect the battery. But when you have a battery pack of more than 1 cell, so 2S, 3S and so on, you also need to balance the value of each individual cell.

We have a PNP transistor connected in series with 4 diodes that will simulate a load. At the base of the transistor, we have a ZENNER reference diode (TL431) which will get open at a certain voltage value and by that connects ground to the transistors base and when the transistor is active, we bypass the battery and waste the power on the diodes instead. This ZENNER diode is the TL431 and it has a reference pin, so by adjusting the potentiometer we can set this reference to be at 4.2V, that's how we select when the charging process will stop.

Part 2.2 - Part List

So as you can see, this circuit is not that efficient since we waste power inside the diodes and transistor. Also, if the power waste is too high, maybe the transistor would need a heat dissipator so it won't burn out. But we are not looking for efficiency with this circuit because we can use this charger with a supply from the main outlet so we don't care that much about efficiency.

We also add a LM317 regulator at the input place in current mode. In this configuration, the current limit is set by the resistor at the output and is equal to a formula, VREF divided by the resistance value. VREF for the LM317 is 1.25V so it should be easy to select a resistor and limit the charging current at let's say 600mA. We add a second LM317 regulator but on voltage control mode. Without this, the input must be exactly 4.2V. But sometimes we only have 5V from a USB connector or maybe 12V input from a DC adapter. So, using this second LM317, we can adjust the output to 4.2V so no matter the input value, the voltage that goes to the battery is 4.2V. The output value is given by these 2 resistors.

Today we try a circuit from the internet for charging batteries, a BMS or battery management system. I'll show you a schematic for only one cell and scale it up for any amount of batteries if you want a 2S battery pack, 3S, and so on. The function of this circuit is to charge the batteries, protect them from overvoltage, limit the current and also balance the batteries in the case of more than one cell. Is it not the best circuit or the most compact, but does it work? Well, stick till the end to find out. I'll show to the components we need and what each part will do in the circuit and by that, how the circuit works. We mount it on a PCB and test it out to charge and balance our batteries. This circuit is not my idea, there are already a lot of similar circuits on the internet such as this one. So guys, let's get started.

Part 1 - Why do we need a BMS?

What's up my friends, welcome back. This below the PCB we will analyze today and learn how it works. Will this simple circuit be able to limit the current, control overvoltage and balance the battery pack? Well, let's see. Lithium ion or LiPo batteries are very popular, especially with makers like us for small robots, portable devices, RC toy cars and drones and so on. But these batteries are also very sensitive and dangerous. If you don't control the process of charging and discharging such batteries, they will stop working or get worse. The battery cells can swell and even explode from overcharging, and a deep discharge can make the battery fail.

That's why these batteries should go together with a battery management system unit or BMS. This will control the voltage and current of the battery and keep them safe. Usually, the nominal voltage of a LIPO battery is 3.8 volts and 4.2V when fully charged. So, as soon as the battery cell will reach this value, the charging process should stop and that's what this circuit should do.

Part 2.1 - 1S Charger

When you have only one cell, you only care about the maximum voltage and the current limit to protect the battery. But when you have a battery pack of more than 1 cell, so 2S, 3S and so on, you also need to balance the value of each individual cell.

We have a PNP transistor connected in series with 4 diodes that will simulate a load. At the base of the transistor, we have a ZENNER reference diode (TL431) which will get open at a certain voltage value and by that connects ground to the transistors base and when the transistor is active, we bypass the battery and waste the power on the diodes instead. This ZENNER diode is the TL431 and it has a reference pin, so by adjusting the potentiometer we can set this reference to be at 4.2V, that's how we select when the charging process will stop.

Part 2.2 - Part List

So as you can see, this circuit is not that efficient since we waste power inside the diodes and transistor. Also, if the power waste is too high, maybe the transistor would need a heat dissipator so it won't burn out. But we are not looking for efficiency with this circuit because we can use this charger with a supply from the main outlet so we don't care that much about efficiency.

We also add a LM317 regulator at the input place in current mode. In this configuration, the current limit is set by the resistor at the output and is equal to a formula, VREF divided by the resistance value. VREF for the LM317 is 1.25V so it should be easy to select a resistor and limit the charging current at let's say 600mA. We add a second LM317 regulator but on voltage control mode. Without this, the input must be exactly 4.2V. But sometimes we only have 5V from a USB connector or maybe 12V input from a DC adapter. So, using this second LM317, we can adjust the output to 4.2V so no matter the input value, the voltage that goes to the battery is 4.2V. The output value is given by these 2 resistors.