Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Software for correcting instrumentation on a battery "bruteforce" upgraded LEAF. Example code integrated 30kWh cells using 24kWh original BMS. 30kWh swap

A word of caution

Battery upgrading a Nissan Leaf by opening it up and replacing the original LMNO2 cells with something else is always a bad idea. It requires great electrical skill, and takes a long time to perform. It is not a cheap solution compared to using OEM packs. It also compromises the waterproof seal present, so you have to rely on your glue-caulking skills to get it waterproof again. If the type of cells you are using differ to much from the original design (and they often will), you will get an isolation resistance error that will also illuminate the Check EV light on the dash. The discharge curve will also be different from the LMNO2 BMS, so the instrumentation will be whack. Good luck getting it thru inspections! If you use something else than Nissan cells you also risk having it catch on fire in the event of a crash, due to not using the OEM fasteners properly. The OEM battery is simulated to handle impacts gracefully. This is compromised once you throw something else there. The last and biggest problem is that it results in an overall unpleasant upgrade, due to the instrumentation issues. The charge bars will misbehave, the GOM will go dead too soon, causing you to drive WITHOUT any km-remaining for >100kms, and finally, fastcharging will not work over 21kWh of power. The code in this repository will alleviate some of the instrumentation issues, but it's not a ideal solution. This is the reason I made this way to upgrade obsolete, and only perform clean swaps. This is of no comfort to you if you already did this bruteforce upgrade, so here is the code that might make your life SLIGHTLY easier.

I accept the risks, how to proceed?

The attached code should run on an Muxsan CAN MITM Bridge (3-port, rev. 2.5), available for purchase here.

Take the .c file from this repository, and apply it to the Muxsan example repository. Compile and upload to bridge. Muxsan repository:

Attach the bridge on the EV-CAN running from the battery to the car. On a 2011-2013 ZE0 Leaf, an ideal spot is under the cupholders in the center console. On the 2013-2017 AZE0, the easiest spot to splice it in is behind the footwell LH side trim. (Add pictures?)

How do I modify the code for my usecase?

There is a parameter called 'EXTRAGIDS'. This define can be experimented with to suit your upgrade. For a 30kWh pack, 65 extragids worked quite OK.

What are the issues?

This code ONLY fixes the guess-o-meter estimate. That is the km/miles remaining value. The battery bars (12) are not properly translated, and will jump around a lot on the ZE0, but be a bit more stable on the AZE0. It also doesn't fix the %-SOC display on the AZE0. Another issue is that when the voltage drops low, the code switches to capacity left estimation using voltage. So the GOM value will jump a bit depending on how hard you press on the gas pedal. This only happens on low SOC, but can be maybe be solved by filtering the value some more. Try experimenting with that :)

Good luck bruteforcers!


Software for correcting instrumentation on a battery "bruteforce" upgraded LEAF







No releases published

Sponsor this project


No packages published