Leaf Gen 1 Inverter Board

Nissan Leaf/e-NV200 drive stack topics
User avatar
Thatguyoverthere
Posts: 34
Joined: Fri Jun 28, 2019 5:04 am
Location: California, USA
Been thanked: 1 time

Re: Leaf Gen 1 Inverter Board

Post by Thatguyoverthere »

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
User avatar
Thatguyoverthere
Posts: 34
Joined: Fri Jun 28, 2019 5:04 am
Location: California, USA
Been thanked: 1 time

Re: Leaf Gen 1 Inverter Board

Post by Thatguyoverthere »

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,

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. 
}
I changed to:

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. 
}
Also this section,

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);
I changed to:

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);
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!
https://github.com/kaelinwilson
Leaf Motor/Gen1 Camry Inverter
User avatar
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

Post by Jack Bauer »

Excellent write up. Thank you.
I'm going to need a hacksaw
User avatar
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

Post by Cookie6000 »

That's brilliant.
Thanks for the detailed breakdown. Will have a go at that later
Home of the #Audi8e - https://twitter.com/FiachraCooke
User avatar
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

Post by james@N52E01 »

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.
FFA59A29-2F9A-4812-90A0-A5A7555B9158.jpeg
FFA59A29-2F9A-4812-90A0-A5A7555B9158.jpeg (16.3 KiB) Viewed 18580 times
User avatar
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

Post by Cookie6000 »

Hi James, like you, I have been digging around looking for the 5v source for the board. For now, I have been powering it externally from the breadboard ps.

The closest I got was when I had a look around the leaf board and found that the resolver temp senser sends 5v. From the board to the connector it is the WH BK wire. On the harness side, it is BK PK.
20200331_212110v2.jpg
20200331_212153v2.jpg
20200331_212126v2.jpg
When I last tried to use this as a power source for the board, it drops to 1v. Not sure but it may be down to me using the 2 grounds that leave this plug incorrectly? I did have them connected together for initial testing. Like you said, not sure where the 2nd ground is specifically meant to go.
Home of the #Audi8e - https://twitter.com/FiachraCooke
User avatar
Thatguyoverthere
Posts: 34
Joined: Fri Jun 28, 2019 5:04 am
Location: California, USA
Been thanked: 1 time

Re: Leaf Gen 1 Inverter Board

Post by Thatguyoverthere »

The 5v to leaf inverter might just be a spare? From the connector details it doesn't take 5v in, only 2 12v from the battery, 12v key on, and two 12v supply grounds. Also, Damiens board generates its own 5v supply rail, so no need to bring in any 5v to the board. In my configuration the only wires I've got taken out from the main connector are two sets of can wires (spliced from the factory) and the respective 12v, IGN, and grounds (2). Everything else I've left connected (I did untape the entire harness to make things a bit easier).
Attachments
Screenshot from 2020-04-12 13-59-40.png
https://github.com/kaelinwilson
Leaf Motor/Gen1 Camry Inverter
User avatar
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

Post by Cookie6000 »

Yes
Correct on the 5v from the board. Just figured that out yesterday when wondering why i was stuck feeding it external 5v via usb to power it. After reviewing the build in design spark, and doing a bit of testing I realised I had the step down reg pin for the 5vcc o/p was not touching the pad.
20200413_123350.jpg
Fixed now

I did the calibration method you described btw and it worked perfectly. Thanks for the help. Results for the Leaf pedal
CH1 0.4v - 1.95v (35 to 150)
CH2 0.8v - 3.9v (74 to 358)
Home of the #Audi8e - https://twitter.com/FiachraCooke
User avatar
mackoffgrid
Posts: 94
Joined: Thu Jan 02, 2020 10:18 am
Location: Brisbane Australia
Has thanked: 6 times
Been thanked: 1 time

Re: Leaf Gen 1 Inverter Board

Post by mackoffgrid »

I'm hoping to receive my gen1 motor in a week or so. I haven't got the batteries for the conversion yet. What battery voltage do I need to spin the em61 on the bench using the LEAF VCU ? - I'm hoping I can use 24 or 48v.
User avatar
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

Post by Cookie6000 »

Hey
I do not know what the lower limit to enable the Inverter to spin the motor but I'm doing my testing from a 220v Prius pack and the original protocol by 8dromeda (http://productions.8dromeda.net/c55-lea ... tocol.html) refers to a min voltage of 140v
1. Switch on 12V power
2. Start sending CAN messages within 2s, preferably instantly
3. Finish precharging to at least 140V within 10s of switching the power on...


I know that Shane of Performance EV converting the Porsche Boxster used 18 x 12v mobility scooter batteries during testing to give him just above 216v which might be an option if you can land some of these used.
PerfEV.JPG
Home of the #Audi8e - https://twitter.com/FiachraCooke
User avatar
mackoffgrid
Posts: 94
Joined: Thu Jan 02, 2020 10:18 am
Location: Brisbane Australia
Has thanked: 6 times
Been thanked: 1 time

Re: Leaf Gen 1 Inverter Board

Post by mackoffgrid »

Thank Cookie

So 220V works, maybe 140V.

I don't think Shane at Performance EV is using the LEAF VCU, opting for Heubner's inverter instead (?)
zippy500
Posts: 218
Joined: Fri Jan 04, 2019 8:42 am
Location: United Kingdom
Has thanked: 76 times
Been thanked: 3 times

Re: Leaf Gen 1 Inverter Board

Post by zippy500 »

Not sure, but I think that the Can bus VCU needs 152v min to run
User avatar
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

Post by Cookie6000 »

mackoffgrid wrote: Mon Apr 20, 2020 10:54 pm
I don't think Shane at Performance EV is using the LEAF VCU, opting for Heubner's inverter instead (?)
Yep, he is using Johannes' board alright but as Speedy said, there may be a min voltage required of ~150v to get the inverter board to start communicating,
Home of the #Audi8e - https://twitter.com/FiachraCooke
User avatar
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

Post by johu »

Equipped with the V3 logic board there is no minimum voltage requirement.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
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

Post by james@N52E01 »

Made some progress with the VCU board. Just got WiFi working :)
BB785A94-EA2B-44EA-A17D-477FE8D3E1B4.jpeg
I went through the leaf_wifi.ino code and solid-gauge.js looks like it’s missing from the GitHub repository:
https://github.com/damienmaguire/Nissan ... /WiFi/Data
(you can get it from any of the other WiFi board repositories used here)

The VCU board Is now working with V1.5 software. As you can see the Voltage, Current and Power info is not showing on the WiFi Yes as I still need an ISA shunt.

I’m still having trouble with pre-charging. Looking at the code it seems simple enough, just set the voltage level that you want the main contractor to engage and when you send the 12v ignition signal through IN1, the pre-charge contactor and Main contactor should engage through OUT1 and OUT2. So far not getting any output from either pin.
User avatar
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

Post by Kevin Sharpe »

james@N52E01 wrote: Tue Apr 28, 2020 11:14 am Made some progress with the VCU board. Just got WiFi working :)
Congratulations :)
james@N52E01 wrote: Tue Apr 28, 2020 11:14 am I went through the leaf_wifi.ino code and solid-gauge.js looks like it’s missing from the GitHub repository:
https://github.com/damienmaguire/Nissan ... /WiFi/Data
(you can get it from any of the other WiFi board repositories used here)
Thanks for the feedback! I posted an issue on GitHub for future reference :)
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.
User avatar
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

Post by Cookie6000 »

james@N52E01 wrote: Tue Apr 28, 2020 11:14 am I’m still having trouble with pre-charging. Looking at the code it seems simple enough, just set the voltage level that you want the main contractor to engage and when you send the 12v ignition signal through IN1, the pre-charge contactor and Main contactor should engage through OUT1 and OUT2. So far not getting any output from either pin.
Great work James. Got me over the hump. I'm seeing the same as you now on the web interface

I am also stuck at the same point as you. I have 12v going into IN1 and I trace the voltage all the way over to R14 where it drops to 3v and off to the chip. Tried various times and get nothing out on OP1, 2 or 3 yet. As with James, I'm working through the code to see if I have missed anything.
Home of the #Audi8e - https://twitter.com/FiachraCooke
User avatar
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

Post by Jack Bauer »

You have actually answered your own question if you have a think:)

"As you can see the Voltage, Current and Power info is not showing on the WiFi Yes as I still need an ISA shunt."

"I’m still having trouble with pre-charging. "

Join the dots folks....
I'm going to need a hacksaw
User avatar
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

Post by Jack Bauer »

But you can cheat and use the voltage read by the inverter :

Code: Select all

void HV_Con()
{

  inv_volts_local=(inverter_status.voltage / INVERTER_BITS_PER_VOLT);


if (T15Status && !Pch_Flag)  //if terminal 15 is on and precharge not enabled
{
  digitalWrite(OUT3, HIGH);  //inverter power on
  if(inv_volts_local<200)
  {
  digitalWrite(OUT1, HIGH);  //precharge on
  Pch_Flag=true;
  }
}
if (T15Status && !HV_Flag && Pch_Flag)  //using inverter measured hv for initial tests. Will use ISA derived voltage in final version.
{
  if (inv_volts_local>340)
  {
  digitalWrite(OUT2, HIGH);  //main contactor on
  HV_Flag=true;  //hv on flag
  }
}

if (!T15Status)
{
  digitalWrite(OUT1, LOW);  //precharge off
  digitalWrite(OUT2, LOW);  //main contactor off
  digitalWrite(OUT3, LOW);  //inverter power off
  
}

}
I'm going to need a hacksaw
User avatar
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

Post by james@N52E01 »

Thanks JB! No facepalm emoji on here or I'd be using it...
User avatar
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

Post by james@N52E01 »

I've just checked through the code in V1.5 which Fiachra and I are both using, which is the same code as you have just posted. It looks like everything is based on inv_volts_local and not the ISA Shunt. This is the code I'm using (only changes I have made are the numbers as I'm using a 48s pack for testing)

Code: Select all

void HV_Con()
{

  inv_volts_local=(inverter_status.voltage / INVERTER_BITS_PER_VOLT);


if (T15Status && !Pch_Flag)  //if terminal 15 is on and precharge not enabled
{
  digitalWrite(OUT3, HIGH);  //inverter power on
  if(inv_volts_local<144)
  {
  digitalWrite(OUT1, HIGH);  //precharge on
  Pch_Flag=true;
  }
}
if (T15Status && !HV_Flag && Pch_Flag)  //using inverter measured hv for initial tests. Will use ISA derived voltage in final version.
{
  if (inv_volts_local>170)
  {
  digitalWrite(OUT2, HIGH);  //main contactor on
  HV_Flag=true;  //hv on flag
  }
}

if (!T15Status)
{
  digitalWrite(OUT1, LOW);  //precharge off
  digitalWrite(OUT2, LOW);  //main contactor off
  digitalWrite(OUT3, LOW);  //inverter power off
  
}

}
I know this is going to be something obvious we're doing wrong so thanks for baring with us.
User avatar
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

Post by Kevin Sharpe »

james@N52E01 wrote: Tue Apr 28, 2020 7:00 pm I'm using a 48s pack for testing
What pack voltage do you measure with a multimeter?
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.
User avatar
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

Post by james@N52E01 »

196v when the inverter is fully charged.
User avatar
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

Post by Cookie6000 »

Similar to James

I have just amended the HV values for the pack I am using. Multimeter measured it comes in at 209V. Following the logic, if T15 is receiving 12v (switched IGN) but Precharge is not enabled, OUT3 and OUT1 will be set to HIGH if inv_volts_local is <180, in my case.

I can see what Damien is getting at, needing to know the HV values to get the VCU to activate OP1 to 3 but, how without the Shunt or having the inverter powered on first?

Code: Select all

void HV_Con()
{

  inv_volts_local=(inverter_status.voltage / INVERTER_BITS_PER_VOLT);


if (T15Status && !Pch_Flag)  //if terminal 15 is on and precharge not enabled
{
  digitalWrite(OUT3, HIGH);  //inverter power on
  if(inv_volts_local<180)
  {
  digitalWrite(OUT1, HIGH);  //precharge on
  Pch_Flag=true;
  }
}
if (T15Status && !HV_Flag && Pch_Flag)  //using inverter measured hv for initial tests. Will use ISA derived voltage in final version.
{
  if (inv_volts_local>205)
  {
  digitalWrite(OUT2, HIGH);  //main contactor on
  HV_Flag=true;  //hv on flag
  }
}

if (!T15Status)
{
  digitalWrite(OUT1, LOW);  //precharge off
  digitalWrite(OUT2, LOW);  //main contactor off
  digitalWrite(OUT3, LOW);  //inverter power off
  
}
I did try removing the if(inv_volts_local<180) from the steps by adding // before it, thinking it might remove this step, therefore just setting OP1 and OP3 to HIGH but nothing.
Home of the #Audi8e - https://twitter.com/FiachraCooke
User avatar
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

Post by Kevin Sharpe »

Cookie6000 wrote: Wed Apr 29, 2020 1:30 pm I can see what Damien is getting at, needing to know the HV values to get the VCU to activate OP1 to 3 but, how without the Shunt or having the inverter powered on first?
I don't know anything about the detailed operation of the inverter but agree this does sound odd. What happens if you enable the inverter by driving OUT3 high when the key is on (i.e. without any dependence on the inverter messages)?
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.
Post Reply