Warning: Laptop batteries are so dangerous because they contain high energy and could explode if you make any mistake with them. It could even damage any device that is connected to it. I am not responsible for any damage or injuries that occur to anyone. Don't try this at home. You are doing this at your own risk.
When working with lithium batteries, you must keep them in a clean environment (keep the batteries away from any metal objects). Keep the batteries in well-protected boxes; keep them far from any liquids; use proper safety tools for handling and containing lithium fires; keep the batteries far from children; and use proper tools for protecting your own computer, such as:
1- Using USB isolators for isolating the computer from the microcontroller that connected to the battery. If the high-voltage wires touch any signal wires, this could fry your computer and everything connected with it.
2- Make sure to fasten all your wires and keeping them intact.
3- Keep the communication wires away from the high-voltage wires.
The BMS is an electronic system that manages a rechargeble battery (cell or battery pack), such as by protecting the battery and monitoring its state, balancing each individual cell, and making sure that it operates within the safe operating area.
01- Reports the appropriate charging current needed for constant current charging and the appropriate charging voltage needed for constant voltage charging to a smart charger using SMBus broadcasts. These values can be sent to the BQ24725 smart charger. 02- Determines the chemical state of charge of each battery cell using Impedance Track™ and can reduce the charge difference of the battery cells in fully charged state of the battery pack gradually using cell balancing algorithm during charging. This prevents fully charged cells from overcharging and causing excessive degradation and also increases the usable pack energy by preventing premature charge termination. 03- Supports pre-charging/zero-volt charging. 04- Support fast charging. 05- Supports charge inhibit and charge suspend if battery pack temperature is out of temperature range. 06- Reports charging fault and also indicate charge status via charge and discharge alarms.
The BMS might also have a communication protocol that enables controlling it using any embedded system. The embedded system could also read many internal registers inside the BMS, such as:
01- The voltage for each individual cell. 02- The voltage of the pattery pack 03- The current (Positive value for charging, Negative for discharging, and zero for idle). 04- The temperature of the battery pack. 05- Estimated time to full (when charging). 06- Estimated Time to empty (when discharging). 07- Full charge capacity. 08- Remaining capacity. 09- Cycle count. 10- Absolute/Relative state of charge. 11- Charging voltage. 12- Charging current. 14- Battery status flags. 15- Mosfets status. 16- Charging status. and more ....
The Laptop BMS is controlled using the System Management Bus (SMBus) protocol. It is a special type of I²C bus with a low frequency speed of 10KHz and might require a low value pull-up resistor such as 1.2 KOhm for both the clock and data lines. This protocol is used by all the computers to control the BMS and to read its basic information. This communication bus follows a standard which will be discussed further later.
We can do lots of projects using the BMS such as:
01- DIY power walls (using lithium batteries for storing solar energy) and monitoring each battery pack. 02- DIY electric scooters. 03- DIY electric cars and robots. 04- Battery backuped devices, power banks, and UPSs. 05- DIY power bank for Raspberry Pi and controlling it from Raspberry Pi. So many applications ..
Once the battery is used too many times, its life degrades by usage, and once the BMS detects that one of the cells is damaged, it locks down the battery and prevents any further charging/discharging process.
A while a go, I have started tinkering with an old BQ20z70 BMs (recycled from old laptop battery) and it was my lucky day that the BMS was locked using the default security key from TI, here is my experiment Reverse Engineering BQ20z70 Laptop BMS and I have talked about Understanding the BQ20z70 Security and how the authentication works. Finally, I have resetted the permanent failure flags and the BMS has another life.
This repository assumes that you have a working laptop battery with no permanent failure flags.
I am currently using a recycled laptop battery with BQ4050. Any working BMS will work.
5Why Using TIVAC TM4C123G LaunchPad™ ?
The real reason for using TIVAC is that Texas Instruments has the best support for the SMBus and they have integrated the SMBus drivers into the TivaWare™ for C Series SDK. Here is the example that I have used in my code TM4C123GH6PM: Interface Tiva C to BQ78350R1 using SMbus over I2C. Also, they make awesome battery management systems kits and tools.
Also, the TIVAC TM4C123G LaunchPad™ is affordable, found everywhere in our country, and used a lot with students, which makes it the preferred kit.
6The Hardware Connection
This image shows the connections of the BMS. I have soldered a pin header to help me with experimenting. The connections are illustrated in the following table:
BMS Board Explanation P+ Pack's positive pin (High Voltage - High Current) 11.1V nominal voltage , this pin can be used for charging/discharging the battery pack P+ Pack's positive pin (High Voltage - High Current) 11.1V nominal voltage , this pin can be used for charging/discharging the battery pack C SMBus-Clock (Communication) D SMBus-Data (Communication) T This pin should be connected to the thermistor with a label (RT) which is integrated into the battery (it enables the laptop to measure the internal temperature of the battery pack). The Chinese manufacturer connected a fixed 10KOhm resistor :D !!!! P- Pack's negative pin, which is shared with the communication protocol device and the load P- Pack's negative pin, which is shared with the communication protocol device and the load
Kindly note that this pinout is not the same for all batteries. Please search with your battery model to get the correct pinout.