TMC is an independent, primarily volunteer organization that relies on ad revenue to cover its operating costs. Please consider whitelisting TMC on your ad blocker or making a Paypal contribution here: paypal.me/SupportTMC

Reading Battery Voltages and Temperatures via CAN on Model S

Discussion in 'Model S: Battery & Charging' started by jrickard, Jan 12, 2016.

  1. jrickard

    jrickard Member

    Joined:
    Sep 4, 2009
    Messages:
    52
    Location:
    Cape Girardeau Missouri
    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

     
  2. Kalud

    Kalud Member

    Joined:
    May 7, 2013
    Messages:
    999
    Location:
    Montreal, QC
    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:

    bms_with_data_2.png
     
  3. apacheguy

    apacheguy Sig 255, VIN 320

    Joined:
    Oct 21, 2012
    Messages:
    3,711
    Location:
    So Cal
    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?
     
  4. jrickard

    jrickard Member

    Joined:
    Sep 4, 2009
    Messages:
    52
    Location:
    Cape Girardeau Missouri
    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 - - -

    Bits mapped. See the source code. It's all good.
     
  5. Benjamin Brooks

    Joined:
    Jan 21, 2013
    Messages:
    443
    Location:
    San Jose, California, United States
    Very cool. What's the highest cell voltage reading you (or others) have seen @ 100% SoC?
     
  6. apacheguy

    apacheguy Sig 255, VIN 320

    Joined:
    Oct 21, 2012
    Messages:
    3,711
    Location:
    So Cal
    From the other thread, 4.15/4.16
     
  7. GDgreen

    GDgreen New Member

    Joined:
    Jan 21, 2014
    Messages:
    1
    Location:
    Bucharest
    For my car, checked in service, it was 4.182V
     
  8. jpet

    jpet Jan P.

    Joined:
    Aug 8, 2014
    Messages:
    3,288
    Location:
    Herne & Leuven, BE
    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...
     
  9. wk057

    wk057 Senior Tinkerer

    Joined:
    Feb 23, 2014
    Messages:
    4,722
    Location:
    Hickory, NC, USA
    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.
     
  10. mspohr

    mspohr Active Member

    Joined:
    Jul 27, 2014
    Messages:
    1,797
    Location:
    California
    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.
     
  11. jpet

    jpet Jan P.

    Joined:
    Aug 8, 2014
    Messages:
    3,288
    Location:
    Herne & Leuven, BE
    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."
     
  12. apacheguy

    apacheguy Sig 255, VIN 320

    Joined:
    Oct 21, 2012
    Messages:
    3,711
    Location:
    So Cal
    My guess would be that's right around 80%. I've heard the difference between 100% and 90% is 0.15 V; between 90% and 80% 0.1 V.

    What other symptoms does one experience by going lower?
     
  13. jpet

    jpet Jan P.

    Joined:
    Aug 8, 2014
    Messages:
    3,288
    Location:
    Herne & Leuven, BE
    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."
     
  14. TheBlackKnight

    Joined:
    Dec 20, 2015
    Messages:
    42
    Location:
    Michigan
    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.
     
  15. mspohr

    mspohr Active Member

    Joined:
    Jul 27, 2014
    Messages:
    1,797
    Location:
    California
    Great! Thanks for the detailed information.
     
  16. wk057

    wk057 Senior Tinkerer

    Joined:
    Feb 23, 2014
    Messages:
    4,722
    Location:
    Hickory, NC, USA
    Just going to crosspost a bit here:

    So, probably need an update to the released source to use this method, which is what the Tesla diagnostic screen uses.
     
  17. ArtInCT

    ArtInCT Always Learning

    Joined:
    Sep 2, 2014
    Messages:
    1,605
    Location:
    Southern Connecticut

    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!
     
  18. sigurdi

    sigurdi Member

    Joined:
    Jun 8, 2014
    Messages:
    252
    Location:
    Norway
    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.
     
  19. garygid

    garygid Member

    Joined:
    Aug 11, 2014
    Messages:
    612
    Location:
    Laguna Hills, Orange County, CA
    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 x 1
  20. apacheguy

    apacheguy Sig 255, VIN 320

    Joined:
    Oct 21, 2012
    Messages:
    3,711
    Location:
    So Cal
    Balancing is performed by small resistors on the individual module BMBs that bleed off excess charge.
     

Share This Page