Hi damian.lo, Have you tested CAN messages on the board yet? What program/hardware are you going to use to do this?
Leaf Gen 1 Inverter Board
- james@N52E01
- Posts: 144
- Joined: Wed Sep 18, 2019 7:02 am
- Has thanked: 2 times
- Been thanked: 3 times
Re: Leaf Gen 1 Inverter Board
Re: Leaf Gen 1 Inverter Board
No, for now no. It's waiting until I will win with v3 board + leaf adapter in my BMW 116. In practise it will be almost the same, because I want to take throttle signal and read by v3 board. I hope I will do this in this week.
For Damien's board I was thinking to use his sketch and modify this to read/write signals from my car. Look at this - at the end of program he wrote instrument cluster steering program. Unfortunately my programming skill is very far from Damien's so it will be longer period
If you need other info from me - feel free and ask here.
For Damien's board I was thinking to use his sketch and modify this to read/write signals from my car. Look at this - at the end of program he wrote instrument cluster steering program. Unfortunately my programming skill is very far from Damien's so it will be longer period

If you need other info from me - feel free and ask here.
- james@N52E01
- Posts: 144
- Joined: Wed Sep 18, 2019 7:02 am
- Has thanked: 2 times
- Been thanked: 3 times
Re: Leaf Gen 1 Inverter Board
Thanks damian.lo, good luck with the V3 board and I will send you a message if I get stuck.
- james@N52E01
- Posts: 144
- Joined: Wed Sep 18, 2019 7:02 am
- Has thanked: 2 times
- Been thanked: 3 times
Re: Leaf Gen 1 Inverter Board
Does anyone know the default voltage range for C1 and C2 throttle inputs on this board? I can’t find this information in the arduino code.
- Thatguyoverthere
- Posts: 34
- Joined: Fri Jun 28, 2019 5:04 am
- Location: California, USA
- Been thanked: 1 time
Re: Leaf Gen 1 Inverter Board
On the board, both throttle inputs are halved by a resistor divider, which accounts for the common 0.8V-4.5V output from most hall effect pedals. The ATSAM processor has a max 3.3v input for the Analog input pins (I believe). Note the digital inputs which are 12v in, but get resistor divider'd to approx. 3v. So you'll have to fiddle with the code to calibrate different throttle pedals, but just make sure whatever lands at the pin is under 3.3v.
https://github.com/kaelinwilson
Leaf Motor/Gen1 Camry Inverter
Leaf Motor/Gen1 Camry Inverter
- Cookie6000
- Posts: 247
- Joined: Wed May 08, 2019 9:27 am
- Location: Wicklow, IRL
- Has thanked: 12 times
- Been thanked: 33 times
- Contact:
Re: Leaf Gen 1 Inverter Board
Took a while but, got the board back from resoldering the microcontroller. Nice job too. Today I finished soldering the remaining items including wiring up and labelling the VCU connectors.
After that, I proceeded with getting on with the Arduino IDE with the board connected up. When I connect up my FTDI or Arduino Due, no problem. They setup just fine and you can see them. However, when I connect the Leaf VCU, I just get USB connection errors. I try and update drivers with no success. All drivers are up to date.
Damien M did say that there was the odd chance that a crystal could be reversed on the board as their orientation markings changed depending on manufacturer. Does this look like that or is it something more basic I am missing? Tried on two laptops now. Due and FTDI work fine, Leaf VCU not.
Home of the #Audi8e - https://twitter.com/FiachraCooke
- Jack Bauer
- Posts: 3661
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 10 times
- Been thanked: 335 times
- Contact:
Re: Leaf Gen 1 Inverter Board
The crystal is backwards. That Damien M guy sounds like a moron.
I'm going to need a hacksaw
- Cookie6000
- Posts: 247
- Joined: Wed May 08, 2019 9:27 am
- Location: Wicklow, IRL
- Has thanked: 12 times
- Been thanked: 33 times
- Contact:
Re: Leaf Gen 1 Inverter Board
Thanks JB. I'll be sure to tell it to his face next time I see him 

Home of the #Audi8e - https://twitter.com/FiachraCooke
- Cookie6000
- Posts: 247
- Joined: Wed May 08, 2019 9:27 am
- Location: Wicklow, IRL
- Has thanked: 12 times
- Been thanked: 33 times
- Contact:
Re: Leaf Gen 1 Inverter Board
Crystal flipped. Still nada. R2 and R3 are correct at 39ohm. Dilbert suggested checking as they might have been 3.3ohm.
Next step?
**EDIT - did a bit of a tidy up. small bridge. Can see it now on COM port 8... onto the next stage. As you were...
Next step?
**EDIT - did a bit of a tidy up. small bridge. Can see it now on COM port 8... onto the next stage. As you were...
Home of the #Audi8e - https://twitter.com/FiachraCooke
- Cookie6000
- Posts: 247
- Joined: Wed May 08, 2019 9:27 am
- Location: Wicklow, IRL
- Has thanked: 12 times
- Been thanked: 33 times
- Contact:
Re: Leaf Gen 1 Inverter Board
Good few nights this week to get where we are now. Followed arbers instructions flashing the ESP8266 via the FTDI board all the way down to the last line - connect your board to Johannes board...
Am I correct in saying that the Johannes web interface will work with the @evbmw Leaf VCU or have I missed a beat? Reason I ask, James (project Fig-leaf) and me have been working together to get to this point and where we see this when we both connect up our inverter and boards. No settings. Should we be doing everything through IDE or should http://192.168.4.1/ be working? All ready to go...
Am I correct in saying that the Johannes web interface will work with the @evbmw Leaf VCU or have I missed a beat? Reason I ask, James (project Fig-leaf) and me have been working together to get to this point and where we see this when we both connect up our inverter and boards. No settings. Should we be doing everything through IDE or should http://192.168.4.1/ be working? All ready to go...
Home of the #Audi8e - https://twitter.com/FiachraCooke
- Jack Bauer
- Posts: 3661
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 10 times
- Been thanked: 335 times
- Contact:
Re: Leaf Gen 1 Inverter Board
So folks where exactly did it say that I had implemented a fully featured interface for this thing using the inverter web front end? I think it's a really cool idea by the way but sadly my attempts to clone myself have been .... well.....messy so far thus I have not done so.
Now, it is your lucky day as I have just been doing some donuts in the grey goose and have posted a new firmware AND a Wifi display on the github. You will however have to wade through my feeble attempts at C programming to calibrate your throttle etc.
Now, it is your lucky day as I have just been doing some donuts in the grey goose and have posted a new firmware AND a Wifi display on the github. You will however have to wade through my feeble attempts at C programming to calibrate your throttle etc.
I'm going to need a hacksaw
- johu
- Site Admin
- Posts: 6713
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 369 times
- Been thanked: 1543 times
- Contact:
Re: Leaf Gen 1 Inverter Board
Is the VCU already using the STM32? If so I think it wouldn't take me long to port the firmware to "libopeninv" and thus make it fully compatible with the existing web interfaces (mine and Dimas)
EDIT: just checked - SAM3X so no easy porting
EDIT2: actually the vital parts are hardware-independent. Make some noise if you want me to tackle it.
EDIT: just checked - SAM3X so no easy porting

EDIT2: actually the vital parts are hardware-independent. Make some noise if you want me to tackle it.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
- Cookie6000
- Posts: 247
- Joined: Wed May 08, 2019 9:27 am
- Location: Wicklow, IRL
- Has thanked: 12 times
- Been thanked: 33 times
- Contact:
Re: Leaf Gen 1 Inverter Board
Soooo you're saying there's a chance....Jack Bauer wrote: ↑Fri Mar 27, 2020 6:33 pm So folks where exactly did it say that I had implemented a fully featured interface for this thing using the inverter web front end? I think it's a really cool idea by the way but sadly my attempts to clone myself have been .... well.....messy so far thus I have not done so.
Now, it is your lucky day as I have just been doing some donuts in the grey goose and have posted a new firmware AND a Wifi display on the github. You will however have to wade through my feeble attempts at C programming to calibrate your throttle etc.


How much noise do I/we have to make? How many evbmw boards are out there do you think at this stage JB? I know of at least 5 or 6 projects in motion or pending including mine that use the evbmw Leaf VCU. Probably more that have not revealed themselves yet. Let me know how I can help if any.
Home of the #Audi8e - https://twitter.com/FiachraCooke
- james@N52E01
- Posts: 144
- Joined: Wed Sep 18, 2019 7:02 am
- Has thanked: 2 times
- Been thanked: 3 times
Re: Leaf Gen 1 Inverter Board
Noise! Lots of noise!johu wrote: ↑Fri Mar 27, 2020 7:13 pm Is the VCU already using the STM32? If so I think it wouldn't take me long to port the firmware to "libopeninv" and thus make it fully compatible with the existing web interfaces (mine and Dimas)
EDIT: just checked - SAM3X so no easy porting
EDIT2: actually the vital parts are hardware-independent. Make some noise if you want me to tackle it.

- Cookie6000
- Posts: 247
- Joined: Wed May 08, 2019 9:27 am
- Location: Wicklow, IRL
- Has thanked: 12 times
- Been thanked: 33 times
- Contact:
Re: Leaf Gen 1 Inverter Board
Ploughed ahead and flashed the leaf vcu with the new firmware update as outlined below. Tricky finding the ISA.h libraries but found the zip file here in the end at the end of the page:
http://store.evtv.me/proddetail.php?prod=1kshunt
I found though when compiling, an error appeared referencing ISA2.h library Opened the .h and .cpp file that were causing the error and removed the '2' in 3 locations in the code and all ran fine then. I am a basic programmer but it made sense to me to do it. Correct me if I made a balls. Now I have a vcu newly flashed with all the updated features added complete with slower flashing led for ref.
After that, via the FTDI board, I flashed the ESP8266 as before -
1. Solder GPIO0 to 0
2. Verify code in Arduino IDE - Set - Erase Flash: "Sketch + WiFi Settings"
3. Flash code onto the ESP8266 - all good, flashing green led
4. Solder GPIO0 to 1 to seal bridge back for operation
All good. Connected the Olimex up to the board and the inverter. Powered up inverter and board. All flashing as it should.
Connect up the laptop to the WiFi module, check.
Question 1 - Not sure what I am looking for yet. Is there a separate IP address connect similar to 192.168.4.1? I don't see any in the code, only the html references here. Question 2- In the IDE, when I hardwire the VCU and open the Serial Monitor, I get Voltage info fed back on the screen. Should I remain on the Native USB Port or change to Programming port to send torque commands? Sorry for these questions that might seem fundamental. Learning this side of the build as I go. Thanks
http://store.evtv.me/proddetail.php?prod=1kshunt
I found though when compiling, an error appeared referencing ISA2.h library Opened the .h and .cpp file that were causing the error and removed the '2' in 3 locations in the code and all ran fine then. I am a basic programmer but it made sense to me to do it. Correct me if I made a balls. Now I have a vcu newly flashed with all the updated features added complete with slower flashing led for ref.
After that, via the FTDI board, I flashed the ESP8266 as before -
1. Solder GPIO0 to 0
2. Verify code in Arduino IDE - Set - Erase Flash: "Sketch + WiFi Settings"
3. Flash code onto the ESP8266 - all good, flashing green led
4. Solder GPIO0 to 1 to seal bridge back for operation
All good. Connected the Olimex up to the board and the inverter. Powered up inverter and board. All flashing as it should.
Connect up the laptop to the WiFi module, check.
Question 1 - Not sure what I am looking for yet. Is there a separate IP address connect similar to 192.168.4.1? I don't see any in the code, only the html references here. Question 2- In the IDE, when I hardwire the VCU and open the Serial Monitor, I get Voltage info fed back on the screen. Should I remain on the Native USB Port or change to Programming port to send torque commands? Sorry for these questions that might seem fundamental. Learning this side of the build as I go. Thanks
Home of the #Audi8e - https://twitter.com/FiachraCooke
- Jack Bauer
- Posts: 3661
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 10 times
- Been thanked: 335 times
- Contact:
Re: Leaf Gen 1 Inverter Board
So as we now seem to have a complete lack of understanding coupled with confusion as to how the Leaf VCU works i'll jump in here and try my best to explain. I hesitiate as it seems sometimes that for every answer I give two more questions pop up but here goes.
1) The Leaf VCU is designed to run a Gen1 or Gen2 Nissan Leaf inverter and motor in stock form via CAN messages. No inverter modifications are required.
2)The Leaf VCU DOES NOT operate with the openinverter WiFi interface.
3)A pinout for the connectors on the VCU is provided here : https://github.com/damienmaguire/Nissan ... Pinout.pdf
In order to configure the VCU to run your motor it is necessary to modify the software to accept your throttle input. The VCU provides for single or dual channel throttle pedals and in its stock for on github is configured for a BMW E46 hall effect pedal. In order to change this the subroutine responsible for reading the pedal input will need to be modified. Here is the routine :
void readPedals()
{
ThrotVal = analogRead(Throttle1); //read throttle channel 1 directly
ThrotVal = constrain(ThrotVal, 145, 620);
ThrotVal = map(ThrotVal, 145, 620, 0, MaxTrq); //will need to work here for cal.
if(ThrotVal<0) ThrotVal=0; //no negative numbers for now.
if(digitalRead(Brake)) ThrotVal=0; //if brake is pressed we zero the throttle value.
//Serial.println(ThrotVal); //print for calibration.
}
Once this has been done the VCU will now respond to throttle commands and send torque requests to the inverter.
the latest firmware on github looks for a 12v input on IN1 as a start request. It will then control the precharge and main contactors and inverter power via the three low side driver outputs OUT1,2 and 3 as per the comments in the code.
WiFi : A web interface via wifi that runs on the same Olimex ESP8266 module as the openinverter has been released on github. Once loaded and powered up a wifi access point called wifipowernet will appear. Connect to this and goto 192.168.4.1 to see the interface. Goto 192.168.4.1/admin to change the wifi access point settings.
ISA CAN Shunt : The latest release firmware also provides for connectivity with the ISA Can shunt for data display over the wifi interface.
I have created a task here requesting help with documentation etc not that I really expect much :
viewtopic.php?f=18&t=643
I can't explain everything to everyone.
1) The Leaf VCU is designed to run a Gen1 or Gen2 Nissan Leaf inverter and motor in stock form via CAN messages. No inverter modifications are required.
2)The Leaf VCU DOES NOT operate with the openinverter WiFi interface.
3)A pinout for the connectors on the VCU is provided here : https://github.com/damienmaguire/Nissan ... Pinout.pdf
In order to configure the VCU to run your motor it is necessary to modify the software to accept your throttle input. The VCU provides for single or dual channel throttle pedals and in its stock for on github is configured for a BMW E46 hall effect pedal. In order to change this the subroutine responsible for reading the pedal input will need to be modified. Here is the routine :
void readPedals()
{
ThrotVal = analogRead(Throttle1); //read throttle channel 1 directly
ThrotVal = constrain(ThrotVal, 145, 620);
ThrotVal = map(ThrotVal, 145, 620, 0, MaxTrq); //will need to work here for cal.
if(ThrotVal<0) ThrotVal=0; //no negative numbers for now.
if(digitalRead(Brake)) ThrotVal=0; //if brake is pressed we zero the throttle value.
//Serial.println(ThrotVal); //print for calibration.
}
Once this has been done the VCU will now respond to throttle commands and send torque requests to the inverter.
the latest firmware on github looks for a 12v input on IN1 as a start request. It will then control the precharge and main contactors and inverter power via the three low side driver outputs OUT1,2 and 3 as per the comments in the code.
WiFi : A web interface via wifi that runs on the same Olimex ESP8266 module as the openinverter has been released on github. Once loaded and powered up a wifi access point called wifipowernet will appear. Connect to this and goto 192.168.4.1 to see the interface. Goto 192.168.4.1/admin to change the wifi access point settings.
ISA CAN Shunt : The latest release firmware also provides for connectivity with the ISA Can shunt for data display over the wifi interface.
I have created a task here requesting help with documentation etc not that I really expect much :
viewtopic.php?f=18&t=643
I can't explain everything to everyone.
I'm going to need a hacksaw
- Cookie6000
- Posts: 247
- Joined: Wed May 08, 2019 9:27 am
- Location: Wicklow, IRL
- Has thanked: 12 times
- Been thanked: 33 times
- Contact:
Re: Leaf Gen 1 Inverter Board
Appreciate it Jack
I am 95% there, everything connected up as it should. This fills in the last few gaps including the use of an alternative pedal. If it helps, I will work on a step by step for the Open Tasks Leaf VCU thread you just started from the aspect of my build to date.
I am 95% there, everything connected up as it should. This fills in the last few gaps including the use of an alternative pedal. If it helps, I will work on a step by step for the Open Tasks Leaf VCU thread you just started from the aspect of my build to date.
Home of the #Audi8e - https://twitter.com/FiachraCooke
- Jack Bauer
- Posts: 3661
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 10 times
- Been thanked: 335 times
- Contact:
- Kevin Sharpe
- Posts: 1339
- Joined: Fri Dec 14, 2018 9:24 pm
- Location: Ireland and US
- Been thanked: 8 times
Re: Leaf Gen 1 Inverter Board
That would be a great helpCookie6000 wrote: ↑Sun Mar 29, 2020 10:22 am If it helps, I will work on a step by step for the Open Tasks Leaf VCU thread you just started from the aspect of my build to date.

This is a personal post and I disclaim all responsibility for any loss or damage which any person may suffer from reliance on the information and material in this post or any opinion, conclusion or recommendation in the information and material.
- Cookie6000
- Posts: 247
- Joined: Wed May 08, 2019 9:27 am
- Location: Wicklow, IRL
- Has thanked: 12 times
- Been thanked: 33 times
- Contact:
Re: Leaf Gen 1 Inverter Board
Looking to calibrate the ThrotVal values in the evbmw Leaf VCU for the Leaf pedal. The values 145,620 in the code are from the E46 pedal Damien used in the E46. The E46 signal o/p from having a search are C1 1.64v - 4.64v and C2 0.8v to 3.8v, the latter being the same as the Leaf and Touran pedal Johannes uses. Just want to be sure I calibrate the Leaf pedal correctly.
ThrotVal = analogRead(Throttle1); //read throttle channel 1 directly
ThrotVal = constrain(ThrotVal, 145, 620);
ThrotVal = map(ThrotVal, 145, 620, 0, MaxTrq); //will need to work here for cal.
What do these ThrotVal values reference to and how do I find the relevant Leaf/Prius/a-n-other pedal ThrotVal so I can put a 'how-to' together for future users adapting the Leaf VCU to their project. Thanks.
ThrotVal = analogRead(Throttle1); //read throttle channel 1 directly
ThrotVal = constrain(ThrotVal, 145, 620);
ThrotVal = map(ThrotVal, 145, 620, 0, MaxTrq); //will need to work here for cal.
What do these ThrotVal values reference to and how do I find the relevant Leaf/Prius/a-n-other pedal ThrotVal so I can put a 'how-to' together for future users adapting the Leaf VCU to their project. Thanks.
Home of the #Audi8e - https://twitter.com/FiachraCooke
- Thatguyoverthere
- Posts: 34
- Joined: Fri Jun 28, 2019 5:04 am
- Location: California, USA
- Been thanked: 1 time
Re: Leaf Gen 1 Inverter Board
The "map" in the code takes the 145, 620 that you get from the ADC input (throttle) and makes a corresponding value from 0 to MaxTrq (maxtrq is defined later in the code as 2000). The 145, 620 are the values that the ATSAM sees that has been converted from the ADC input. Just as an example, the pedal might output 1.6v at 0% throttle, and the uc sees that 1.6v as 145. To calibrate the throttle, uncomment (remove the two //) in front of the serial println throtvalue and open your serial monitor to see what values you get.
https://github.com/kaelinwilson
Leaf Motor/Gen1 Camry Inverter
Leaf Motor/Gen1 Camry Inverter
- Thatguyoverthere
- Posts: 34
- Joined: Fri Jun 28, 2019 5:04 am
- Location: California, USA
- Been thanked: 1 time
Re: Leaf Gen 1 Inverter Board
I made a short video to try to explain the process for calibrating the throttle.
Here are the changes I made to the code.
This section,
I changed to:
Also this section,
I changed to:
to make the serial monitor easier to read.
You'll notice the values printed in the serial monitor have a wider range than what the code has constrained them to
---ThrotVal = constrain(ThrotVal, 145, 620) ----
This is so you can decide the usable range/travel from your throttle pedal, so set accordingly
Once you determine what range of values you want to use, replace them wherever there was 145, 620 in the .ino.
REMEMBER TO UNDO THE COMMENT/UNCOMMENT CHANGES BEFORE YOU UPLOAD THE NEW CODE! OTHERWISE THE THROTTLE MAY NOT WORK!
Here are the changes I made to the code.
This section,
Code: Select all
void readPedals()
{
ThrotVal = analogRead(Throttle1); //read throttle channel 1 directly
ThrotVal = constrain(ThrotVal, 145, 620);
ThrotVal = map(ThrotVal, 145, 620, 0, MaxTrq); //will need to work here for cal.
if(ThrotVal<0) ThrotVal=0; //no negative numbers for now.
if(digitalRead(Brake)) ThrotVal=0; //if brake is pressed we zero the throttle value.
//Serial.println(ThrotVal); //print for calibration.
}
Code: Select all
void readPedals()
{
ThrotVal = analogRead(Throttle1); //read throttle channel 1 directly
//ThrotVal = constrain(ThrotVal, 145, 620);
//ThrotVal = map(ThrotVal, 145, 620, 0, MaxTrq); //will need to work here for cal.
if(ThrotVal<0) ThrotVal=0; //no negative numbers for now.
if(digitalRead(Brake)) ThrotVal=0; //if brake is pressed we zero the throttle value.
Serial.println(ThrotVal); //print for calibration.
}
Code: Select all
digitalWrite(13,!digitalRead(13));//blink led every time we fire this interrrupt.
Serial.print(inv_volts_local);
Serial.print(F(" Volts"));
Serial.println();
Serial.println(HV_Flag);
Code: Select all
digitalWrite(13,!digitalRead(13));//blink led every time we fire this interrrupt.
//Serial.print(inv_volts_local);
// Serial.print(F(" Volts"));
// Serial.println();
// Serial.println(HV_Flag);
You'll notice the values printed in the serial monitor have a wider range than what the code has constrained them to
---ThrotVal = constrain(ThrotVal, 145, 620) ----
This is so you can decide the usable range/travel from your throttle pedal, so set accordingly
Once you determine what range of values you want to use, replace them wherever there was 145, 620 in the .ino.
REMEMBER TO UNDO THE COMMENT/UNCOMMENT CHANGES BEFORE YOU UPLOAD THE NEW CODE! OTHERWISE THE THROTTLE MAY NOT WORK!
https://github.com/kaelinwilson
Leaf Motor/Gen1 Camry Inverter
Leaf Motor/Gen1 Camry Inverter
- Jack Bauer
- Posts: 3661
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 10 times
- Been thanked: 335 times
- Contact:
- Cookie6000
- Posts: 247
- Joined: Wed May 08, 2019 9:27 am
- Location: Wicklow, IRL
- Has thanked: 12 times
- Been thanked: 33 times
- Contact:
Re: Leaf Gen 1 Inverter Board
That's brilliant.
Thanks for the detailed breakdown. Will have a go at that later
Thanks for the detailed breakdown. Will have a go at that later
Home of the #Audi8e - https://twitter.com/FiachraCooke
- james@N52E01
- Posts: 144
- Joined: Wed Sep 18, 2019 7:02 am
- Has thanked: 2 times
- Been thanked: 3 times
Re: Leaf Gen 1 Inverter Board
Thanks for the help so far, nearly ready to try turning the motor. I’ve been through the inverter and resolver plug wiring diagrams and everything appears to match with what is connected to the board. Does anyone know what the 5v and second ground connectors are for on the inverter plug? I can’t find corresponding wires on either the inverter or resolver connectors.