DIY Lithium Battery Balancer and monitoring (BMS)

Tags: #<Tag:0x00007f1be55911d8> #<Tag:0x00007f1be5591070>

(Chaveiro) #588

Modbus runs over physical RS485 if you want something more standard.
Is a nice standard, old and proven.
Simple to implement uses simple master initiated command requests and there are plenty of arduino libs to choose from. I’ve developed with it in the past.
The only requirement is having an unique slave address for each slave, that can be done is different ways:

  • specify each address on the firmware of each slave
  • by jumpers on the slaves boards
  • implement custom provisioning mode where the master sends a ‘pair’ request to all slaves and then you have to press a button on all the slaves to establish their own address on the pack

By the way i like your custom solution @scttnlsn !

(Bill Thomson) #589

BTW guys, that’s Modbus, vice MOD bus.

(Vela Nautica) #590


how about develop a firmware that includes different communication protocolls and let´s us just define at the start what you prefer. I2C or CAN or RS485 ?

for the first test it could be just some modules like:



(Vela Nautica) #591


I am using GBS LiFePo4 batteries but I think its up to you what batterie data you setup.


(Cliff) #592

Hey Scott,
You BMS design works exactly the same is mine.
My hardware is slightly different though. I’m using ATTiny13A and isolating each serial line with a standard transistor based opto-isolator. My serial is bit-banged since the 13A doesn’t have a uart.

(stuart) #593

Bizarrely I’ve been thinking along the same lines - thanks for the info - great minds think alike :slight_smile:

(Vela Nautica) #594


The guys from 123SmartBMS do the same, they use daisy chained cell boards…


(Vela Nautica) #595

Hi Stuart,

I came about that the files like loader.js and others are dynamicaly loaded from online sources.

But what if the BMS is offgrid and offline? The site does not load.
I thought about placing these files in SPIFFS, but as I know its very slow… an other problem will be the graph that is online generated, right?

What was your thought about this?

kind regards Oliver

(stuart) #596

That was a conscientious design decision - the assumption is that the system is “online” hence the need to load external libraries, the ESP’s are good devices but not great for storage or web serving!

You could host the library files from a raspberry pi that’s on the local network rather than github if thats easier.

I actually load the files on my desktop PC in chrome browser and point them to load the data from the ESP.

(stuart) #597

Not seen that company before, looks like a reasonable product.

I’m sort of feeling now that my work is done as there are plenty of other designs about that I’d be emulating - however happy to have a go if folks want me to!

(Vela Nautica) #598

Hi stuart!

The big advantage of your project is: it´s homemade and there are lots of possibilities to go and to custom design the software.

Much better than a comercial product, they can´t offer that.

It´s a very good project, thanks for sharing.


(stuart) #599

If I change it now though, I’m likey to just to emulate the work @ebsol and @scttnlsn have already done!

(Vela Nautica) #600

I think the existing concept is good and can get just some refinement.
The comments you got above from other guys sound like that to me.

just go your way.


(Chaveiro) #601

Why not upgrade the MCU to one with hardware UART? It increases the robustness of the design a lot.
Eg. ATTINY402 is cheaper has 4x more flash, ram and has UART, plus other things

(Vela Nautica) #602

Hi Stuart,

I found a way to provide the .js and dynamic files.
I connected a SD card to an ESP32 and stored the files there. its fast!
It builds the pages up in no time.
And additional there is now 16Gb of storage for log files :smile::smile::smile:


(stuart) #603

The downside to this method is that when changes are made on github, you won’t see them until you refresh the SD card.

(Vela Nautica) #604


anyway my BMS will stay in an OffGrid environment, so there is also no internet around all the time.
Updates need to be done manually.

I found an issue in the software, maybe thats also infuencing the i2c bus.
There is following code 4 times in mail loop of the controller firmware:


This code makes the ESP unreliable. In my case the upload of .js links worked only random.
All kind of background services run by ESP are influenced by it,
it is imported from AVR Arduino but not adviced for ESP.


(Brett) #605

almost compleat 12 modules only fuse im waiting on and now starting to make cables.
Whats the ampage one the 4pin side of the module ?

(stuart) #606

Tiny, thats just the i2c data lines + power for the other size of the ADUM chip - about 5mA per module.

(stuart) #607

Don’t get rid of the yield() function on the ESP - potentially the delay is too large - remove or reduce down to 10ms or similar.