DIY Lithium Battery Balancer and monitoring (BMS)

Tags: #<Tag:0x00007f1bdf42bdf8> #<Tag:0x00007f1bdf42bc68>

(Gerardo Gomez Fernandez) #669

thanks for the reply

(Vela Nautica) #670

Hi guys,

I set my batteriebank up with diyBMS and started charging.
I added a routine to it, if the charging of a cell reaches a certain voltage, now programmed to 3.511 Volts, the BMS will tell the charger to stop charging. So the cell will not be overcharged.

I set it intentionally lower than the LiFePo allowed 3.65 V.

One of my cells is a bit in advance of the other cells, at about 3.43 volts, the one cell raises quickly ( exponetialy ) to set set limit of 3.511 V and indicates to the charger to stop.
At that time the other cells show values like 3.4x0 volts.
Now the balancing kicks in and it is discharged as it should.
I setup a hold of 0.110 Volts required discharge by balncing before the cutoff is taken away and the charger is connected again.
This 0.110 Volts is used to balance the cell down.
but the difference is small and it takes endless to balance.

What to do? should I set the limit lower before the charger kicks in again?

Or is the difference really small and the batterie is full??

I am charging with 22 Amps at this time, final goal is 120 A to keep generator times short.

Do I need a Resistor with lower ohms for more Amps getting draged off from the cell?


(Chance Schraeder) #671

Anything beyond 2 amps of discharge current will likely start burning up traces on the board. Assuming the fuse doesn’t trip first.

Maybe instead of a load resister, use it to actuate a relay to a board with much higher current draining capabilities?

(Vela Nautica) #672


I installed a 1.8 Ohm resistor -> 1.9 Amps and enforced the traces and fuse…
it works, (until now)

I thought about adding maualy 1 or 2 100W resistors to the cell in question but as I understand I should do a bottom balancing first.

I got my cell quite good balanced from the dealer ( I thought so ) but there are still small grades.

I thought about to build a simple bottom balancer with a STM32 because of 0 to 4095 for a 12-bit ADC, let this discharge the cells one by one and disconnect the Resistors by MOSFET automaticaly at 2.8 Volts.
let them rest for 24 H
level again to 2.8 Volts.
After that procedure they should be balanced right?


(Dirk Walde) #673
  1. question

How can I query the I2C bus from 0.5 to 1.0?
I found the info in the ino on lines 344 - 345 but I do not know how to change that exactly. Am still beginning.

Because I always have problems with more than 7 modules … times with 8 times with 9 modules. But since I have a S14 system as a powerwall, I would need 14 modules.

With 2.2K or 4.4K and also with 8.8K pullup there was no improvement.
Even with an external 3.3V I got the problems and synonymous with an I2C clock speed of 400khz instead of 100khz, the problems are there

(Board V2.1)

  1. question

Does anyone have a running version for an ESP32 chip because my dev board with the ESP32 has an AM1117 with 1A at 3.3V would offer it the times testweise to use

(Vela Nautica) #674

I run an ESP32 with OLED and SDcard, but I wrote my own software and used only some parts of Stuarts controller soft. I did not change the software on the modules.

About your I2C:

  • where did you place your pullup resistors? I placed mine with 4.7K at the last module in the chain.
  • how long are your wires. I used 20 cm.
  • did you twist the wires? -> twisted pair…
  • I use external 3.3V on common ground
    I run 8 modules and very rare a wired value. I do extra filtering in crucial routines to avoid unvalid numbers.


(Dirk Walde) #675


Hello Oliver,
you can put your code for the ESP32 online or provide me.
Can you also enclose a plan and wiring for the OLED and SDcard?
Would like to try.

Am now on 11 modules with 4.4K pullup on the ESP8266 and power via the USB 5V on the ESP8266 + Elko 10V- 1000uf on the ESP8266 and additionally 3.3V at the end of the line on the last module.

I have a control on the ESP on the serial interface for the information of the modules with ID + Volt + Temp at the time to detect errors in the bus from the I2C.

The modules are connected with 20cm each. Not twisted

!!! Update for Oliver !!!
Du you like Github ? or Online google Drive… ftp or mail all ok
!!! Update for Oliver !!!

(Brett) #676

hi dirk

if you could share a picture of your esp8266 as iv tried using 4.7k on a proto board but dont get any signel to the bms but when i connect my 2.2k proto board everything works but only 9 boards the 10th light is flashing but not provisioning 10cm cables not twisted

(Dirk Walde) #677

I had thought that I would get a grip on it.
Which unfortunately this morning. When turning on the BMS again just garbage on the I2C channel. But I’ll take pictures of the test setup.

Question to all !

I’ve just suspected the code.
How can I change the query intervals of the modules.
Had something of 0.5 seconds read.
How can I change the code so that it is 1 second or 1.5 seconds.

Working System with 10x
Tomorrow I will see if I come to 14x

USB 5V Power PS5V/2A —> ESP8266 with SDA 2,2K SCL 2,2K ----> Moduls 10x <---- 3,3V PS with SDA 2,2K SCL 2,2K

(Brett) #678

HI Dirk

Great little set up like the idea of the PS 3.3v on the terminating end of your linkage.
No one has mentioned that is needed to run more than 9 modules as i have found myself.
or is the PSU powering your esp8266

(Dirk Walde) #679

I use 2x power. One via USB 5V to the ESP and from the other side of the last module PS 3.3V and on both sides I have 2.2k pullups (4x 2.2k)

!!! NOW: Working System with 12x !!!
but still with problems with the cold start with more than 10 modules

I just need 14 pieces for my S14P100 (18650LI x 1400 pieces) Diy Powerwall System with 58.8V max power 11.91 kWh

(Brett) #680

This are my cells but will be 74 @ 10000mah each of them 60ah to a bank 12s6p 20amp discharge 5 amp charge

(Dirk Walde) #681

Ok 14 modules are running now.
Unfortunately had 3 defective NTC.
Now let’s see what the next 24 hours bring in the test run.

? A question “aussiegwapo” Brett. ?
Where did you buy your connection cables? Were they already so finished or did you mount the plugs themselves to the cables.

to your problem yet:
I can only recommend you to delete the Attiny again (Arduino example Attiny EEPROM CLEAN) and rebuild with the Board Script. And then via the ESP BMS test software to check if the controller is visible with “X” in the serial console.

And you have me in the normal ESP firmware set a loop for the serial console with output of ID, volts and temperature.


Line ~~~ 400 +

emoncms.postData(myConfig, cell_array, cell_array_max);
influxdb.postData(myConfig, cell_array, cell_array_max);

  Serial.println(" Aufstellung Module - ID - VOLT - TEMP ");
  for (int a = 0; a < cell_array_max; a++) {
    // ANFANG - AUSGABE CELL VOLT usw module->address
    Serial.println(" Cell ID = " + String(cell_array[a].address));
    Serial.println(" Cell Voltage = " + String(cell_array[a].voltage));
    Serial.println(" Cell Temperatur = " + String(cell_array[a].temperature) + " C "); 
  //  Serial.println(" Max Cell Voltage = " + String(myConfig.max_voltage*1000));
    if (cell_array[a].voltage >= myConfig.max_voltage*1000) {
      cell_array[a].balance_target = myConfig.max_voltage*1000; 
       max_enabled = true;
       balance_status = 4;
    } else if (manual_balance!= true) cell_array[a].balance_target = 0;
  if (max_enabled!=true) avg_balance(); 
  max_enabled = false;
   Serial.println(" Aufstellung Module - ENDE ");
  //Update Influxdb/emoncms every 20 seconds
  // ANFANG - AUSGABE Übertragung 
   // next_submit = millis() + 20000;
   next_submit = millis() + 2000;
  // ENDE - AUSGABE Übertragung 

}//end of loop

Update: 18.11.2018

and a little problem with the 24 hour test.
Apparently I still have a problem with 2 boards.
They draw in so much power from the battery that 18650 he has over 2000mah after 12 hours. Empty is at 2v from 4.2v. Since I have to check the REG710NA-3.3 times what’s going on.

I’ve tested the REG710NA-3.3 and apparently have a short circuit in the output (not soldered clean) or they are defective. I’ll renew the dan tomorrow.

Update: 19.11.2018 for Brett
If we replace the thermister with a resister whats would be the value?
10 k NTC = 10k ohm = ca. +20C

0°C 32,65 kOhm +10°C 19,90 kOhm +20°C 12,49 kOhm +25°C 10,00 kOhm +30°C 8,06 kOhm +40°C 5,32 kOhm

Update 20.11.2018

as expected, there was a short circuit on the pins 3,4,5 at the output of REG710NA-3.3.
Once completely soldered and everything OK as it looks.

now on test run with S14P4 test Pack

(Brett) #682

you had 3 bad thermistors NTC.

I found that one of my i2c chip has a problem

Have 11 modules running

Ill have to get some more compents to build some more boards

Thank you for the tip on using the test controller to provisioning with my modules thats with out having a PS 3.3v on the end of the banks module

I brought my cable from
i made my own cable connectors every connector and power lead is made by hand

Ill have a look in the scripting.

(Raccoon ) #683

Hi everyone, Does anyone have a guide on how to order on, i would love to try the diyBMS v2.1 or 3.0, but i have no idea about all the settings asked :confused: layers , kind, thickness, etc… I think the only option i understand is the quantity XD I know its seems kinda obvious for all of you here, but it isn’t for me at all. Thanks a lot and sorry for popping up with this question

(Brett) #684

version v3.0

(Raccoon ) #685

thanks a ton Brett ! really much appreciated indeed!

Can anyone mention dimensions also for the v2.1 ? Thanks a lot
EDIT 2874: well, there must have been an easier way for sure, but i had to install kicad and make manual measurement. 65*45 seems to be the answer :wink:

(stuart) #686

The 45mm is so that the board fits neatly between 18650 once they are mounted in the plastic 4x5 grids

(Vela Nautica) #687

Hi Dirk,

I am working to get all ready for you.
I still need to clean up the software a bit and test it before its OK for you.
I use 8 cells 8S and there is a graph that will not support more cells at this time… maybe I can fix it.
You will need the SDcard for my version bcs I store some data on it as I did not store it all in the EEprom at this time. Also there is some CSS and JS on the SDcard bcs I will run the BMS offline at most time and the original concept was for online use only.
The OLED is not important at this time,
I produced a scetch for you, how to wire the SDcard. (only 6 wires)

So where would you like to get the code?


(stuart) #689

These can temporarily be replaced with fixed resistors if you need to get the circuit up and running