Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

In-development: Inexpensive Custom BMS for Tesla Battery Modules

This site may earn commission on affiliate links.
Testing section by section. Power portion of the master MCU works. Master MCU responds to programming commands. Each balancing circuit appears to work. Voltage dividers for cell voltage measurements appear to be correct. Nothing blew up when I hooked my test cells to it.

These are all good signs. :D

Edit: I did accidentally put the socket for U1 in backwards... oh well. At least it's a socket :p
 
Definitely have a lot of firmware work to do.

Polished up my master BMB MCU->sub-BMB MCU software-serial routines. Less than 20 instructions each for TX and RX (less than 80 bytes). So, small enough that I should be able to make a usable bootloader for the ATtiny24 that works through the master chip for in system programming. I made inline-asm versions for avr-gcc and I'm tinkering now.

Had it running an echo test of pseudo-random data using my custom comm functions for over an hour with 0% error rate. :D
 
Been working on this project off and on.

Today I'm trying to get a bootloader on to the 2KB ATtiny24A chips that will let me update the firmware on them via commands from the master chip.

Definitely tight fitting application code and a bootloader on to a 2KB chip! My bootloader is pretty big... like 800 bytes. lol. I'm sharing a few functions between the application code and bootloader using fixed location jump vectors in the bootloader code so that the application code can call the functions even if I update the bootloader later without changes to the application code.

Code:
Slave in bootloader mode.
Reading sig bytes: (F1) 1E A9 91 FF 0B
Reading fuse/lock bytes: (F1) 62 FF FE DF
FLASH read page 29: (1D F1) FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
Flash checksum: (F1) ED EA DB 61
FLASH write test page 29: Slave wrote FLASH page
FLASH read page 29: (1D F1) AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9
Flash checksum: (F1) 3D E2 9B 82
Slave exiting bootloader mode.

I have the master IC hooked to a USB UART for the moment for testing and running debugging code. So far so good. Can read/write pages of flash and EEPROM on the two slave chips. :) Definitely important, since I'll want to be able to update their firmware once they're in place without having to pull the chips.

I'm going to have to work on a bootloader for the master IC as well that works over the communication bus for the master ICs of all of the modules, but at least that's a slightly lower priority since worst case with those I can just jack a laptop into the ISP header and program them manually without too much trouble in the meantime.

Bunch on the TODO still for this project, but it's slowly coming together.
 
Someone needs to translate this thread into real world speak.

I have lots of questions but don't know how to phrase them intelligently so if anyone can jump in here and help me (and possibly others) out that'd be great.

1. What's the MCU and IC? I take it these are not the same acronyms that are referred to elsewhere on the forum.

2. 2 KB flash? Am I missing something? Why not beef it up?

3. Breakdown of the components on the BMB and what they accomplish would be great. Is this BMS sole function to balance the cells? Does it perform other tasks?
 
Someone needs to translate this thread into real world speak.

I have lots of questions but don't know how to phrase them intelligently so if anyone can jump in here and help me (and possibly others) out that'd be great.

Where's the fun in that? :wink:

1. What's the MCU and IC? I take it these are not the same acronyms that are referred to elsewhere on the forum.

The master MCU is the microcontroller unit (the square chip with ~32 pins in the upper left of my board) which is the main processor for each BMB. IC is just "integrated circuit" or chip. The slave MCUs are the 14 pin DIP (dual inline plastic, or the caterpillar looking chips).

2. 2 KB flash? Am I missing something? Why not beef it up?

Cost and inventory. I have a bunch of the 2KB units already (like, over 100) and that makes them essentially free. Plus doubling the flash almost doubles the cost, so, no need really. Just have to code to the metal byte by byte.

3. Breakdown of the components on the BMB and what they accomplish would be great. Is this BMS sole function to balance the cells? Does it perform other tasks?

Main tasks will be voltage monitoring (via the analog->digital converters on the two sub-MCUs) and balancing in an easily expandable network of BMBs. In this case I set things up so that I should be able to daisy chain them using basic CAT5 patch cables with RJ45 connectors and have them auto calculate their position in the chain. This way I can monitor all 216 cell groups in my stationary storage individually with decent accuracy and know the physical location of any cell group that might be an issue. The primary purpose of the whole setup is safety. This will ensure that no cell group goes too high or too low by interfacing with my charge controllers to cut power and enable the balance circuits as needed.

Should be awesome when I'm finally done.... lots of soldering and code to work on still.
 
I definitely underestimated the amount of time it would take to assemble these boards. :( I'm not going to admit to the amount of time it took to do these next five.

2015-10-22%2000.10.33-crop.jpg


Somehow I mis-ordered the part for my optoisolation chips without realizing. The chips are the same size as their DIP through-hole counterparts, but have surface mount feet. Fortunately that was easy to work around since with a little bend the feet fit in the through-hole spot and could be soldered from the top. I'll remember that for revision two of the board.

Think that's enough for tonight. Tomorrow I'll probably work on the master communication bus a bit more now that I have more boards assembled.
 
Digging up this thread from it's long slumber.

So, after spending far too much time trying to fix some issues with my initial design.... I decided to scrap the entire battery-isolated side of my original design and start over on it. :(

My original intention was to put to use mostly parts I had on my shelf already (so basically zero cost)... but a few issues and what would end up being very over-complicated firmware caused me to eventually scrap that idea. I've since redesigned the battery-isolated part of the board using an off-the-shelf battery voltage stack monitor, along with filtering and all to make it super accurate.

New design has been sent off for PCB printing, so hopefully have some prototypes up and running next week.

wkbmb2.04-pcb-3d.jpg


Lowered the complexity significantly, since the off-the-shelf chip only needs SPI to function. So, no firmware needed for the battery side of the board. Took the time to keep the board cleaner than my crazy prototype from before. Retained one of my key design features, which is the ability to chain them using off-the-shelf CAT5 patch cables and have them self-assign their address in the chain in order of the physical chain connection. :) Overall I've increased the cost of the components by about $25 per board from PROTO1 to PROTO2. *shrugs* Although, if the bulk of the parts from PROTO1 weren't essentially free, the component cost would definitely have been higher, with PROTO2 being less expensive from a BOM standpoint.

Once I get some prototypes done I'll do a final design with mostly surface mount components and get some assembled professionally to save me time getting my whole pack done.