Leaf Gen2 Inverter As a Drop in Replacement for Stock
Posted: Wed Jan 24, 2024 7:55 pm
I had a customer request a drop in solution for their off road rig which could get them more power than stock. They are running a Thunderstruck controller and they don't want to have to rewire/reconfigure everything if they change back and forth between inverters.
I'll be the first to say - what Ive done to accomplish this for them isn't as safe as it should be, but this is an offroad rig.
One of the first things about the Gen2 Leaf adapter which doesn't make sense IMO is the location of the RUN pin. The factory Leaf enable pin lines up with the Out DCSW pin which isn't particularly good since that's usually got 12V coming into it. So since I wasn't using this, I cut the trace to the DCSW function and jumped the RUN pin over to this location.
I also threw together a quick 3d printed spacer for the mounting screws so the case wouldn't get charged to 5V because of the back plane.
That was pretty much all I had to do hardware wise.
Software was a bit more challenging. I couldn't use the latest firmware thanks to all the nice safety things that have recently been implemented with the throttle, so I based mine off of 5.27.R. I brought in the recently added support for Big-Endian can messages which was needed for the Leaf. The other issue was that the throttle output in reverse was 2's compliment. So I also added that to the throttle calculation.
The POT mapping ended up being: 468 27 -12 1
The CANIO mapping was: 468 41 2 8
For CANIO, the bits for forward and reverse are in the wrong order from what the Openinverter board expects, so you need to set dirmode to SwitchReversed.
The output messages representing the Leaf Inverter feedback can also be managed, but require Big-Endian support on TX which I haven't added yet.
In the end, this all works! Huge catch though, it randomly drops out and I'm not 100% sure why. I've noticed it will go into Neutral and the throttle will stop working until you let off completely and then press it again, which makes me think its a CAN Timeout issue, but I've had it happen with no error reported.
I'll be the first to say - what Ive done to accomplish this for them isn't as safe as it should be, but this is an offroad rig.
One of the first things about the Gen2 Leaf adapter which doesn't make sense IMO is the location of the RUN pin. The factory Leaf enable pin lines up with the Out DCSW pin which isn't particularly good since that's usually got 12V coming into it. So since I wasn't using this, I cut the trace to the DCSW function and jumped the RUN pin over to this location.
I also threw together a quick 3d printed spacer for the mounting screws so the case wouldn't get charged to 5V because of the back plane.
That was pretty much all I had to do hardware wise.
Software was a bit more challenging. I couldn't use the latest firmware thanks to all the nice safety things that have recently been implemented with the throttle, so I based mine off of 5.27.R. I brought in the recently added support for Big-Endian can messages which was needed for the Leaf. The other issue was that the throttle output in reverse was 2's compliment. So I also added that to the throttle calculation.
The POT mapping ended up being: 468 27 -12 1
The CANIO mapping was: 468 41 2 8
For CANIO, the bits for forward and reverse are in the wrong order from what the Openinverter board expects, so you need to set dirmode to SwitchReversed.
The output messages representing the Leaf Inverter feedback can also be managed, but require Big-Endian support on TX which I haven't added yet.
In the end, this all works! Huge catch though, it randomly drops out and I'm not 100% sure why. I've noticed it will go into Neutral and the throttle will stop working until you let off completely and then press it again, which makes me think its a CAN Timeout issue, but I've had it happen with no error reported.