Dala's Leaf buildthread (2015 Nissan Leaf)

Omien autoprojektien esittely.
User avatar
Dala
SUPPORTER
SUPPORTER
Posts: 120
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: 128
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.

User avatar
Dala
SUPPORTER
SUPPORTER
Posts: 120
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: 120
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: 120
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: 120
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: 66
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: 18
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: 120
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: 120
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.

I found a great starting point for the connector, WolfTronix over at https://www.diyelectriccar.com/ has made a template for the 2013+ connector. Note that the 2011-2012 Leaf use a different styled connector (21pin instead of 36pin)

Here is the first 2013+ prototype printed. I used dupont connectors as suggested on the diyelectriccar forum
Image

Now just to wait for the glue to dry and solder an OBD2 port on the other end!

User avatar
Dala
SUPPORTER
SUPPORTER
Posts: 120
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 found on the diyelectriccar forum. 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!

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests