Gold Member
Posts: 2012
Joined: Mon Jul 19, 2010 8:34 pm
Delivery Date: 12 May 2011
Leaf Number: 002191
Location: San Jose, CA

Re: Active EV-CAN sampling: cell voltages, pack temperatures...

Thu Feb 08, 2018 3:50 pm

hubaksis wrote:Hi everyone,
I think this is the best topic to ask.
I found out that some values can be requested from a module only after setting it into diagnostic mode by sending a command 02 10 C0.

However, I can't find any details about this mode.
Can you tell me, does it have any expiration time? If so - is there a command to keep it active or just send another one 02 10 C0?
Do I need to exit diagnostic mode after I finished all requests?

I think it exits in about 1-2 seconds. 02 3E 01 will keep it alive if sent once a second. No harm in not exiting. It will timeout anyway.

Posts: 1
Joined: Wed Oct 25, 2017 6:16 am
Delivery Date: 25 Oct 2012

Active EV-CAN sampling: cell voltages, pack temperatures...

Wed Jul 04, 2018 1:57 am

Hello all,
Can some one post the request codes for VIN, DCQC count and L1/L2 count of 2012 leaf? I have already tried the 797 but not getting any respond on 079A.
Thank You.

Posts: 1
Joined: Mon Mar 25, 2019 1:47 pm
Delivery Date: 25 Mar 2018

Re: Active EV-CAN sampling: cell voltages, pack temperatures

Tue Mar 26, 2019 12:37 pm

GregH wrote:
garygid wrote:One long set of data from the BMS should be the estimated
cell (pair) resistances, derived from noting how much the
cell-pair's voltage sags when current is being withdrawn.

There might be another set of data indicating charging
resistances, derived from how much the voltage rises
when charging.
There are some odd sets of 10 x 16bit data in group 5.. no clue yet.
Also I'm guessing we might find some sort of counters in there for charge events so that the Nissan battery report can tell how often you've been plugging in at high states of charge or how often you've used QCs..
garygid wrote:Perhaps use F (x 10, so in tenths) = (C x 18) + 320
to display the battery temperatures?
It is increasingly looking like Nissan is NOT using a look up table for the non-linear NTC values but rather a set of linear approximations.. (edit-maybe)
So yes in the range of 18-24 degrees it looks like 10 steps per degree C.. but in looks like in the 12-17 degree range it's closer to 10.5 steps. I'm still filling in my temperature data table.. so far I have the following for temp transitions..

13 degrees starts at 589
14 degrees starts at 579
15 degrees starts at 569
16 degrees starts at 558
17 degrees starts at 548
18 degrees starts at 537
19 degrees starts at 527
20 degrees starts at 517
21 degrees starts at 507
22 degrees starts at 497
23 degrees starts at 487
24 degrees starts at 477
25 degrees starts at 467
26 degrees starts at 457
27 degrees starts at 447
28 degrees starts at 438
29 degrees starts at 428
30 degrees starts at 419
31 degrees starts at 410

<edit> If anyone has data below 13 or over 30, please share! :)
(btw as soon as the highest temp clicked over from 468 to 467, the 6th temp bar on the dash lit up. After resting it has gone down to 468 (24.9deg) and the 6th bar went away..)
probably Nissan connected an NTC thermistor in series with a fixed resistor, and sent the result to an ADC which is what you're seeing.
this is the proper way to do it but they might not have known:
https://en.tdk.eu/download/531110/a3be5 ... nnotes.pdf

Posts: 6
Joined: Tue May 17, 2016 5:31 am
Delivery Date: 17 May 2016

Re: Active EV-CAN sampling: cell voltages, pack temperatures...

Mon Jul 01, 2019 2:56 am

Hi all.
I have BMS 2013 in desktop bank with a connected battery. I can not start the shunt derivation. The leafspy current indicates 2147483.75A, the current sensor being disconnected. Can this influence that shunts shunts do not appear?
Turbo3, what are the minimum hardware conditions for the BMS to initiate derivation?
Thank you

Posts: 2
Joined: Sun Sep 01, 2019 9:57 pm
Delivery Date: 02 Sep 2019

Re: Active EV-CAN sampling: cell voltages, pack temperatures...

Mon Sep 02, 2019 9:21 pm

Is there sample code or a guide for collecting together the data to make a SoC value by communicating on CAR-CAN?

I've seen Gary and Jim discussing request/response on 797/79a for example but it isn't entirely fleshed out, except I suppose inside LeafSpy.

I found code in the forum here for reading a complete SoC on id 50D, but my car doesn't ever output anything on 50D.

I do love LeafSpy and I bought the pro version, but I'd prefer a full-time usb wired elm327 to something like a raspberry pi with a screen maybe. I've got an older Leaf that doesn't display a percent charge and I want to fix that.

Posts: 24
Joined: Tue Jul 16, 2019 10:38 pm
Delivery Date: 17 Jul 2019

Re: Active EV-CAN sampling: cell voltages, pack temperatures...

Thu Oct 24, 2019 10:05 pm

Please tell me whether it is possible to use the module LBC Leaf 2014 for autonomous operation in BMS mode? I want to use this module to control the voltage of 96 cells and emergency shutdown of the second battery if the voltage parameters exceed the critical values. Is it possible? I would also like to be able to balance the battery, but I'm afraid it's impossible

Posts: 28
Joined: Mon Sep 30, 2019 2:44 am
Delivery Date: 01 Dec 2018

Re: Active EV-CAN sampling: cell voltages, pack temperatures

Thu Mar 26, 2020 8:21 pm

TickTock wrote:
Fri Feb 22, 2013 8:37 pm
Thanks again Greg! Just finished coding it up. Here's the money-shot.
Just wonder if you code is online for others to share, looking at resuse of leaf parts so any help would be great.

Posts: 34
Joined: Wed Dec 30, 2015 1:19 pm
Delivery Date: 30 Dec 2015

Re: Active EV-CAN sampling: cell voltages, pack temperatures...

Sun Jun 14, 2020 2:36 pm

I have a 2012 BMS board (no car). If I were to hook up 48 cells to it, does the balancing happen automatically, or must I send a CAN message to turn on a specific shunt?

I would like to just have the BMS be a black box that I can poll battery voltages periodically from my motor controller and charger, and then have it take care of balancing.

Posts: 50
Joined: Tue May 21, 2019 9:56 pm
Delivery Date: 04 May 2019
Leaf Number: 019812

Re: Active EV-CAN sampling: cell voltages, pack temperatures...

Mon Jun 15, 2020 10:55 pm

Hi. Does anybody know how to collect battery id from EV-CAN (H/L pins, 12/13 pins from under-dash OBD2) with some Arduino + wiring?

Posts: 34
Joined: Wed Dec 30, 2015 1:19 pm
Delivery Date: 30 Dec 2015

Re: Active EV-CAN sampling: cell voltages, pack temperatures...

Fri Jun 19, 2020 7:32 am

GregH wrote:
Fri Feb 22, 2013 3:41 pm
So with a little help from TickTock and a friend at Nissan, we've been able to replicate some of the specific CAN messages used by the technician's scan-tool to read data from the Leaf battery management system.
First of course I should say that SENDING CAN messages to your Leaf (as compared to passively listening) could cause problems although most of the harmful writable data is usually protected with additional check-sums.
Anyway.. Proceed at your own risk..

What we're doing here is sending specific request messages asking for groups of data from the HV battery subsystem.
As best we can tell all of the requests from the scan-tool regarding the HV battery are sent on the 0x79b CAN ID with responses on 0x7bb. All packets are 8 bytes although sometimes not all 8 are utilized.
We've found 6 different groups of data...
Group 1 has 6 lines of data (precision SOC, Ah Capacity and perhaps battery State of Health %)
Group 2 has 29 lines of data and contains all 96 of the cell voltages.
Group 3 has 5 lines and contains the Vmin and Vmax as well as a few other things we haven't figured out yet.
Group 4 has 3 lines of data and contains the 4 pack temperatures.
Group 5 has 11 lines and again, not sure what it is yet..
Group 6 (discovered by Lincomatic) has 4 lines of data and contains the status of the resistive cell balancing shunts.

In order to read a group of data, first send the initial request command on ID 0x79b:
0x02 0x21 group 0xff 0xff 0xff 0xff 0xff (those last 5 bytes can be 0xff or 0x00, doesn't seem to matter, and yeah I tried group 0 and 6.. didn't see anything)

For example to request pack temperatures you'd start with
0x79b: 0x02 0x21 0x04 0 0 0 0 0

Which returns something like:
0x7bb: 0x10 0x10 0x61 0x04 0x01 0xfb 0x15 0x01

The first byte is an index (incremented on subsequent lines), the 2nd byte is a sort of group size, the 3rd byte is 0x61 (responding to the 0x21) and the 4th byte is the group number. The actual data starts on the 5th byte.
In this example the first temperature is a 3 byte value (16bit raw A/D and 8bit temp) 0x01fb 0x15 meaning 21 degrees C with the raw 10 bit A/D NTC thermistor value 0x1fb or 507 decimal. The start of the 2nd temperature is the last byte of the message.

To ask for additional lines of data, they must be requested within about a second of the initial request. In my software I ask for the 2nd line immediately after receiving the first and then ask for subsequent lines every 16ms or so.
The request additional lines command is
0x79b: 0x30 0x01 0x00 0xff 0xff 0xff 0xff 0xff

All subsequent lines will have an index in the first byte with 2 as the MS nibble and the lower nibble (4 bits) as the index.. The remaining 7 bytes are all data.
Such as:
0x7bb: 0x21 0xf8 0x15 0x02 0x06 0x13 0x02 0x0d
(ie the other 2/3rds of temp2, all of temp3 and the first 2/3rds of temp4)

In order to receive the last line, another 0x30 0x01 0x00 request is sent and for this example the response looks like:
0x7bb: 0x22 0x13 0x13 0x00 0xff 0xff 0xff 0xff
(giving the last byte of temp4.. not sure what if anything the extra 0x13 and 0x00 mean... maybe some check-sum)

In larger groups (cell voltages in group 2) the index byte continues 0x23, 0x24, 0x25 etc wrapping from 0x2f back to 0x20.

The cell voltages in Group 2 start with the 5th byte in the first line (just like the temps) with the first two cell voltages then subsequent lines contain another 3 and a half cell voltages on each.

0x7bb: 10 C6 61 02 0F D8 0F D4
0x7bb: 21 0F D0 0F D9 0F D0 0F
0x7bb: 22 CC 0F D3 0F D0 0F D0
I have a 2012 BMS by itself with batteries. I am using my own board, accepting standard SIDs, and sending standard SIDs. When I turn on the 12v power to the BMS, I am seeing IDs 475 and 475 sending their data very fast. I'm also seeing ID 1371 sending its data much slower, maybe 10 times per second, then there is ID 1468 and 1472. Those are done at about 2 times per second. One of those contains data for the highest thermistor temperature.

The BMS is not responding to the 0x79b commands. Any suggestions from anybody? Should my messages be using the extended identifier format of the CAN packet?

Return to “LEAF CANBus”