Prius Gen2 Inverter DC Motor Controller

Topics concerning the Toyota and Lexus inverter drop in boards
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: Project RX8 , Prius gen2, Lexus transaxle butcher

Post by Ev8 »

From your pictures I can’t see any of the current sensors connected? If you leave them disconnected and the pins are floating without turning them off in code there’s and chance the the code will see a current higher than the current limit and not increase pwm, I also can’t see anything there for driving the inverter pwm lines? No fet? You can’t just tie them to the the teensy pwm pin as that’ll be a very low powered high side signal.
User avatar
esoneson
Posts: 31
Joined: Sun Jan 27, 2019 3:45 pm
Location: North Carolina, USA

Re: Project RX8 , Prius gen2, Lexus transaxle butcher

Post by esoneson »

Ev8 wrote: Mon Nov 01, 2021 7:53 am Hard to see from your pictures exactly how your hv inverter wiring is done, you should have battery positive and negative present at the inverter brick inputs, battery neg also connects to motor neg, and motor pos connects to phase outputs,

Maybe post a copy of your modified code? And maybe a screen shot of your serial monitor in run mode, do you get a forward or Reverse status?

Battery Positive (167 volts) is connected to the Prius Inverter positive (lower) connection.
Battery Negative is connected to the Prius negative (uppper) connection.
167 Volts is on both MG1 and MG2 rails to IGBTs. (bolted together).

All six Prius phase output cables are connected to Motor pos.
Motor neg is connected to Battery neg

All 6 PWM signals at inverter are connected to the PWM output from the Teensy 3.2
Prius Pin 20 and 25 are connected to 12v+

At no throttle, with inverter powered up, I get the following readings:

PIN 2 GIVA MG1 phase current .05v (in) .02v after voltage div
PIN 7 MIVA MG2 phase current .04v (in) .02v after voltage div
PIN 12 HVI Inverter cap voltage 1.52v (in) .58v after voltage div
PIN 18 GIWA MG1 phase current .04v (in) .02v after voltage div
PIN 22 GFIV MG1 inverter fail 6.66v (in) 2.25v after voltage div
PIN 23 MIWA MG2 phase current .05v (in) .02v after voltage div
PIN 27 MFIV MG2 inverter fail 5.43v (in) 1.74v after voltage div

PWM 15.01v
Throttle .63v (in) .45v after voltage div

Will post code soon.
Will post serial debug soon.

Thanks for the help. I am methodically progressing with this debug. Let me know if you see any values out of line.
Eric
User avatar
esoneson
Posts: 31
Joined: Sun Jan 27, 2019 3:45 pm
Location: North Carolina, USA

Re: Project RX8 , Prius gen2, Lexus transaxle butcher

Post by esoneson »

Ev8 wrote: Mon Nov 01, 2021 8:13 am What does your “throttle PWR actual” read when you press the throttle if this changes from 0 then you are making pwm, does your teensy pwm 4 trigger a logic level fet that drives all of the inverter pwm pins low?

Also why remove the inverter temperature part of the code? This gives you on chip monitoring of the igbt temperature rather than just cooling water temperature.
I have a temp sensor attached to the base plate hooked up to a display and trigger that starts/stops pump and fan when needed. It works. I can switch to your method later after I get the motor to turn. :-)

I did not remove any code, just commented them out. They are preserved. Same thing with the BMS stuff, just commented out. throttle per actual is in my captured debug output. Will post soon.

I am using Teensy 3.2. I have not idea what the logic level fet that drives all of the inverter pwm pins low. Is this something I must initiate? How? I assume this is why all my PWM lines are at 12+ volts. Didn't see it in your code. Is this a hard wire add?

Thanks again.
Eric
User avatar
esoneson
Posts: 31
Joined: Sun Jan 27, 2019 3:45 pm
Location: North Carolina, USA

Re: Project RX8 , Prius gen2, Lexus transaxle butcher

Post by esoneson »

Ev8 wrote: Mon Nov 01, 2021 8:27 am From your pictures I can’t see any of the current sensors connected? If you leave them disconnected and the pins are floating without turning them off in code there’s and chance the the code will see a current higher than the current limit and not increase pwm, I also can’t see anything there for driving the inverter pwm lines? No fet? You can’t just tie them to the the teensy pwm pin as that’ll be a very low powered high side signal.

logic level fet that drives all of the inverter pwm pins low? How is that done?
Didn't see it in the code.


PIN 3 and 19 are MG1 phase current lines that are not connected, what should I do with them?
Also PIN 24 and 8 are MG2 phase current lines that are not connected. Same question.
I didn't see your code "turn off" any pin input. So what should I do?

I would like to resolve these issues before dumping a large debug output on you.
What do you think?
Eric
GE11
Posts: 42
Joined: Fri Oct 15, 2021 7:03 pm

Re: Prius Gen2 Inverter DC Motor Controller

Post by GE11 »

Well I am trying to decide here. I can go with a Zilla 1K which I have about 600 Bucks into and use it. Or I can sell the Zilla 1K and do this open source project. Which one would you all think would be more advantageous? To just use the Zilla 1K or to get involved with the Open source version??


thanks
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: Project RX8 , Prius gen2, Lexus transaxle butcher

Post by Ev8 »

The code produces a pwm on the pwm pins, pin 4 being the inverter pwm signal, but with any pwm output on the teensy you need a simple circuit using a logic level n channel mosfet to switch gnd on and off…
If you’ve got 12v at the teensy pwm pins then it’s likely fried, here an picture of a simple low side mosfet circuit
I’d use a 10k pull down resistor
Attachments
FDDDD047-A6B8-43E4-B204-CF71CB643BCF.jpeg
User avatar
esoneson
Posts: 31
Joined: Sun Jan 27, 2019 3:45 pm
Location: North Carolina, USA

Re: Project RX8 , Prius gen2, Lexus transaxle butcher

Post by esoneson »

Just to be sure: Control is the inverter PWM pin(s) and Load is the Teensy PWM signal?
Using the 10k resister to lower the voltage. When I get an n channel mosfet, would 12v be ok?
Thanks again. Got 2 more Teensy 3.2 coming. I socket mounted the Teensy just for this reason.
Thank you.
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: Project RX8 , Prius gen2, Lexus transaxle butcher

Post by Ev8 »

Nope control is pin on the teensy, load is the inverter pwm pins, 10k pull down resistor where R is, (it’s not their to lower voltage) You need to make sure you are using a logic level (works with low voltage triggers) n channel mosfet
GE11
Posts: 42
Joined: Fri Oct 15, 2021 7:03 pm

Re: Prius Gen2 Inverter DC Motor Controller

Post by GE11 »

Hey EV8,

Can I ask a question??

Is this a Synchronous controller? By that I mean do you use one set of IGBT to Drive the current, then another set of IGBTs to do the Free wheeling of the current?

If its not is it possible to make this a Synchronous design by driving the other set of IGBTs?


thanks..
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: Prius Gen2 Inverter DC Motor Controller

Post by Ev8 »

Yes the Prius gen2 inverter in synchronous by nature. Pwm pulled low drives the output to the positive bus, when left high the other igbts drive the output to the negative bus
GE11
Posts: 42
Joined: Fri Oct 15, 2021 7:03 pm

Re: Prius Gen2 Inverter DC Motor Controller

Post by GE11 »

Ev8 wrote: Mon Nov 08, 2021 6:17 pm Yes the Prius gen2 inverter in synchronous by nature. Pwm pulled low drives the output to the positive bus, when left high the other igbts drive the output to the negative bus
But is the Synchronous feature utilized in our DC version as well? I thought I might have read somewhere that the Diode actually did the free wheeling... It would be GREAT if this DC version is Synchronous too.
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: Prius Gen2 Inverter DC Motor Controller

Post by Ev8 »

Yes I fully believe it is working it used this, as you can’t individually control high side and low side igbts in the gen2 unless the pwm signal is pulled low the low side igbt are always on
GE11
Posts: 42
Joined: Fri Oct 15, 2021 7:03 pm

Re: Prius Gen2 Inverter DC Motor Controller

Post by GE11 »

Ev8 wrote: Tue Nov 09, 2021 11:53 am Yes I fully believe it is working it used this, as you can’t individually control high side and low side igbts in the gen2 unless the pwm signal is pulled low the low side igbt are always on

Hello,

I am starting to dig into the code and I have a couple of questions if I may.

1. What Is the minimum System Pack voltage?? I am wanting to run 14S settup which is around 56V. I see in the code where there are some variable settings in the code:

int volt_high = 220; //inverter output voltage limit
int volt_low = 250; // battery low warning

Could I just change the volt_low to like 47V ??

2.
Also how does volt_high varible work? does this actually limit the Max voltage to the DC motor sort of like a regulator?


3.
In the code below, it seems you have Pins 3 & 4 running at 6Khz which I know drives the gates of the IGBT, but what are pins 5&6 used for?

void setup() {
// put your setup code here, to run once:
analogWriteFrequency(3, 6000); // Teensy pin 3&4 changes to 6 kHz
analogWriteFrequency(5, 20000); // Teensy pin 5&6 changes to 20 kHz



I just want to understand things like the code before I go out and commit to buying parts...Thanks for you help!
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: Prius Gen2 Inverter DC Motor Controller

Post by Ev8 »

Yes change volt_low to anything you like, although your going to need a higher system voltage if you want the dc-dc converter to work like over 110,

Volt_high is an output voltage limit achieved by limiting the max pwm, it simply calculates the approximate output voltage from the dc bus voltage and the output pwm, handy if you have. 300volt pack but want to limit maximum motor voltage to say 144v when you plant the throttle,

The other pwm pins that run at 20khz are for the contactor, the pre charge relay and a pwm output for a temperature gauge sender
GE11
Posts: 42
Joined: Fri Oct 15, 2021 7:03 pm

Re: Prius Gen2 Inverter DC Motor Controller

Post by GE11 »

Ev8 wrote: Thu Nov 11, 2021 9:02 pm Yes change volt_low to anything you like, although your going to need a higher system voltage if you want the dc-dc converter to work like over 110,

Volt_high is an output voltage limit achieved by limiting the max pwm, it simply calculates the approximate output voltage from the dc bus voltage and the output pwm, handy if you have. 300volt pack but want to limit maximum motor voltage to say 144v when you plant the throttle,

The other pwm pins that run at 20khz are for the contactor, the pre charge relay and a pwm output for a temperature gauge sender
The 20KHz are for the contactor? and Pre Charge Relay?? Im Kinda confused...

Im going to study the code some more ...
GE11
Posts: 42
Joined: Fri Oct 15, 2021 7:03 pm

Re: Prius Gen2 Inverter DC Motor Controller

Post by GE11 »

I guess what I am asking is why do the Pre Charge Relay and Main contactor have to run at 20Khz?
GE11
Posts: 42
Joined: Fri Oct 15, 2021 7:03 pm

Re: Prius Gen2 Inverter DC Motor Controller

Post by GE11 »

Im guessing you are using a constant PWM for the Pre charge and the Main contactor to simply limmit the current to the coils... Its just a way to not have to use a current limiting resistor ... right??
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: Prius Gen2 Inverter DC Motor Controller

Post by Ev8 »

20khz is the frequency, it’s this value so the coils don’t sit there making noise, in my code I have the main contactor pwm set to a constant 255 because my contactors have built in economisisers, but you could easily add and extra line of code that would drop to pwm to say a lower value after a second of operation if you are using a contactor without an economiser, in fact you can see in the code that pwm5 (precharge relay that has no economiser) does exactly this pwm drops to 160 after initial opening at 255 then once code is satisfied the precharge has happened and bus voltage is high enough closes main contactor and turns off the precharge relay
GE11
Posts: 42
Joined: Fri Oct 15, 2021 7:03 pm

Re: Prius Gen2 Inverter DC Motor Controller

Post by GE11 »

Ok But here is where I am confused... Why does it take an active oscillating signal like a PWM signal to drive a Relay or Solenoid coil? Why cant it ne just drive with a straight High or a low?

I guess that whats confusing me..

Sorry for all the questions...and thanks for the help
GE11
Posts: 42
Joined: Fri Oct 15, 2021 7:03 pm

Re: Prius Gen2 Inverter DC Motor Controller

Post by GE11 »

Ok another question...

what does this map function do? I have seen it several places..Why do we need it?

hv_analog = analogRead (HV1);
hv_volts = map (hv_analog, 70,1023, 0, 975);


Then same question for this filter function
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: Prius Gen2 Inverter DC Motor Controller

Post by Ev8 »

It scales a variable in this case hv_volts to an analog input hv_analog within the defined input output ranges, so in this case turn the analog input of between 70-1023 into a actual figure for voltage between 0-975volts

Just converting adc into something we can use
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: Prius Gen2 Inverter DC Motor Controller

Post by Ev8 »

Filter function is there to smooth input jitter from unwanted noise on the analog inputs, without which the throttle and current reading would jump around and effect drivability
GE11
Posts: 42
Joined: Fri Oct 15, 2021 7:03 pm

Re: Prius Gen2 Inverter DC Motor Controller

Post by GE11 »

I think I am starting to understand this... I ordered 4 of these Gen 2 inverters.. Will you help me with the connections to the Processor board?

thanks again for your help!
GE11
Posts: 42
Joined: Fri Oct 15, 2021 7:03 pm

Re: Prius Gen2 Inverter DC Motor Controller

Post by GE11 »

Here is what I will order...Is this correct?

https://www.ebay.com/itm/184467442349?_ ... %7Ciid%3A1
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: Prius Gen2 Inverter DC Motor Controller

Post by Ev8 »

Yes that’s right, teensy 3.2 I will try in coming weeks draw up a schematic for the board, most likely To happen Christmas week though as I have no time off until then
Post Reply