Super Cheap Auto Castrol Edge Michelin Go Fast Bits Shannons Insurance Haltech Ryobi Century Batteries WD-40 KYB NTK NGK Spark Plugs

Announcement

Collapse
No announcement yet.

Dala's Leaf buildthread (2015 Nissan Leaf)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #76
    Continuing from the last post:
    The EVcan is available on the OBD2 port, on the nonstandard pins "CAN-L (12), CAN-H (13)"
    Pinout of the car OBD2 connector:


    To capture the CAN data, I use a laptop with an USB Kvaser Memorator Professional. Oh, and a 120Ω terminator.
    Last edited by Dala; 31-08-2019, 08:33 PM.

    Comment


    • #77
      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!


      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!

      Comment


      • #78
        That's a great fix, Dala!

        Btw, I read recently an article about charging to EV batteries to only 60% most times (when full charge isn't needed anyway) in order to increase the life expectancy of the batteries. Seemingly the recommendation has been to only charge to 80% most of the time, but there is now a school of thought that one should only charge to 60% (obviously provided that gives sufficient range for the driving you normally do).

        Would you have any thoughts on that? I'm only asking out of curiosity as I wouldn't have a clue about this subject....

        Comment


        • #79
          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!


          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!).


          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.

          Originally posted by Kaktus View Post
          That's a great fix, Dala!

          Btw, I read recently an article about charging to EV batteries to only 60% most times (when full charge isn't needed anyway) in order to increase the life expectancy of the batteries. Seemingly the recommendation has been to only charge to 80% most of the time, but there is now a school of thought that one should only charge to 60% (obviously provided that gives sufficient range for the driving you normally do).

          Would you have any thoughts on that? I'm only asking out of curiosity as I wouldn't have a clue about this subject....
          What you heard is correct. The Nissan already has a buffer reserved up top. If you charge it up to "100%", it's actually 94%. This is to increase the lifetime of the cells. You can ofcourse try to manually keep the SOC between 40-60% to increase lifetime even more, but on a car with just ~200km of range, IMO it's not really worth it. By the time the cells become degraded enough, it's just to buy and plop in a new upgraded battery and make the car into a 300-400km car instead

          Comment


          • #80
            Are you sure you need to add another 120 Ohm resistor when you connect to the OBD2 port? Given the CAN system only requires a resistor at each end, and the network is complete without your connection, surely you are adding a third resistor and dropping the resistance between the lines to 40 Ohms, rather than the intended 60 Ohms?

            Like you said, CAN is quite fault tolerant, I've forgotten to add a second resistor on occasion and not seen any detrimental effect, so it wouldn't surprise me if adding a third was also not a big problem.

            Comment


            • #81
              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...uwg/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.


              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


              As you can see, decoding CAN is not some black art, only lots of manual work staring at numbers and writing down changes overtime

              Originally posted by cubic_nz View Post
              Are you sure you need to add another 120 Ohm resistor when you connect to the OBD2 port? Given the CAN system only requires a resistor at each end, and the network is complete without your connection, surely you are adding a third resistor and dropping the resistance between the lines to 40 Ohms, rather than the intended 60 Ohms?

              Like you said, CAN is quite fault tolerant, I've forgotten to add a second resistor on occasion and not seen any detrimental effect, so it wouldn't surprise me if adding a third was also not a big problem.
              Yes, this is what all OBD2 dongles do. The CAN bus is not wired in series, so you don't affect any other nodes by adding (or lacking) a 120Ohm resistor.

              Comment


              • #82
                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


                The end result can be seen here

                Comment


                • #83
                  Hi Dala, this is very fascinating it has to be said, even though it is mostly gibberish to me at the moment.... There's a crowd in my neighbouring town who have recently started giving week-long hands-on EV conversation classes that I'm considering signing up for next year where they show in detail how to go about converting an ICE car to EV. This would be for covering all the basics, they also seemingly have follow-on courses for digging into CAN and all sorts of other black magic that comes with EV technology, so would definitely be both interesting and no doubt a steep learning curve for me.

                  Comment


                  • #84
                    Originally posted by Kaktus View Post
                    Hi Dala, this is very fascinating it has to be said, even though it is mostly gibberish to me at the moment.... There's a crowd in my neighbouring town who have recently started giving week-long hands-on EV conversation classes that I'm considering signing up for next year where they show in detail how to go about converting an ICE car to EV.
                    Highly recommend it! I actually held a guest lecture at the local university, talked about lithium batteries!

                    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.


                    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.


                    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.

                    Comment


                    • #85
                      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.


                      Here is the pinout for the connector


                      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.


                      Now just to wait for the glue to dry and solder an OBD2 port on the other end!
                      Last edited by Dala; 19-10-2019, 09:15 PM.

                      Comment


                      • #86
                        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?


                        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.


                        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.


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


                        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!
                        Last edited by Dala; 19-10-2019, 09:14 PM.

                        Comment


                        • #87
                          Github page with instructions is now live for anyone wanting to make their own OBD2 cable! https://github.com/dalathegreat/Niss...attery-to-OBD2

                          EDIT:
                          Also added the link to dalasevrepair.fi
                          Last edited by Dala; 20-10-2019, 12:18 AM.

                          Comment


                          • #88
                            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).


                            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.


                            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


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


                            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

                            Comment


                            • #89
                              Good work Dala, fascinating following your EV work albeit it's mostly gibberish to me!!

                              Comment


                              • #90
                                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 longetivity;

                                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-...-battery-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 batterypack, 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. Ofcourse 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 recirculation button and fan speed. Here is what figuring out the fanspeed looked like.


                                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

                                Comment

                                Working...
                                X