TI BQ769X0 Based Monitors - Project thread

Mikethezipper

Member
Joined
Jul 7, 2018
Messages
121
Hey group,
I designed some boards for a 3-5s battery monitor and a 6-10s battery monitor. I used the clunky/awful easyEDAand ordered through their website, and I'll have the boards and components in about a week.
From there I'll solder it up (all SMD stuff) and report back on the success of this endeavor. I have a single board with the TI monitor chip and an esp8266 based controller on the board to read the data from the chip and broadcast it out via wifi or whatever - the board has room for additional headers if needed as output from the controller MCU.

As of now, balancing isn't on the same board as I wanted to take this problem one chunk at a time. I was going to do a separate board for balancing (controlled by the MCU on the monitor board), so I have connectors setup on itfor that but we'll see. Although the TI monitor chip does allow for balancing - I wanted to separate it out due to heat and current considerations - plus as I said, I'm taking it one step at a time.

Looks like some others on easyEDA have BQ76930 designs that'r pretty similar to mine (of course you only find these things out after you've finished) - the main difference being that mine allows for selecting cell count on the board instead of having to create external jumpers - also, they did a much better job :)
 

daromer

Moderator
Staff member
Joined
Oct 8, 2016
Messages
5,393
You can find many based on BQ769** Series. Even with ESP8266 included balancing and all.

I have done some too and some are on github
 

Mikethezipper

Member
Joined
Jul 7, 2018
Messages
121
Are there really? At face value there are many, but everything I saw upon closer inspection were many abandoned projects. What I'm aiming for is something that is well documented that will be an asset to the community. Right now the only option is an expensive option. Once I get past the stage of showing that it actually works, I'll share what I have. Until then I'll keep it to myself so there isn't yet another halfway finished project floating around in the web. Even better if they were made and sold since right now there are no options besides battrium or other industrial level solutions. For those of us living in smaller places like vans and RVs, it makes no sense to spend the needed $500 for a battrium system when all the panels and batteries alone don't even add up to that. Additionally, the projects I found that were in the advanced stages were geared towards much smaller packs than we use (ebikes etc) so their balancing circuitry was insufficient for our uses.
 

Mikethezipper

Member
Joined
Jul 7, 2018
Messages
121
Ok, I'm going to retract my "Won't share till it works" statement , I forgot I'm both not an EE, and not particularly smart.

image_ahyklf.jpg


I have shared the current existing diagram and board in EasyEDA - Note that I have immediately found issues with it - Primarily that the SDA and SCL should go to pins D1 and D2 - also, that I should hook up the Boot (aka T1 pin from the BQ chip) so that the MCU knows if the chip is even on (although I think Regout could do the same trick).

https://easyeda.com/mikethezipper/10s-batt-management-with-balancing

I also learned that the ESP8266 (or ESP8285) can't be powered by REGOUT from t he BQ chip - the datasheet says it should be able to do it, but it doesn't :( Also, generally best NOT to use the voltage regulator on the BQ chip if you can use a separate chip that can handle more power.
Also, there are ~ 7 different BQ76930 chips - different chips have different i2c addresses. I was unable to communicate with the chip until I did an i2c scan to figure out that the default 0x18 address is for every chip besides the one I got from LCSC.

When using the libresolar library, it would time-out the esp chip. I had to comment out the section for the bootcheck since it would just time-out the esp chip.
I will be updating the Github with the latest code:
https://github.com/mikethezipper/10s_Ti_BQ76930_BMS
Now I'm having trouble just generally communicating with the chip.


My test setup is an 8s holder hooked up, with the appropriate pins shorted for the BQ. The output is for some reason saying that the Overvoltage and Undervoltage are both tripped, even though that's not possible.

Hopefully I can figure it out on my own, but if anyone wants to help out, you can comment here or the Github.
 

Korishan

Moderator
Staff member
Joined
Jan 7, 2017
Messages
6,329
Is this testing by chance on a breadboard? If so, it'd possible for a loose connection on jumper wires, or they come out completely. I've had this issue and caused the above trip.

Can you still see the i2c address if you do a scan? If not, the ic might be fried
 
Joined
Aug 10, 2017
Messages
42
where did you find those pluggable screw connectors? i must have done a hundred searches in easyeda and on lcsc looking for those
 

Mikethezipper

Member
Joined
Jul 7, 2018
Messages
121
The testing was on the PCB. Since the PCBs were so cheap and breadboarding takes so darn long, I opted to just have PCBs made, with some extra pads to solder in jumpers n such when I found out how I screwed up :)
Last night I made some more progress - found out what was wrong. Now I"m having issues getting voltage readings (it communicates with chip and has no errors). When I have it read voltages for the individual cells or the pack it just responds with a 0. The ADC is shown as energized and active.

If you open the EasyEDA project they should be in there - they are made by Dinkle - the worst name I could ever imagine. If you just go to connectors, set it to Dinkle only, 1 row, 6 positions - they are in there. The BOM isn't complete because it doesn't show the extras like the male side of the connectors or the jumpers I had to use, so I'll see if I can share the BOM I ordered. I feel ya though, I spent forever searching for connectors on there.

Also EasyEDA screws things up in the BOM. For example, they didn't concatenate all parts of the same PN, so I had multiple orders for the same part number, each of which didn't reach the minimum order qty - so they put in three separate orders for the same capacitors (qty 2 each with a min of 50) and were trying to order 150 of these parts when I only needed 6 of them. Also, there is a lot of work to be done to get the BOM cost down.
Basically, the Dinkle connectors are almost three times the cost of the Chinese variants - but since I can't read Chinese and the datasheets suck, I wasn't sure if the male/female Chinese connector combo would actually work together. I meant to order a couple so I could switch to those, but alas, I forgot.

My goal is that if I can get the darn thing to just work as intended, I'll do another order of PCBs and components with everything fixed - and a separate set with boards for balancing. My first order alone was ~100$, so I think by the time this is all said and done I'm going to be at the bottom of a deep hole with a marginally functional BMS. My hope was that others who were interested could work with me and help me do a good job of documenting everything.

I think the cost of the final board will be around ~$3 plus ~$15 components. Hopefully we can get boards pre-populated by LCPCB since populating it and reflowing isn't super fun, and not in most user's list of things they want to deal with. Hopefully we can get a group-buy or something (although by then I'll have my board)

I really really really like the Libresolar BMS, my problems with it are: it has some documentation - just enough to get me excited, but too little for me to be able to adapt it to our needs easily. Also, it's onboard MCU isn't friendly for our uses. I want something that we can program via USB since most users don't want to have to have a separate programmer etc. I want it to be doable via the arduino IDE (I'm too ignorant to even know the correct nomenclature for this stuff).
 

Mikethezipper

Member
Joined
Jul 7, 2018
Messages
121
Just looked over the mbed library (there are two libraries from libresolar - one is for the arduino which is older, and the mbed version which is newer) - although it isn't directly arduino compatible, it has many added functions that are needed.
The first one that jumps out is auto detection of i2c address and whether CRC is required or not.
The arduino library requires one to manually adjust the i2c address and has no CRC support that I can tell. The mbed will basically automatically scan for the four possibilities (by writing 0x19 to the BQ) and then seeing if the settings used resulted in a successful read/write cycle.
Additionally it includes an SOC calculator (Need to double check that it's based on the max and min voltages) and some other goodies.

Cool stuff. I'll try and merge the two libraries tonight or tomorrow and put them into Github
 

Korishan

Moderator
Staff member
Joined
Jan 7, 2017
Messages
6,329
Looking over your EasyEDA schematic. Word of advice, make all your routes 90* angles. All lines should straight. This makes things a 'lot' easier to read and understand.



Why do you have D2? It's not in the TI schematic. What's the purpose of it? It connections Batt- with Batt+ bypassing all the cells.

Also, the connection between C6C and C5BC should go directly to VC5x. you have it going through the resistor R10
 

Mikethezipper

Member
Joined
Jul 7, 2018
Messages
121
Hey Kori,

I've mostly updated the schematic to have sharper corners :). D2 exists only because it was in the reference design from TI. I'll double check the connection to VC5x, but not too sure what the negative affect of having a resistor there would be.

I've been having issues communicating because the chips I got from LCSC require CRC checks on all data transmissions. The Libresolar library for ARM processors has built in CRC support, while the older arduino library does not. I'm working on migrating the CRC support into the arduino library. If I'm successful I'll see if I can update the libresolar library as I've seen a few requests for it.
 

Korishan

Moderator
Staff member
Joined
Jan 7, 2017
Messages
6,329
Kewls. I haven't done CRC coding, so I'm not sure what help I can be in that area. I'll need to do that when I move everything over to the stm32/esp32 platform, though.

A lot of times the resistors are used to limit current to the IC. However, it is possible to limit too much current, and the chip won't function as intended. Not saying that's going on here, though.

Schematic is definitely a lot easier to read now ;)
You have a broken trace between BattConn's and near D2, the green trace. Not sure if that is mirrored on the pcb side or not.
 

Mikethezipper

Member
Joined
Jul 7, 2018
Messages
121
Holy handgrenades.

OK so I've merged the CRC ability of the mbed library into the arduino library. This is just for write ops, as the BQ chip requires a good CRC to write to the registers, but when you read from the chip, you get the data and CRC - I just have it ignore the CRC bit for now.
The mbed library has a snip of code that basically keeps doing read requests from the bq chip until the CRC code the chip sends is valid - this is the safest way to do it, but it has no provision for what to do if it just permanently sends garbage data. (could easily be done with a while statement that times out after ten failed attempts for example) but I don't care about that right now.

I've updated the github link with the library I'm using. It's chock-full of debugging stuff since I was trying to trace my issues, but at least it's there for all to make fun of.

Kori, the broken link was because I moved wires around in the schematic to make it easier to see. The board and schematic are the same - no functional changes have been made yet.

I'm going to tinker around a bit more with it and try and get the code cleaned up as best I can. When I get to that point, I'll spit out another update and upload to github. I really like the mbed library since it's way more advanced and just better overall, but it has so many functions that are ARM specific it's gonna be a nightmare to convert it into an arduino-friendly library.
 

Korishan

Moderator
Staff member
Joined
Jan 7, 2017
Messages
6,329
The LTC is for active balancing circuits. The IC itself is more expensive than the BQ one, and then all the extra hardware to make the active balancing work will greatly increase the build cost.

Active balancing is only needed when using cells that regularly drift, or have a hard time staying in balance. If they only drift about 50mV or less during charging from highest to lowest, then active isn't needed.
 

Mikethezipper

Member
Joined
Jul 7, 2018
Messages
121
Well I guess that's a good point - what does the average powerwall user see as a current need in balancing?

That's the part I have no idea about. Would a normal powerwall user need the avg 50ma that most of the BMS are capable of, or will they need much higher currents? I assumed much much higher, hence why I want to take it off to another board and use 1W resistors .

And although active balancing is only needed for unbalanced packs - it's an interesting concept. I don't have the time to look into it right now since I have bigger fish to fry. And as Korishan says, there is a ton of supporting circuitry needed to make that chip do it's thing. Basically way way more complicated than passive, and shouldn't be needed.
 

Nikhil Mahajan

New member
Joined
Oct 2, 2017
Messages
13
hello everyone,
I'm also working on bq76920 bms.
after detecting the short circuit or overcurrent fault, what should be next logic. I'm thinking after short circuit or overcurrent is detected until we disconnect the load MCU won't turn on the MOSFET. is there any other method or logic for this ?. because if we connect this bms to some circuit and accidentally we short or overcurrent occurs we have to disconnect and connect again.
 

Mikethezipper

Member
Joined
Jul 7, 2018
Messages
121
Personally - I'd go for a manual reset button. Last thing I'd want is for it to automatically reconnect power for short circuit or overcurrent and lead to a fire.
Is there any reason to use the chip for overcurrent protection? Why not use DC circuit breakers? I'd trust those any day over the built-in function.
Also, what current loads are you trying to switch via mosfet?
 

Mikethezipper

Member
Joined
Jul 7, 2018
Messages
121
About darn time - I fixed the library for how it does voltage checks when it comes to CRC with the BQ chip.
Basically - the standard arduino library didn't support CRC - so when the library asked for the voltage readings, it was getting CRC data from the BQ chip and thinking it was actual voltage data and converting that into a reading. Ergo, the original library when used with a CRC chip was spitting out garbage readings and it had no idea.

I added CRC functionality so that it will only use actual voltage readings - and if the CRC is bad, it'll throw up a message for bad CRC and not update the voltage readings. for proper robust CRC implementation, it'll need some extra checks, but for now it's working to get readings.

Anyways, checkout the Github - I put in the latest library there. https://github.com/mikethezipper/10s_Ti_BQ76930_BMS

I have 8 cells hooked up and here are the readings:
cell 1 voltage: 3937 Multimeter says: 3.95
cell 2 voltage: 3939 Multimeter says: 3.96
cell 3 voltage: 3939 Multimeter says: 3.96
cell 4 voltage: 45 Multimeter says: N/A
cell 5 voltage: 3934 Multimeter says: 3.96
cell 6 voltage: 3894 Multimeter says: 3.91
cell 7 voltage: 3895 Multimeter says: 3.92
cell 8 voltage: 3897 Multimeter says: 3.91
cell 9 voltage: 45 Multimeter says: n/a
cell 10 voltage: 3891 Multimeter says: 3.90
Batt voltage: 31334 Multimeter says: 31.3

So cell 4 and 9 are just jumpers - they are fake readings that we'll need to deal with later. But for now I have what I've been looking for .. for so darn long - something that'll just tell me what the friggin voltages are per cell/pack. Now that this is good, I can start looking at everything else.
Next it'll be fixing up some of the other library functions and making the library fit a bit better for powerwall needs.
Then Itll be setting it up for under / over voltage protection - then balancing. I'm realizing now that I don't have good data output to auto switch latching relays using just this board. Right now that info would have to be streamed and another board would have to switch relays etc - Not ideal, so I'll be working on that next.

Does anyone really even care about this project? I'm wondering if the effort I'm putting into sharing this is even worth the effort. My end desire is stated in my OP: open source arduino-based BMS for the powerwall community - a more DIY version than a battrium - but also much cheaper and more expandable for certain uses since everything is open.
My hope is that this would be a community based project. There are other aspects I know nothing about and will need help with to make this into a really cool full-featured system. Namely: I can trip my way through hardware, but when it comes to using a rpi to graph and display the data in a useable way - it would be way easier if someone with that existing knowledge pitched in. I just spent a week reverse engineering a bunch of code and learning a ton to just figure out how to implement CRC into i2c comms on arduino (which apparently not many people have done, and the other solutions I found didn't work for this chip) . When I work on the code, I'm putting in a ton of comments on what the sections do and how they work. Some people think this is bad form, but at least the next person working on it will understand why something is there and how it was supposed to work.

I started this because I saw a ton of people noticing the BMS gap and trying to startup a project all on their own. Well now there is code and a board and schematic and BOM that work - all with a pretty low cost.


Forgot to mention - Since I'm looking for collaborators:

Now that I have figured out the first step on this and what sort of updates I need to make to the board to make it more useful...
I will be ordering new boards and components for said boards.

When I do, I will ship the boards / components at cost to anyone looking to collab on this. I'm noticing that there are at least 2 other motivated people on this board working on BMS's - I don't see the point of everyone working on separate projects. What it ususally results in is 3 dead projects that never really went anywhere. If nobody wants to collab, I might just join another BMS developer and try to help them
 

gpn

Active member
Joined
Jan 21, 2018
Messages
220
I would love to collaborate but I don't have the ability. I'm happy to beta test! I have a 7s portable battery. Would be sweet to pull up some data on charge level and have an output relay to turn a victron bp-100 on and off. Not too worried about the balancing side as I have an active balancer already. But OVP, UVP that activates a BP-100 would be awesome! And be able to see cell level charge as well.

Good work so far!
 

Mikethezipper

Member
Joined
Jul 7, 2018
Messages
121
Hi GPN, I don't really think beta testing would have any point right now considering how useless this system is at present. I'm going to be working on adding balancing and OV/UV protection first - and from there adding current monitoring. When those subsystems are in place is when I think it'd make more sense to look at shipping units.

What is nice to have now is input in how such a system would be used by people such as yourself. Even bringing up your desire for using it to switch the Victron BP-100 was helpful to see how I can make sure to keep that sort of stuff in mind as I move forward. I was looking at doing OV/UV protection by tripping a breaker that sinks 24V - which is different than how the BP series works - it shorts two wires. So one of them needs a relay/mosfet to send power to a breaker, the other can just use a relay/mosfet to close a switch and doesn't require extras for having a 24V source.
 
Top