Page 5 of 14

Re: Leaf Gen 1 Inverter Board

Posted: Tue Apr 28, 2020 7:00 pm
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.

Re: Leaf Gen 1 Inverter Board

Posted: Tue Apr 28, 2020 8:32 pm
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?

Re: Leaf Gen 1 Inverter Board

Posted: Tue Apr 28, 2020 9:12 pm
by james@N52E01
196v when the inverter is fully charged.

Re: Leaf Gen 1 Inverter Board

Posted: Wed Apr 29, 2020 1:30 pm
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.

Re: Leaf Gen 1 Inverter Board

Posted: Wed Apr 29, 2020 1:57 pm
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)?

Re: Leaf Gen 1 Inverter Board

Posted: Wed Apr 29, 2020 2:36 pm
by Cookie6000
Powering the Leaf inverter independently (normally driven by OP3) in tandem with powering the VCU results in no precharge 12v signal being generated. I'll play around with the code again later this eve to see if there is any way to cheat OP 1, 2 and 3 into action to get to understand it a bit more.

Re: Leaf Gen 1 Inverter Board

Posted: Wed Apr 29, 2020 2:57 pm
by Kevin Sharpe
Cookie6000 wrote: Wed Apr 29, 2020 2:36 pm Powering the Leaf inverter independently (normally driven by OP3) in tandem with powering the VCU results in no precharge 12v signal being generated. I'll play around with the code again later this eve to see if there is any way to cheat OP 1, 2 and 3 into action to get to understand it a bit more.
Suggest you also enable the serial.print so that you can see the inverter messages.

Any difference in hardware between the inverters you, James, and Damien use?

Re: Leaf Gen 1 Inverter Board

Posted: Wed Apr 29, 2020 3:03 pm
by james@N52E01
I Don’t think so, we’re all using Gen 1 I think. Going to tinker with the code just to see if I can get an output working Manually from OP1, 2 and 3 through on a simple timed program, not rigged up to the HV though.

Re: Leaf Gen 1 Inverter Board

Posted: Wed Apr 29, 2020 3:14 pm
by Cookie6000
james@N52E01 wrote: Wed Apr 29, 2020 3:03 pm I Don’t think so, we’re all using Gen 1 I think.
Yup. Same as

Re: Leaf Gen 1 Inverter Board

Posted: Wed Apr 29, 2020 4:07 pm
by Kevin Sharpe
Cookie6000 wrote: Wed Apr 29, 2020 3:14 pm
james@N52E01 wrote: Wed Apr 29, 2020 3:03 pm I Don’t think so, we’re all using Gen 1 I think.
Yup. Same as
ok, cool... i'd add some print statements to the code to see what values the inverter is reading and what path you're taking through the code.

Re: Leaf Gen 1 Inverter Board

Posted: Wed Apr 29, 2020 5:02 pm
by Kevin Sharpe
james@N52E01 wrote: Tue Apr 28, 2020 11:14 am So far not getting any output from either pin.
On which side of the NCV8401 driver are you measuring the output? The 3.3V logic side or the 12V load side? If the 12V load side then you need the contactor coil connected to 12V before you'll see any voltage with a multimeter.

Re: Leaf Gen 1 Inverter Board

Posted: Wed Apr 29, 2020 5:43 pm
by Kevin Sharpe
Cookie6000 wrote: Wed Apr 29, 2020 1:30 pm Similar to James
What are you doing with OUT3 exactly? Are you using it to power the inverter somehow?

Do you have a schematic showing how you've wired up the VCU, Inverter, Contactors, etc?

Re: Leaf Gen 1 Inverter Board

Posted: Wed Apr 29, 2020 8:56 pm
by Cookie6000
Here you go Kevin.
If you remember, I am using the Prius pack complete with precharge/main contactors and resistor. Gnd still goes to the 12v battery as it was during testing before moving to V1.5 of the firmware. The Pch and Main now go to OP 1 and 2 respectively.

I checked with James, and he also has his wired up his board pretty much similar and independently from mine, aside from him using Pin 1 instead of Pin 6 for his ground on the inverter vcu connector.

Edit: Previous image had CAN H and L flipped. Thanks JaniK for spotting;)
Screenshot 2022-10-14 095756.png

Re: Leaf Gen 1 Inverter Board

Posted: Wed Apr 29, 2020 9:32 pm
by Kevin Sharpe
Cookie6000 wrote: Wed Apr 29, 2020 8:56 pm Here you go Kevin.
Thanks, I think I see the problem...

You are using OUT3 as if it's a switched 12V power supply for the inverter. However, OUT3 does *not* supply 12V it's a switched ground (see circuit below). My guess is you should power the inverter with 12V from your ignition switch and ignore OUT3.

Also note that unlike your drawing the inverter has three 12V pins according to this document;

http://productions.8dromeda.net/c55-lea ... tocol.html

You also have a similar issue with OUT1 and OUT2 driving your contactors. You should connect the contactors to 12V and the OUT1/OUT2 pins. The ground is switched by the NCV8401A devices;

https://www.onsemi.com/pub/Collateral/NCV8401-D.PDF

Let me know if this makes no sense :)

Edit: how are you controlling the negative contactor?
Screenshot 2020-04-29 at 22.05.48.png

Re: Leaf Gen 1 Inverter Board

Posted: Wed Apr 29, 2020 10:00 pm
by Cookie6000
That's brilliant Kevin, thanks for that detail!

All makes sense. That was my thought that the OP pins might not be supplying 12v, especially as I drew the schematic out. Ignoring OP3 is something I tried earlier in fact as you suggested. I connected the switched Inv 12v to the IGN but obviously, nothing else happened. The next step so is to just get the contactors to 12v as well as OP1 and 2.
On the neg contactor, ignore my diagram :D I left a bit out on the neg side.

Will switching the Inverter via the ignition and ignoring OP3 mean amending the code at all, removing it from the start sequence?

Re: Leaf Gen 1 Inverter Board

Posted: Wed Apr 29, 2020 10:15 pm
by Kevin Sharpe
Cookie6000 wrote: Wed Apr 29, 2020 10:00 pm Will switching the Inverter via the ignition and ignoring OP3 mean amending the code at all, removing it from the start sequence?
I would need to crawl through the code in detail to understand whether OUT3 is intended to be used (with an external relay) or is just for legacy/future functionality. That's a lot of work and for now I'd just get the contactors sorted and ignore OUT3 in the software.

If rewiring doesn't resolve the issues then add the print statements so that you can see what the software is doing. This is a standard debug technique... shout if you don't understand :)

Edit: It's a very long time since I've used the Arduino development environment but this is the reference on the Serial.println() function;

https://www.arduino.cc/reference/en/lan ... l/println/

Re: Leaf Gen 1 Inverter Board

Posted: Thu Apr 30, 2020 11:44 am
by Cookie6000
Thanks Kevin
Appreciate the guidance here. Have a look at the latest rev and see if it makes sense. I think I have the inverter relay I added wrong. Should the gnd side I have in there actually be to 12v as do the contactors as the VCU controls switched ground?
VCU Schematic v1.1.jpg

Edit: CAN H and L flipped here in this image too, just so you know.

Re: Leaf Gen 1 Inverter Board

Posted: Thu Apr 30, 2020 12:37 pm
by Kevin Sharpe
Cookie6000 wrote: Thu Apr 30, 2020 11:44 am I think I have the inverter relay I added wrong. Should the gnd side I have in there actually be to 12v as do the contactors as the VCU controls switched ground?
You are correct, the inverter power relay should be connected to the 12V not ground. One word of caution, I do not know whether this feature is used by Damien in the current software so this may not work.

We also need to check in the software whether the OP1 used to drive the precharge and negative contactors is active during operation or just precharge. Just try it and see what happens (I recommend you use a bulb or heater element current limiter for the HV when testing contactor operations).

In the future we need to add a kill switch and impact switch to your 12V circuit. We can address that once your system is working :)

Re: Leaf Gen 1 Inverter Board

Posted: Thu Apr 30, 2020 1:52 pm
by Cookie6000
Thanks a mill Kevin
That was second thought 're neg contactor during operation after precharge. I'll try the set up later and report back 👍

Re: Leaf Gen 1 Inverter Board

Posted: Thu Apr 30, 2020 6:48 pm
by Cookie6000
Brilliant!
Success 8-) All connected up as in the schematic except I have the inverter switched 12v powered via the ign instead of OP3 and relay. Flick the switch, double click of Precharge and Neg contactors. Approx 1-2 seconds later, main contactor closes. Press pedal, and away the motor spins.
The question you had about OP1 and negative contactor during operation looks to stay closed. It does raise the question of the precharge contactor though and if it releases again or remains closed or does it matter.
Not receiving any Pack Voltage, Current or Power, just RPM and the motor and inverter temps but that should all be sorted hopefully when I get the ISA shunt in. But that's for another day :D
Thanks again Kevin. Has helped to get another bit further down the line for my own build as well as James' project Figleaf :)

Re: Leaf Gen 1 Inverter Board

Posted: Thu Apr 30, 2020 10:11 pm
by Kevin Sharpe
Cookie6000 wrote: Thu Apr 30, 2020 6:48 pm Brilliant!
Success 8-)
That's good news :)
Cookie6000 wrote: Thu Apr 30, 2020 6:48 pm All connected up as in the schematic except I have the inverter switched 12v powered via the ign instead of OP3 and relay.
I suspect Damien is not using the OP3 output. When he's less busy i'll ask him.
Cookie6000 wrote: Thu Apr 30, 2020 6:48 pm The question you had about OP1 and negative contactor during operation looks to stay closed. It does raise the question of the precharge contactor though and if it releases again or remains closed or does it matter.
It's not unusual to drive both the Negative and Precharge contactors with the same control signal. The precharge resistor is irrelevant once the Positive contactor switches.
Cookie6000 wrote: Thu Apr 30, 2020 6:48 pm Not receiving any Pack Voltage, Current or Power, just RPM and the motor and inverter temps but that should all be sorted hopefully when I get the ISA shunt in. But that's for another day :D
That's to be expected from the software;

Serial2.print("v");//dc bus voltage
Serial2.print(Sensor.Voltage);//voltage derived from ISA shunt
Serial2.print(",i");//dc current
Serial2.print(Sensor.Amperes);//current derived from ISA shunt
Serial2.print(",p");//total motor power
Serial2.print(Sensor.KW);//Power value derived from ISA Shunt
Serial2.print(",m");//motor rpm
Serial2.print(inverter_status.speed);
Serial2.print(",o");//motor temp
Serial2.print(inverter_status.motor_temperature);
Serial2.print(",r");//inverter temp
Serial2.print(inverter_status.inverter_temperature);
Serial2.print("*");// end of data indicator
Cookie6000 wrote: Thu Apr 30, 2020 6:48 pm Thanks again Kevin. Has helped to get another bit further down the line for my own build as well as James' project Figleaf :)
No problem, well done for sticking with it... all I ask is that in future you and James update the wiki so that people can help themselves 8-)

Re: Leaf Gen 1 Inverter Board

Posted: Fri May 01, 2020 5:28 pm
by Kevin Sharpe
Kevin Sharpe wrote: Thu Apr 30, 2020 10:11 pm No problem, well done for sticking with it... all I ask is that in future you and James update the wiki so that people can help themselves 8-)
I've started a wiki page for the VCU and ISA Shunt :)

https://openinverter.org/wiki/Nissan_Leaf_VCU

https://openinverter.org/wiki/Isabellen ... te_Heusler

Re: Leaf Gen 1 Inverter Board

Posted: Fri May 01, 2020 8:25 pm
by Cookie6000
Great.
I have a lot of info noted down I just need to collate together in legible form and can submit it then for future reference

Re: Leaf Gen 1 Inverter Board

Posted: Fri May 01, 2020 8:57 pm
by Kevin Sharpe
Cookie6000 wrote: Fri May 01, 2020 8:25 pm Great.
I have a lot of info noted down I just need to collate together in legible form and can submit it then for future reference
Cool! If I get a moment i'll draw up a schematic for the VCU/Inverter/Contactors :)

Re: Leaf Gen 1 Inverter Board

Posted: Fri May 22, 2020 10:43 am
by Kevin Sharpe
Kevin Sharpe wrote: Thu Apr 30, 2020 10:11 pm It's not unusual to drive both the Negative and Precharge contactors with the same control signal.
On reflection I think it's more likely that Damien intends the negative contactor to be switched by the ignition switch (which is how I think James has it wired).