BMS (Battery Management System) || DIY or Buy || Properly protecting Li-Ion/Li-Po Battery Packs

**A Detailed Guide to Building a DIY BMS**

I recently embarked on a project to build a DIY Battery Management System (BMS) and I'm excited to share my experience with you. The goal was to create a system that could monitor and balance the battery cells in a 12V lead-acid battery pack, while also providing online monitoring capabilities.

**Designing the BMS**

I started by designing the circuitry for the BMS using a microcontroller (ESP8266) and an AT Tiny IC. The ESP8266 would be responsible for monitoring the battery voltage and temperature, while the AT Tiny would handle the balancing process. I also added a MOSFET to connect a power resistor to lower the battery voltage if needed.

**Sourcing Components**

I sourced the required components from Mouser and eBay. I was able to find most of the components at a reasonable price, but a few were either too expensive or special ones that I had to source from eBay.

**Soldering the SMD Components**

Once all the components arrived, it was time for soldering. I used tons of flux, a microscope, and a fine soldering tip to solder all the SMD components to the PCBs. According to the schematic, this was a pretty straightforward process.

**Adding Power Resistors and JST Terminals**

Next, I added the big power resistors, as well as the female header for programming and the JST terminals for battery and I2C lines.

**Programming the ESP8266**

To program the ESP8266, I hooked it up to my computer and uploaded the given code. The code was pretty simple to understand and follow.

**Programming the AT Tiny Boards**

For the AT Tiny boards, I connected an Arduino UNO to my computer and uploaded the arduino ISP Sketch. Then, I connected the Arduino UNO to the ICSP pins and continued with burning the bootloader and uploading the code through the programmer.

**Assembly and Testing**

Once all four boards were programmed, it was time for assembly. I hooked up each battery cell pair to one PCB using a JST wire that I prepared beforehand. After connecting the ESP8266 to power, I connected to it with my computer and entered its IP address in a browser to properly connect the ESP to my router.

**Online Monitoring and Balancing**

I then checked my router to determine the new IP address of the ESP and typed it into the browser. On the page, we couldn't see much yet, but by clicking on "modules," we could hit the provision button after connecting the first PCB to the ESP through a four-pin JST wire (connector). After a few seconds, we should see the first module with the measured voltage and temperature of the battery cell.

**Calibrating Battery Cell Voltages**

I repeated this process three more times until all the modules were recognized by the software. I then set the maximum allowed voltage to 4.1 volts and started charging the battery pack with my lab bench power supply.

**DIY BMS Advantages**

The DIY BMS seems to work fine, offering online monitoring and balance charge functions that commercial BMS do not offer. However, it is more expensive, takes up a bit of time to solder, and worst of all, draws in quite a lot of current from each battery cell.

**Conclusion**

In conclusion, while the DIY BMS offers its own advantages, such as online monitoring and balancing, it may not be suitable for regular battery packs that sit around most of the time. However, when used for the right application, like a DIY power wall charged up through solar power, it can be a great option.

**Final Thoughts**

I hope this article has provided you with a detailed guide to building a DIY BMS and its advantages and disadvantages. If you have any questions or comments, please feel free to share them below.

WEBVTTKind: captionsLanguage: enLet's just say you just created a homemade lithium-ion battery bankAnd if you have no idea how to do this then check out one of my previous videosAnyway, my pack got 4 cells in series with 2 cells in parallel eachWhich means it covers a voltage range of 16.8 to 12 voltsoutputs up to 40 amps continuouslyFeatures a capacity of 5 amp-hours and thus a nominal energy of 72 watt-hoursThat means that after adding wires to the packand adjusting its output voltage to constant 12V with a suitable converterIt is perfect for powering 12 volt devicesBut such a naked battery pack is not 100% safe to work withFor example, if the battery pack got dischargedI can charge it up with an appropriate constant-current constant-voltage methodBut during that process I noticed that not all cells feature the exact same voltageThe reason is that not every cell is chemically identical and thus they all featureslightly different capacities and thus charge up faster which can lead to misalignments in the voltage of the cells andultimately in the destruction due to over voltageOr let's say the load failed and the battery got shorted, which I will certainly not try outbecause battery shorts can do a lot of damageTo avert such safety problems, you can get yourself a BMSor battery management system from ebay for cheapThose not only offer a balanced charging and short-circuit protection,but also overcharge and discharge protectionbut since some viewers do not really trust such BMS circuits from eBay andtons of you asked asked for DIY BMSwe will have a closer look at a commercial BMS and explain all of its functions andthen create a DIY PMS based on Stewart Pittaway's designin order to find out whether you should go with the commercial version or go the DIY route insteadLet's get started...This video is sponsored by JLCPCBwhere you can now get ten PCB's in all available colors for the price of only two dollars andnew customers also get a shipping discount on their first orderTo properly understand commercial BMS I got myself a few different onesThe one I will have a closer look at will be the biggest onewhich basically comes with all the protection features you needAfter removing its top heatsink as well as its bottom paper insulation,I examined these circuit and found out that the PCB is divided in three functional groupsSo let's start off with the top side and the components closest to thebalanced connector which like the name impliesConnects to each cell of the battery packBy having a look at the components under the microscopeWe can for one see a bunch of passive components like capacitors and resistorsBut also two transistors for each cell and one DW01A ICThis IC protects each cell from overcharge, overdischarge, and overcurrentby simply utilizing 2 transistorsWhich we had a look at before in order to cut the cells connection to the loadBy flipping the PCB around, we got more components near the balanced connectorWhich once again where a couple of complementary passive components and also once again a transistor,but this time in combination with some bigger 200 ohm resistors and a BB3A ICThose markings on the IC are those of an HY2213 ICwhich is one cell lithium ion lipo balance charge ICas you can see in the example circuit of the data sheets.it's job is to activate the transistorWhich then discharges one battery cell through a resistoras soon as the cell voltage goes above a certain voltage valuethis way, after the charging process, all cells of the battery pack get charged up to 4.2 voltsand we got a balanced packLast, but not least, on the top side of the PCB right next to the B-, P-, and C- terminalWhere you would hook up the main wires of the battery pack,we got 6P75NF75 N-channel power MOSFETs aA couple of passive components with transistorsand three bigger resistors which act as a current shuntThe way this works is that as soon as the battery draws more than the beam s max current of 35 amps,we got a voltage drop high enough across the current shunt to activate the passive component network andThus turn of the MOSFETs and therefore the current flowThis way the three functional groups of this BMS fulfill all the required battery pack protection featuresPretty much all the other BMS followed the same PCB principleThe only thing that is different sometimes is that balanced charging is not includedAnd now that we know how a commercial BMS works and how much they cost on averageI thought about how to create an improved versionbut while coming up with my own planI realized that a viewer recommended me to have a look at Colin Hickey's or Adam Welsh's work for referenceThey have built and created a couple of videos about the DIY BMS (process)Which is a project from Stuart Pittaway that you can find on githubAfter downloading its smaller PCB branch which like the name implies comes with a smaller PCB than its regular versionI had a closer look at the schematic of the PCB to find out how it worksFirst off after hooking up a battery cell this REG710NA regulatorCreates a stable 3.3 volts for the ADUM1250I2C isolator and the AT Tiny 85 microcontrollerThrough a voltage divider, the battery cells raw voltage get sampled and monitored by the AT Tiny 85Which every few seconds sends over this voltage value through its I2C bus to the I2C isolatorWhich is on the other side hooked up to an ESP8266development board which then provides this data for viewing through web browserBut not only does the circuits monitor the voltage as well as thetemperature of the battery cells through a thermistorBut it also got a MOSFET, which if the battery voltage needs to get lowered, connects it to power resistorSo online monitoring and balancing is easily possiblewhich were improvements I was looking forThat is why I uploaded the Gerber files of the PCB to JLCPCBin order to get ten of them for two dollars plus shippingand afterwards started sourcing the required components.I got the majority of them from Mouser and only a few either too expensive or special ones from eBaySo as soon as the components arrived,as well as the PCBs, which looked very niceit was time a for solderingI basically used tons of flux, a microscopeand a fine soldering tip to solder all SMD components to the boardsAccording to the schematic which was pretty easy to doThe only thing I messed up was that I ordered one component package size too bigWhich still worked for the resistors but was not the best option for the capacitorsbut nevertheless after three hours of soldering the SMD components of poor PCBs were soldered onNext I added the big power resistors, as well as the female headerfor programming and the JST terminals fully battery and the I2C lines to each boardFor the ESP8266 port, I went with this note MCUWhich I soldered onto a small piece of perf. board to which I also edit a 4-pin JST terminalIts pins connect to 3.3 volts, D1, D2, and ground of the ESP8266Which are mandatory for the I2C communicationTo program the ESP. I simply hooked it up to my computerOpened the given code for it, selected baud settings like they were described in the code and click uploadAfter successfully uploading the code, it was time for the AT Tiny boardsFor which we only have an ICSP connector for programmingSo I connected an Arduino UNO to my computer in order to upload the arduino ISP Sketch to itAfterwards, I connected the Arduino UNO to the ICSP pins like it is shown here andContinued by downloading the proper board library mentioned in the codesetting the correct board propertiesburning the bootloader which only sets the correct fuses of the AT Tiny andfinally uploaded the code through the programmer which worked like a charm andAs soon as all four boards were programmmed, it was time for the assembly.I Hooked up each battery cell pair to one PCB you through a JST wire that I prepared beforehandOnce that was done, I connected the ESP8266 to power andfirstly had to connect to it with my computer in order to enter its IP address in a browser toproperly connect the ESP to my routerI then checked my router to determine the new IP address of the ESP and typed it in to properly connect to itOn the page. We cannot see much yet, but by clicking moduleswe can hit the provision button after connecting the first PCB to the ESP through a four pin JST wire (connector)After a few seconds, we should see the first module with the measured voltage and temperature of the battery cellAfter then repeating this connection and provision button hitting process three more times,We finally got all the modules recognized by the software which looked pretty awesome so farWhat I was missing though was a setting to set a maximum allowed voltageThankfully though Colin Hickey improved the software which on the bad side means I had to reprogram all the boardsBut on the bright side means we got a maximum voltage setting plus a few more helpful settingsNow after properly calibrating the battery cell voltagesI set the maximum voltage to 4.1 voltsand started charging the battery pack with my lab bench power supplyas you can see, near the end of the charging process,the batteries exceeded this 4.1 volt value andThus the boards balance them out by drawing around one amp of current through the power resistorso all and all the DIY BMS seems to work fine andoffers with its online monitoring and balance charge functionfeatures that commercial BMS do not offerOnly problem is that it is more expensivetakes up a bit of time to solder and worst of all draws inquite a lot of current from each battery cellin comparison to commercial BMSSo the DIY BMS makes sense to use in combination with, for example, a DIY power wallWhich gets charged up through solar power,but not for your regular battery pack which sits around most of the timeBecause of that I declare that both DIY and BUY are this time the winnerBecause when used for the right application,they offer their own advantages that the other version does not haveBut what do you think? Let me know in the comment section below asAlways thanks for watching. Don't forget to Like, share, SubscribeStay creative and I will see you next time!