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

Reading Battery Voltages and Temperatures via CAN on Model S

This site may earn commission on affiliate links.
We've sold a fair number of our SavvyCAN for Tesla Model S http://store.evtv.me/proddetail.php?prod=TeslaCANKit&cat=28. But this tends to be for the real deal geeks out there that want to log off and analyze CAN message traffic primarily from the Drive Train CAN bus.

However, Arthur Hebert provided us a pretty rough but definitive description of a Tesla BMS CAN message ID 6F2. This message is sent in a sequence of actually 32 sequential messages indexed 0x01 through 0x1F in byte 0that form a very interesting matrix. The remaining 7 bytes form a bit-packed matrix listing ALL the 96 individual cell voltages in the battery pack as well as 32 temperatures - two temperatures for each of the 16 modules in the Tesla Model S battery pack. These are 13-bit values that appear to be really quite accurate. We consider Tesla's BMS a pretty authoritative source for this sort of thing.

So We've kind of quickly coded up an Arduino program to print this information out calculating the voltage of each module, total pack voltage, average pack temperature and of course the 96 cell voltages via the Serial USB port on the device to easily read on a laptop.

Cellvoltagesdisplay.jpg


This is a free download, open source. Should run on any Arduino Due with CAN shield though it does use several of Collin Kidder's libraries to do the magic. With our SavvyCAN for Tesla Model S, it basically lets you just plug it into the diagnostics port located behind the tray below the center console and display it on a laptop.
Perhaps in the future we (or someone) will port this to a similar device with a display screen on it.

In this way, a wider less technical group of Model S owners will still be able to check out their individual pack voltages and cells or watch them come up as they are charging. And it serves as kind of a learning experience for those interested in CAN messaging on the Tesla Model S. You can examine the code to see what was done.

I'm attaching the source code for the program. http://media3.ev-tv.me/TeslaModelSPackVoltages.zip

Jack Rickard

 
  • Like
Reactions: David99
Awesome. Great stuff. Might be getting ahead of ourselves here, but it would be nice if eventually we could replicate the thermal diagram. Also, how does the car spit out CAC? Is that a value derived from the BMS?

Well yes, this is a quick and dirty that spits out ASCII text through thte USB port of an Arduino Due. If you want to glam it up, a 5 inch LCD display would do nicely.

CAC? Not sure what you mean there. You can toggle debug by entering a D and actually see ALL the CAN messages appearing on the bus. Or toggle it back off and just view the battery data. It is updated as 6F2 messages show up on the bus.

Jack

- - - Updated - - -

Awesome Jack, I was trying to map the bits to actual voltages but with lack of time. Good job!

- - - Updated - - -
Bits mapped. See the source code. It's all good.
 
Does anyone know the difference between T1 and T2? Are those 2 measurements at different locations in the module? Top & bottom location? Other group of cells in the module? Just curious...

There are two temperature sensors on each module, each is on a cell that is close to one end or the other of the liquid cooling loop. One is the inlet the other is the outlet, but which is which seems to vary depending on physical position in the pack.
 
  • Informative
Reactions: David99
We've sold a fair number of our SavvyCAN for Tesla Model S http://store.evtv.me/proddetail.php?prod=TeslaCANKit&cat=28. But this tends to be for the real deal geeks out there that want to log off and analyze CAN message traffic primarily from the Drive Train CAN bus.

However, Arthur Hebert provided us a pretty rough but definitive description of a Tesla BMS CAN message ID 6F2. This message is sent in a sequence of actually 32 sequential messages indexed 0x01 through 0x1F in byte 0that form a very interesting matrix. The remaining 7 bytes form a bit-packed matrix listing ALL the 96 individual cell voltages in the battery pack as well as 32 temperatures - two temperatures for each of the 16 modules in the Tesla Model S battery pack. These are 13-bit values that appear to be really quite accurate. We consider Tesla's BMS a pretty authoritative source for this sort of thing.

So We've kind of quickly coded up an Arduino program to print this information out calculating the voltage of each module, total pack voltage, average pack temperature and of course the 96 cell voltages via the Serial USB port on the device to easily read on a laptop.

View attachment 107625

This is a free download, open source. Should run on any Arduino Due with CAN shield though it does use several of Collin Kidder's libraries to do the magic. With our SavvyCAN for Tesla Model S, it basically lets you just plug it into the diagnostics port located behind the tray below the center console and display it on a laptop.
Perhaps in the future we (or someone) will port this to a similar device with a display screen on it.

In this way, a wider less technical group of Model S owners will still be able to check out their individual pack voltages and cells or watch them come up as they are charging. And it serves as kind of a learning experience for those interested in CAN messaging on the Tesla Model S. You can examine the code to see what was done.

I'm attaching the source code for the program. http://media3.ev-tv.me/TeslaModelSPackVoltages.zip

Jack Rickard

Thanks so much for this. I am probably in the casual, less technical user group and would be interested to look at the battery data for my car. I have some experience with Arduino so feel I could put this together. I do have a few questions.
- Most of the Arduino CAN bus shields are 5volts and use the MCP2515/MCP2551 chip sets. Are these chip sets fast enough for the Tesla CAN bus 3?
- You specified Arduino Due (probably need the speed) but this is a 3.3v part so how is this interfaced with the CAN bus shield?

Looking forward to this project.
 
Jack, do you happen to know at what "Tesla SoC" your screenshot was taken? I see a cell voltage between 3.89 and 3.91 with 3.899V as the average.
What I have been trying to find out is at what "Tesla SoC" the cells are at 3.92V. I would like to set this SoC as my daily charge level when I don't need the range.

According to this article on the Battery University website: "In terms of longevity, the optimal charge voltage is 3.92V/cell. Battery experts believe that this threshold eliminates all voltage-related stresses; going lower may not gain further benefits but induce other symptoms."
 
What other symptoms does one experience by going lower?

I don't want to go too off-topic in this thread but I'll quickly provide this quote from the Battery University site:

"Li-ion in satellites must also endure a lifespan of eight years and more. To achieve this, the cells are charged to only 3.90/cell and lower. An interesting discovery was made in that Li-ion dwelling above 4.10V/cell tend to decompose due to electrolyte oxidation on the cathode, while those charged lower lose capacity due to the SEI buildup on the anode.
NASA reports that once Li-ion passes the eight year mark after having delivered about 40,000 cycles, cell deterioration caused by these phenomenon progresses quickly. Charging to 3.92V/cell appears to provide the best compromise in term of maximum longevity, but this reduces the capacity to about 60 percent."
 
Thanks so much for this. I am probably in the casual, less technical user group and would be interested to look at the battery data for my car. I have some experience with Arduino so feel I could put this together. I do have a few questions.
- Most of the Arduino CAN bus shields are 5volts and use the MCP2515/MCP2551 chip sets. Are these chip sets fast enough for the Tesla CAN bus 3?

In theory, yes. But, the big problem with the MCP2515/MCP2551 combo is that it is external to the processor. Any time a CAN frame comes in the 2515 has to signal the microprocessor to have it go fetch the frame. This tends to happen over SPI. SPI is fast but there is some latency involved in frames coming into an external chip, then signalling the MCU, then the MCU initiates an SPI transaction which reads the frame, etc, etc. The Arduino Due processor has everything but the transceiver built-in and so when it gets a frame the frame is already at the processor. It's then easy to go store it. This leads to an easier time of keeping up with high frame rates. Also, the faster the MCU the faster you can clock the SPI and deal with everything. ATMEGA chips aren't really all that fast and so it is possible to bog them down with all the external I/O. Long story short, it's easier to ensure you get all of the frames if you use something other than cheap shields and ATMEGA based boards.

- You specified Arduino Due (probably need the speed) but this is a 3.3v part so how is this interfaced with the CAN bus shield?

It isn't. The due uses a different (3.3v) transceiver and a different shield. You don't use the same shield as you'd use with an 8 bit ATMEGA Arduino board. EVTV sells two different types of devices for this. One of them (EVTVDue) is an Arduino Due but with the canbus transceivers and hardware all on the board already. It's a Due but it has CANBus. The other is an actual shield that sits on an Arduino Due and has two CAN buses and an SDCard.
 
In theory, yes. But, the big problem with the MCP2515/MCP2551 combo is that it is external to the processor. Any time a CAN frame comes in the 2515 has to signal the microprocessor to have it go fetch the frame. This tends to happen over SPI. SPI is fast but there is some latency involved in frames coming into an external chip, then signalling the MCU, then the MCU initiates an SPI transaction which reads the frame, etc, etc. The Arduino Due processor has everything but the transceiver built-in and so when it gets a frame the frame is already at the processor. It's then easy to go store it. This leads to an easier time of keeping up with high frame rates. Also, the faster the MCU the faster you can clock the SPI and deal with everything. ATMEGA chips aren't really all that fast and so it is possible to bog them down with all the external I/O. Long story short, it's easier to ensure you get all of the frames if you use something other than cheap shields and ATMEGA based boards.



It isn't. The due uses a different (3.3v) transceiver and a different shield. You don't use the same shield as you'd use with an 8 bit ATMEGA Arduino board. EVTV sells two different types of devices for this. One of them (EVTVDue) is an Arduino Due but with the canbus transceivers and hardware all on the board already. It's a Due but it has CANBus. The other is an actual shield that sits on an Arduino Due and has two CAN buses and an SDCard.
Great! Thanks for the detailed information.
 
Just going to crosspost a bit here:

Voltages start at 0.0V and are in increments of 0.000305V. No crazy formulas, as expected. Edit/update: Yep, looks like someone wanted a 0-5V range to fit in 14 bits.

Temperatures are similarly simple. 14-bit signed value, no offset, 0.0122C scaling. Gives a range from -100 to 100C

So, probably need an update to the released source to use this method, which is what the Tesla diagnostic screen uses.
 
Awesome Jack, I was trying to map the bits to actual voltages but with lack of time. Good job!

- - - Updated - - -

Just to others, this is the data we are looking at, visually:

View attachment 107634


Very nice.... so here is what I am seeing...

16 Battery Modules
2 Temperature Sensors per Battery Module, one reading coolant inflow temp and the other reading coolant outflow temp, subtracting the two gives us a delta... i.e. Module 7 has a 7 degree delta
6 Voltage reading for 6 cells per Battery Module... do we know how these cells are assigned to the Battery Modules? For instance is cells 1:6 in BM 1 and cells 7:12 in BM 2?

Can someone show a readout from a battery heating scenario and another readout for a battery cooling scenario?

That could be informative...

Also, how does one glean state of charge?

Also, do any voltages appear out of whack? for example too low? And what is that number or percentage?

Great work guys.

Impressed!
 
Have seen the diagnostic screen at 99% SOC and the battery on a 85 (D pack), when still doing its balancing.
The voltage on some cells had reached 4.2v and marked yellow, the lowest was 4.190 (marked green), the rest between there.
 
Does anybody know how cell equalization is handled, if at all, in the MS battery pack?

If the pack is being equalized, there might be 96 bits of data somewhere that
would indicate which cells are being discharged (or bypassed during a trickle charge).

Thanks for the cell voltage (and module temperature) information.

We hope to create a TMS Spy Lite app for Android (and iOS if the Android
app actually works), using a custom TDC to OBD adapter and an ELM clone
OBD bluetooth dongle. However message rate might be a problem for this
dongle, even though it does work with the LEAF's 500k CAN bus.

Try the free LeafSpy Lite app to see what was done for the LEAF.
No dongle or LEAF needed to try it.
 
  • Like
Reactions: GSP