Workaround / CAN MITM for a 2011 battery in a 2012 Leaf

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

than

New member
Joined
Jul 3, 2019
Messages
2
I have a 2012 Leaf, and I recently installed a 24 kWh battery pack... that I thought was also 2012. Overall, the car works great (and its nice to get some range back). But annoyingly, the car now seems to turn on the 12V charger and over-charge the 12V battery, while blinking the right-most (looking at the car from in front) blue charging light on the dash and running the Onboard Charger (OBC) coolant pump. My guess this is because my Leaf has the cold weather package, but the battery doesn't have a heater!

I have built an Arduino-based CAN bridge (see details below), and collected logs from the car and EV CAN buses. Clearly, there has to be something different about the messages coming from the battery, and I suspect 1472 (5C0).

I contacted Dala, and he suggested that it could probably work, and that I should make a post here to ask for advice. Before diving into details, my current status is:
* The CAN bridge works (I do drop messages occasionally, but the EV CAN seems robust to it)
* I'm playing with different manipulations of the message (see the code below)
* I've found that if I power-cycle the Leaf (press the on button three times, fairly quickly), then the OBC will shut off
* When turning off the car normally, sometimes the OBC runs for a few seconds and then shuts off... but often it doesn't, or actually starts back up several hours later
* When plugged in to charge, the OBC pretty much always seems to stay on afterwards
* If I interrupt the message flow, the OBC shuts off (maybe this suggests a crude alternative method: monitor the charge state, and then briefly interrupt the message stream once fully charged to trigger shutdown)

My main questions:
* Does this seem doable? Or is there some fundamental wiring harness issue that I don't know about?
* What message bits do I need to manipulate and in what ways!?

Thanks!

Message details (5c0):
Here are *all* the unique 5c0 messages (for the mux value for minimum) from Dala's log file (https://raw.githubusercontent.com/dalathegreat/EV-CANlogs/main/Nissan%20LEAF/24kWh/AZE0w24kWhstock.log), compared with some random other person's I found, compared with one of mine.
Code:
                         	XX – mux (min/max/avg)
                         	  X - Heat start mail send request
                         	   X - Heat stop mail send request
                         	    XXXX - HistData_HighLow_Volt_Tim
                          	         XXXXXXX - HistData_Temp_WakeupPhase
                         	                X - Batt Heater mail send request (???)
                          	                  XXXXXXX - HistData_Temperature
                         	                         ?
                          	                           XXXXXXXX - HistData_IntegratedCurrent
                          	                                    XXXXXXX - HistData_Degradation_IR
                         	                                           X - Heat Exist (if equipped with heater)
                          	                                             XXXXXX - HistData_Cell_Voltage
                         	                                                   ?? ???
                          	                                                         XXXXX - NextWakeupTimeForHeater
                          	                                                               XXXXXXXX - DiagTroubleCode
0x40 60 60 00 c9 10 04 0c	01000000 01100000 01100000 00000000 11001001 00010000 00000100 00001100
0x40 60 60 00 c9 10 04 0f	01000000 01100000 01100000 00000000 11001001 00010000 00000100 00001111
0x40 60 60 ff c9 10 04 0c	01000000 01100000 01100000 11111111 11001001 00010000 00000100 00001100
0x40 60 60 ff c9 10 04 0f	01000000 01100000 01100000 11111111 11001001 00010000 00000100 00001111
My message:                    	01000000 01111000 01111000 00000000 01000010 00001000 00000000 00000000
Random person’s message:  	01000000 01011010 01011010 00000000 01110101 00000100 00001100 00000011
Skipping a lot of details, my message is different (doesn't have the HeatExist bit set), as well as a couple of other messages, including the last few bits which are supposed? to be for Diagnostic errors.

CAN Bridge Details:
- Due to chip shortages, I wasn't able to find a cheap board with 2 CAN ports, so I use 2x CANBed's ($20 each), and bridged their serial lines
- https://www.longan-labs.cc/1030008.html

Code details:
- https://github.com/thandal/leaf_can_mitm/blob/main/CANBed_relay/CANBed_relay.ino
 
Just following up: this ended up working fine. I actually only needed to override one field in the 0x5C0 message:
packet.buf[6] |= 0b00011111; // set LB_NextWakeupTimeForBatteryHeater
 
Wow, cool project! Using an Arduino certainly makes the hardware more accessible.

What were Dala's thoughts about using an Arduino vs the CAN bridge designed by Muxsan (Emile Nijssen)? Is Dala considering porting his custom firmware over to the Arduino platform?
 
Back
Top