Dala's Leaf buildthread (2015 Nissan Leaf)

Omien autoprojektien esittely.
User avatar
Dala
SUPPORTER
SUPPORTER
Posts: 240
Joined: 14. Oct 2014 19:39
Location: Vaasa

Re: Dala's Leaf buildthread (2015 Nissan Leaf)

Post by Dala » 30. Aug 2019 13:46

Tuopponen wrote:
30. Aug 2019 07:04
Very interesting... :geek:

I'm just wondering if you or someone has been thinking of some performance upgrades for electric vehicles. :)
Could it be just so simple that you increase the amount of battery cells in series to increase voltage and then just program the cars EV-system to understand this upgrade. Of course the voltage increase cant't be that big without changing more parts like cables, motors and maybe inverter (not sure what drives the motors).
The motor control systems just might be little bit complex so that this isn't a plug'n'play procedure.
But as always people want faster cars. :D
Ofcourse performance can be increased 8-)

But not in that way. The Leaf (and most EVs) are torque controlled. Voltage does not really matter for the power output, it is regulated by allowing a certain amperage to flow to the motor. So to increase power output, you simply modify the message containing the N⋅m demand.

The motor control is much SIMPLER than a traditional ECU controlling an internal combustion engine. So a real easy way to increase the power output of a Leaf is also via a CAN-bride hooked up to the CARcan. A simple program would be to do
if(pedal_pressed => 100%)
power = power+10kW

The next limiting factor is the motor inverter firmware. The maximum rating is 130kW (The leaf runs at 80kW stock).

Oh, and you would also maybe want to upgrade the fuse in the main battery pack at some point :D

It will be awesome when people actually start getting the hang of tuning electric cars, they are so fricking fast! Even the stock Leaf has 250NM of torque from 0-60km/h, really packs a punch!

User avatar
Tuopponen
SUPPORTER
SUPPORTER
Posts: 141
Joined: 24. Jan 2015 19:16
Location: Seinäjoki

Re: Dala's Leaf buildthread (2015 Nissan Leaf)

Post by Tuopponen » 30. Aug 2019 14:04

Dala wrote:
30. Aug 2019 13:46
Ofcourse performance can be increased 8-)

But not in that way. The Leaf (and most EVs) are torque controlled. Voltage does not really matter for the power output, it is regulated by allowing a certain amperage to flow to the motor. So to increase power output, you simply modify the message containing the N⋅m demand.

The motor control is much SIMPLER than a traditional ECU controlling an internal combustion engine. So a real easy way to increase the power output of a Leaf is also via a CAN-bride hooked up to the CARcan. A simple program would be to do
if(pedal_pressed => 100%)
power = power+10kW

The next limiting factor is the motor inverter firmware. The maximum rating is 130kW (The leaf runs at 80kW stock).

Oh, and you would also maybe want to upgrade the fuse in the main battery pack at some point :D

It will be awesome when people actually start getting the hang of tuning electric cars, they are so fricking fast! Even the stock Leaf has 250NM of torque from 0-60km/h, really packs a punch!
Oh, always learning something new. :)
For some hybrid cars this would also be very fun to try, increasing the electric motor assist for like short period of time by some parameter or like facelift Honda cr-z a button for short time "boost".
I can imagine a leaf going from 0-100 km/h in 5 sec. :lol:
We'll see where this electric vehicle boom will go.
-Honda Civic EJ8 -97 B18C Projekti/Kesäauto
-Honda Civic MB6 -97 B16A1 tekeillä
-Honda CR-Z -13 Käyttis
-Instagram

User avatar
Dala
SUPPORTER
SUPPORTER
Posts: 240
Joined: 14. Oct 2014 19:39
Location: Vaasa

Re: Dala's Leaf buildthread (2015 Nissan Leaf)

Post by Dala » 30. Aug 2019 19:57

I've got good progress on the instrumentation correction!

24kWh has ~280 gids full, 30kWh has ~360 gids full. After modifying the 0x5BC CAN message, and adding 70gids, the 24/30kWh bruteforce battery is atleast doing two things correctly now!

Image
As you can see, it now reports remaining km even when all the charge bars have disappeared. Before it just went '---'! Also it doesn't trigger Low Battery Warning(LBW) anymore at 16%, it instead triggers close to actual LBW!

Now only two things left to fix, the dash SOC is still showing wrong % values. Also the chargebars disappear way too soon. But progress is progress! :D

User avatar
Dala
SUPPORTER
SUPPORTER
Posts: 240
Joined: 14. Oct 2014 19:39
Location: Vaasa

Re: Dala's Leaf buildthread (2015 Nissan Leaf)

Post by Dala » 13. Sep 2019 20:08

I've been busy stomping bugs, here's a status update

Muxsan solved the CAN corruption issue that could occur every 6-12h. This was problematic, since it could cancel the charging session. Imagine setting your car to charge overnight and waking up to an almost empty battery! The fix supplied from Muxsan seems to work very well, so I am happy :)

Another bug I noticed, was the Low Battery Warning popup. It triggers at the correct place (>30%SOC), but since the SOC is estimated with a voltage lookup table, it was not very stable. During heavy acceleration, it could trigger the LBW, and upon releasing the pedal, the LBW faded away.

To solve this, I now put in the lowest of effort, an average function!
Image

The code snippet at the top saves the battery voltage (once every 500ms), and makes an average once 10 samples have been read. This should remove the heavy swings in the SOC-estimation. Let's see if I need something more elegant, but I like to keep things simple.

Speaking of simple, I just got a shipment of EVs Enhanced HV Battery Translator. These can do clean upgrades, for swapping in 30kWh packs into 2013-2015 Nissan Leafs. Essentially making my bruteforce method obsolete for this vintage of Leafs (and that is a really good thing!).
Image

I've been putting off touching the 40kWh pack, since Muxsan has gotten 40kWh packs to natively boot in a 24kWh Leaf. If it were possible to do a clean 40kWh swap with only the CAN-bridge, I would much prefer that compared to another 12h+ session of bruteforcing an upgrade.

User avatar
Dala
SUPPORTER
SUPPORTER
Posts: 240
Joined: 14. Oct 2014 19:39
Location: Vaasa

Re: Dala's Leaf buildthread (2015 Nissan Leaf)

Post by Dala » 24. Sep 2019 17:05

I've almost cracked the final messages that I need to perfect the bruteforce swap. I thought it would be good to share this information how to reverse engineer CAN messages. There are many ways to do this, but here is my workflow.

I started on the fine work already done by the community. There is a bunch of Nissan CAN message decodings already done, found in an excel here: https://docs.google.com/spreadsheets/d/ ... edit#gid=0

However, most of that information is related to early 2011-2012 ZE0 Leafs. So not all the information was applicable. Also keeping data in an excel document has its limits. So I downloaded Kvaser Database Editor 3, and started to create a proper CAN database that can be interpreted by engineering tools. Here is what that file looks like.
Image

Once the data is in a good format, you can more easily start to edit, format, test, playback logs etc. To analyze a CAN log-file, the workflow would be
1.Drive the car, capture CAN data with CANrunner running on a laptop (EV-CAN)
2.Get back in front of a computer, play back CAN data with CANrunner (on a virtual CAN channel)
3.Open XTM, import the database.dbc file you made
4.Start sniffing the virtual CAN channel, trend values, monitor etc.

Here is what XTM looks like
Image

As you can see, decoding CAN is not some black art, only lots of manual work staring at numbers and writing down changes overtime :D This info is applicable to any car newer than 2000ish, so you better get used to the future of car tuning ;)

User avatar
Dala
SUPPORTER
SUPPORTER
Posts: 240
Joined: 14. Oct 2014 19:39
Location: Vaasa

Re: Dala's Leaf buildthread (2015 Nissan Leaf)

Post by Dala » 29. Sep 2019 20:36

After analyzing the data with XTM, we found out that the 2015 Leaf behaves very differently compared to the 2011 model. The 0x5BC message is sent with 100ms instead of 500ms, and internally it has two multiplexes that decides the content inside it.

So to get the chargebars to move, you need to modify 0x5BC frame[2] bits4-7. The multiplex signal is inside frame[4] bits 0-3, which alternates between DEC 8/9. Here is a code snippet I used to test this out
Image

The end result can be seen here
Image

Kremilin
NORMAL USER
NORMAL USER
Posts: 75
Joined: 23. Jan 2012 19:51

Re: Dala's Leaf buildthread (2015 Nissan Leaf)

Post by Kremilin » 30. Sep 2019 04:02

Very nice! Cant do nothing less than cheer!

Kasvain
NORMAL USER
NORMAL USER
Posts: 26
Joined: 25. Dec 2016 19:55

Re: Dala's Leaf buildthread (2015 Nissan Leaf)

Post by Kasvain » 01. Oct 2019 18:08

Interesting project in this thread. I've learn alot of those posts, shows many basic EV things well, fun to see how these are made. :thumbsup:

User avatar
Dala
SUPPORTER
SUPPORTER
Posts: 240
Joined: 14. Oct 2014 19:39
Location: Vaasa

Re: Dala's Leaf buildthread (2015 Nissan Leaf)

Post by Dala » 08. Oct 2019 21:07

Thanks :)

So, here's something mechanical for a change. I noticed that this car had never had any proper periodic maintenance done on it. The service records in the book were empty! Let's remedy this.

The only thing that is in the periodic maintenance intervals are brake fluid flushes and cabin filter replacements. That's it! Reading the service recommendations is a real eye opener on how cheap it is to operate an EV.

I decided to upgrade the OEM DOT3 fluid to a DOT5.1 brakefluid.
Image

Bleeding the brakes on the Leaf is exactly the same as on any caliper equipped car. I flushed 1000ml brake fluid thru the system to guarantee that no DOT3 fluid would be left.
Image

Now I get to make the first stamp in the service book :) Since the weather is getting colder, I finished the job by putting on the winter tyres.

User avatar
Dala
SUPPORTER
SUPPORTER
Posts: 240
Joined: 14. Oct 2014 19:39
Location: Vaasa

Re: Dala's Leaf buildthread (2015 Nissan Leaf)

Post by Dala » 14. Oct 2019 22:03

I am soon going on a work trip to Australia but it was postponed one week, so I'm trying to do a quick sideproject until then.

It hit me that I need a way to read the battery health and stats from batteries not currently in a car. There are very pricey solutions already on the market, but I think I can make one for a fraction of the price. Might also learn something.

This is the B24 connector from a 2017 Leaf Battery. This is a proprietary 'Yazaki' connector that is extremely hard, if not impossible to source. I've removed this from the pack so I can more easily test and take measurements. 3d printing is the only sensible option here.
Image

Here is the pinout for the connector
Image

Now what we want is a way to connect the EV-CAN to an OBD2 port, and some way to power the whole thing with an external 12V battery. The battery only wakes up if +12V is applied to it. Will need to come up with some battery solution.

Here is the first 2013+ prototype printed.
Image

Now just to wait for the glue to dry and solder an OBD2 port on the other end!
Last edited by Dala on 19. Oct 2019 13:17, edited 1 time in total.

User avatar
Dala
SUPPORTER
SUPPORTER
Posts: 240
Joined: 14. Oct 2014 19:39
Location: Vaasa

Re: Dala's Leaf buildthread (2015 Nissan Leaf)

Post by Dala » 16. Oct 2019 20:30

The tire pressure warning system stayed on after I installed the winter tires. I ran the pairing procedure and that fixed it. But isn't the Leaf supposed to be able to keep two set of tires in memory?
Image

I made some changes to the .STL file. I only have the necessary pins exposed, making for a simpler to use connector. It also prints faster.
Image

I then connected everything else up to my 40kWh battery that is sitting in storage. I'm using an external 12V power supply to wake it up (both BAT and IGN!), and a Konnwei OBD2 bluetooth adaptor to pass it on to the phone.
Image

And here is the result! It works b-e-a-utifully!
Image

In the above screenshot, you can see that I put Leafspy into 'BMS only' mode via the service screen. This allows it to read only the data from the BMS, and not trigger a multitude of errors due to missing modules and signals. The battery sits at a nice 56% SOC, perfect for storage until I come back from my trip to Australia. SOH is also at a cool 95,9%, and the mV diff is only 14mV. In other words, this battery is in perfect health!

Now to make this into a how to and release the .STL files!

User avatar
Dala
SUPPORTER
SUPPORTER
Posts: 240
Joined: 14. Oct 2014 19:39
Location: Vaasa

Re: Dala's Leaf buildthread (2015 Nissan Leaf)

Post by Dala » 19. Oct 2019 13:18

Github page with instructions is now live for anyone wanting to make their own OBD2 cable! :D https://github.com/dalathegreat/Nissan- ... ry-to-OBD2

EDIT:
Also added the link to dalasevrepair.fi
Image

User avatar
Dala
SUPPORTER
SUPPORTER
Posts: 240
Joined: 14. Oct 2014 19:39
Location: Vaasa

Re: Dala's Leaf buildthread (2015 Nissan Leaf)

Post by Dala » 26. Nov 2019 12:33

Okay so I am back from Australia, and I've been going hard at the Leaf. Last weekend I undertook the big project of getting a clean 24->40kWh upgrade performed (2018 ZE1 battery into 2015 AZE0 chassis). Clean meaning no modifications to the battery, simply plugging in the 2018 40kWh pack into the 2015 24kWh chassis.

I've been cooperating with Muxsan to make this possible, and this is the thing I'm not allowed to spill all the beans on. But spoiler alert, it works B-E-A-utifully.

I started with installing the 40kWh battery in my Leaf. This is standard procedure by now, takes me ~2h to get it done. I took the opportunity to install the uprated fuse that came with the 40kWh pack, 250A? vs the stock 150A? (someone correct me if I'm wrong on the spec).
Image

To verify that everything was OK, I started the car. This resulted in the DTC P3102 - 'Invalid battery EVC-201', along with Check EV-System yellow warning light and the infamous turtle icon. Meaning the car would drive, but with a constant limp-mode. The Full-Service-Manual says that "Li-ion Battery ID Registration must be performed if the Li-ion battery controller or VCM is replaced.". It then goes on about using correct parts and methods, and tells you how to solve this with the unobtainable Consult+3 tool along with a special ID card that should be installed in the special Nissan approved Laptop. Since we don't have this, we'll handle it another way.
Image

So to fix this, you pull up a CAN log from when the car was working, and place it side by side with the new CAN data. Then it's just a matter of spot the differences, using the community CAN database as a reference. https://github.com/dalathegreat/leaf_can_bus_messages
Image

Then it's just a matter of using a CAN-in-the-middle attack on the bus, spoofing certain messages, dropping a few and voila! The car is booting successfully without error messages.
Image

I won't lie, there are some bugs, now it's time to test it properly and fix those as we go along. Still, extremely satisfied with the clean swap, it saves so much time compared to the brute-force method. I'll take working with software any day over hardware issues. I really like where the EV-tuning community is heading :)

User avatar
Dala
SUPPORTER
SUPPORTER
Posts: 240
Joined: 14. Oct 2014 19:39
Location: Vaasa

Re: Dala's Leaf buildthread (2015 Nissan Leaf)

Post by Dala » 04. Dec 2019 10:07

Here is a fun side-project

Ever since I started using the awesome 40kWh pack, it has been on the back of my mind to keep it in good shape. One if the best ways to keep a Nissan Leaf LMNO2 based battery in good state of health is to keep it cool. Since I can't affect the weather and Finland is quite cold all round the year, I started thinking about other ways to keep the health up. The second biggest factor when it comes to lithium battery life is to reduce the time spent at high voltage. You might have noticed this with your phone already, if you charge it during the night, it will sit at 100% for most of the night, accelerating degradation. To summarize lithium battery longevity;

1. Keep it cool
2. Reduce time spent at high voltage
3. For long term storage, store at really low SOC (25-35%)
More good reading here: https://www.electricbike.com/how-to-mak ... tery-last/

Funfact, the 2011-2013 24kWh Leafs had the option to charge to max 80%, but Nissan decided to remove it for 2013+ models. It didn't make much sense to limit the small battery-pack, but nowadays when we have bigger 30/40/62KWh packs, we do want them to last.

So how do we implement this #2 for the Leaf? It takes too much brainpower and effort to run an unplug the car at the desired max %, so I wanted a software solution. Of course this solution will be made with the Muxsan CAN-bridge, but first lets sketch up some user stories

1. The max charge % shall be set via already existing buttons on the Leaf (hidden functionality), so that no modification to the Leaf will be required
2. The setting shall be visualized on the dashboard, so that the user knows what he is configuring
3. The range should be in steps between 50%->100%, so that maximum battery life can be obtained

First thing is to figure out what buttons are available on the EV-CAN, where the CAN-bridge resides. I attached my laptop to the EV-can, and started mashing buttons. Unfortunately, none of the steering wheel buttons were available on the bus, so I had to settle with the HVAC system. I ultimately decided on a combination of two, the fresh air re-circulation button and fan speed. Here is what figuring out the fanspeed looked like.
Image

So my v1.0 program does a check if (recirc == ON && fanSpeed == 7). When these conditions are met, the capacity bars on the dash start to cycle thru all the available options. When the desired bar is illuminated, say 10/12, you confirm the selection by turning down the fan speed OR turning off recirc.

Here is a video of v1.0 in use, setting it to 10/12 = 83% max charge


Next step is to add longer delays (was tricky to set correctly with 1s delay), charge options all the way down to 50%, and make the dash charge% represent which selection you finally landed on (since it can be hard with only the capacity bars). I'll hopefully have some spare time this weekend to make it more user friendly.

Fingers crossed, this pack should last until 2030 now :D

User avatar
Dala
SUPPORTER
SUPPORTER
Posts: 240
Joined: 14. Oct 2014 19:39
Location: Vaasa

Re: Dala's Leaf buildthread (2015 Nissan Leaf)

Post by Dala » 04. Dec 2019 19:42

I am so satisfied with this software, so I'm launching it to my EV business :)

Image

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests