Gen 3 inverter converter control software

Topics concerning the Toyota and Lexus inverter drop in boards
User avatar
rstevens81
Posts: 349
Joined: Sun Dec 22, 2019 10:36 am
Location: Bristol, UK
Has thanked: 21 times
Been thanked: 91 times

Re: Gen 3 inverter converter control software

Post by rstevens81 »

A (potential) warning to anyone who wants to use this a Yaris inverter (as stated in Celeron's GitHub) the dc capacitors are rated at 300v (low) and 650v (high) (as stamped on the capacitor casing - attached).
This does also beg the question that if the high side capacitor is 650v then it makes it highly unlikely that the inverter ever runs at 650v.
Attachments
capacitor.jpg
Rule 1 of EV Club is don't buy a rust bucket....
Which rule does everyone forget 🤪
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Gen 3 inverter converter control software

Post by Jack Bauer »

Good info thanks. The 650v thing is an internet myth that will probably never die. Along with the 100A "current limit" ....
I'm going to need a hacksaw
doobedoobedo
Posts: 260
Joined: Sat Jan 12, 2019 12:39 am
Location: UK

Re: Gen 3 inverter converter control software

Post by doobedoobedo »

rstevens81 wrote: Mon Jun 29, 2020 12:20 pm A (potential) warning to anyone who wants to use this a Yaris inverter (as stated in Celeron's GitHub) the dc capacitors are rated at 300v (low) and 650v (high) (as stamped on the capacitor casing - attached).
This does also beg the question that if the high side capacitor is 650v then it makes it highly unlikely that the inverter ever runs at 650v.
I spotted that when I took mine apart. Making me a bit nervous about using mg* to boost to 400V...
User avatar
celeron55
Posts: 774
Joined: Thu Jul 04, 2019 3:04 pm
Location: Finland
Has thanked: 27 times
Been thanked: 110 times
Contact:

Re: Gen 3 inverter converter control software

Post by celeron55 »

If you read any of Toyota's gen3 or newer publications, they do always say "650V maximum".

The IGBT driver board enforces that voltage limit. If you set the boost converter at a low PWM and just wait, it'll stop when the MG rail reaches about 650V. At high PWM it will overshoot and then you're watching it drain down from some semi scary voltage from 650V up to over 1000V.

Telling it's 650V could be a marketing strategy, or something lazily taken from their safety documents. I think it probably goes to 650V, but only when you absolutely floor the throttle, and their control system is accurate enough for operating right at the limit for brief periods of time.

So who's going to buy a gen3 Prius or Yaris... for science?
User avatar
rstevens81
Posts: 349
Joined: Sun Dec 22, 2019 10:36 am
Location: Bristol, UK
Has thanked: 21 times
Been thanked: 91 times

Re: Gen 3 inverter converter control software

Post by rstevens81 »

I think the thing to remember is that inspite of this, it's a high-powered Inverter and a DC-DC so the loss of budget 3 phase charging is not the end of the world as it's still insanely good value.

It is not long ago when an inverter if much lesser power would cost thousands.
I think if you want really high powered 3 phase charging then the poor/rich man's chademo would be a better start (if you have the necessary electrical understanding and experience).

EDIT: I am talking about the Yaris inverters here, [Prius inverters all good!] Sorry Celeron
Rule 1 of EV Club is don't buy a rust bucket....
Which rule does everyone forget 🤪
User avatar
celeron55
Posts: 774
Joined: Thu Jul 04, 2019 3:04 pm
Location: Finland
Has thanked: 27 times
Been thanked: 110 times
Contact:

Re: Gen 3 inverter converter control software

Post by celeron55 »

It works fine as a charger. The MG side is still rated for continuous 650V, even in the Yaris one. You need a lower voltage battery for it of course. And if you feel you'd rather have more margin for error, that's fine, one can always use something else. But that doesn't mean it doesn't work.

I just did a 35 minute 18kW 3 phase charging session earlier today using the Prius gen3 inverter at 10kHz. Yes, it's still in one piece.
doobedoobedo
Posts: 260
Joined: Sat Jan 12, 2019 12:39 am
Location: UK

Re: Gen 3 inverter converter control software

Post by doobedoobedo »

I'm looking at single phase charging (240V AC rectified is ~340V). My intention was to use the MG inputs then the buck/boost converter to boost up to battery voltage (100S in my case so aroung 415V) but seeing the 300V on the cap in the Yaris inverter has made me think twice.
User avatar
celeron55
Posts: 774
Joined: Thu Jul 04, 2019 3:04 pm
Location: Finland
Has thanked: 27 times
Been thanked: 110 times
Contact:

Re: Gen 3 inverter converter control software

Post by celeron55 »

Yeah that's correct. The Prius gen3 inverter would be able to handle that but as there's quite some cost difference from Yaris to Prius including external charging components, sometimes you can find an actual single phase charger with the same budget. Three phase not so much - that's where this solution shines.
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: Gen 3 inverter converter control software

Post by Bigpie »

I'm having trouble getting a bootloader burnt on the atmega. Is there anything unusual in the procedure?
I've tried using an UNO as ISP and USBTinyISP.
I've got the board powered using 12v, the ground is connected from the arduino/ISP but not the 5v. Checked the wiring multiple times.
I've used the Ardunio IDE to burn a bootloader on to the UNO with the USBTinyISP so I know that's fine.

Below is the command generated by the IDE

Code: Select all

avrdude -Cavrdude.conf -v -patmega328p -cusbtiny -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m 
and the response (when I've added an extra -vvvv)

Code: Select all

avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 00 00 00]
CMD: [ac 53 00 00] [00 00 00 00]
CMD: [ac 53 00 00] [00 00 00 00]
CMD: [ac 53 00 00] [00 00 00 00]
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

Any suggestions?
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Gen 3 inverter converter control software

Post by arber333 »

celeron55 wrote: Mon Jun 29, 2020 8:08 pm It works fine as a charger. The MG side is still rated for continuous 650V, even in the Yaris one. You need a lower voltage battery for it of course. And if you feel you'd rather have more margin for error, that's fine, one can always use something else. But that doesn't mean it doesn't work.

I just did a 35 minute 18kW 3 phase charging session earlier today using the Prius gen3 inverter at 10kHz. Yes, it's still in one piece.
Very good!

I have tested Yaris control hardware up to 400Vdc on the battery side and up to 610Vdc at MG side. This is as far as firmware will feedback.
I had the cap off at the time true! While i could have it on i decide to leave off just because i had better access. I think i saved myself some magic smoke.
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Gen 3 inverter converter control software

Post by arber333 »

doobedoobedo wrote: Mon Jun 29, 2020 8:31 pm I'm looking at single phase charging (240V AC rectified is ~340V). My intention was to use the MG inputs then the buck/boost converter to boost up to battery voltage (100S in my case so aroung 415V) but seeing the 300V on the cap in the Yaris inverter has made me think twice.
If you have space you could use some elcaps or a smaller HV film cap (100uF) on the battery side. You would just need to cut the + connections from that 300Vdc rated cap. Granted it would look somewhat odd, but i found out that on the output side you dont need much capacitance. Battery acts as a large elcap by its own. 100uF is enough to smooth the switching noise in/out the inductor and since you would use 3phase you get HV smoothing naturaly since the phases overlap.

A
User avatar
NiHaoMike
Posts: 64
Joined: Mon Dec 02, 2019 4:11 am
Location: Austin, TX
Been thanked: 1 time
Contact:

Re: Gen 3 inverter converter control software

Post by NiHaoMike »

An alternative is to connect the output of the bridge rectifier from the positive of the low side to the positive of the high side.
My first solar power system helped Naomi Wu, now I want to do even more with DIY solar.
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: Gen 3 inverter converter control software

Post by Bigpie »

@celeron55 should the #TEST_BOOST flag in your code work? Just wondering if it's a problem with my setup or that's not working in your code at the moment.

Code: Select all

#define TEST_BOOST true
#define TEST_BOOST_VOLTAGE 30
Ive done the above and connected 12v to DC BUS 2 but not getting output on DC bus 1.

I am able to buck from DC Bus 2 to 1 by adjusting the PWM on pin 10 so my setup at least partially works.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
User avatar
celeron55
Posts: 774
Joined: Thu Jul 04, 2019 3:04 pm
Location: Finland
Has thanked: 27 times
Been thanked: 110 times
Contact:

Re: Gen 3 inverter converter control software

Post by celeron55 »

Bigpie wrote: Wed Aug 05, 2020 8:05 pm @celeron55 should the #TEST_BOOST flag in your code work? Just wondering if it's a problem with my setup or that's not working in your code at the moment.

Code: Select all

#define TEST_BOOST true
#define TEST_BOOST_VOLTAGE 30
Ive done the above and connected 12v to DC BUS 2 but not getting output on DC bus 1.

I am able to buck from DC Bus 2 to 1 by adjusting the PWM on pin 10 so my setup at least partially works.
"#define TEST_BOOST true" will boost using 1% PWM up to 400V. Boosting should turn on and off every 500ms. I think it should work, as I don't remember breaking it, but I can't test at the moment.

There's no TEST_BOOST_VOLTAGE in the code. If you want to change the maximum test voltage or change something else as you sure might when testing, you can edit the test code at the beginning of loop().
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: Gen 3 inverter converter control software

Post by Bigpie »

TEST_BOOST_VOLTAGE is what I added to do just that. Bucking works (not tested using your software) but not boosting, looks like I might need to dig further and spend some time to understand timers and registers.

Am I right is assuming boosting is just doing PWM on pin 9 instead of 10 or am I reading this code wrong?

Code: Select all

...
        if(input_voltage_V < DESIRED_OUPUT_VOLTAGE && ((millis()/1000)&1)==0){
		set_pwm_boost_active(ICR1 * 0.01);
	} else {
		set_pwm_inactive();
	}
	...
static void set_pwm_boost_active(uint16_t lowswitch_ontime)
{
	if(!current_sensor_zero_offsets_calibrated)
		return;
	if(lowswitch_ontime > ICR1)
		lowswitch_ontime = ICR1;
	uint16_t lowswitch_offtime = ICR1 - lowswitch_ontime;
#if 0 //ignored
	const float deadtime_ns = 10000;
	const uint16_t deadtime = (uint16_t)((float)deadtime_ns/(1.0/16e6*1e9));
	set_ontimes(lowswitch_offtime, lowswitch_offtime - deadtime);
#else
	set_ontimes(lowswitch_offtime, 0);
#endif
}

// Times are referenced to ICR1 value (ICR1 = 100%, 0 = 0%)
static void set_ontimes(uint16_t lowswitch_offtime, uint16_t highswitch_ontime)
{
	// OC1A: Low side
	OCR1A = lowswitch_offtime;
	// OC1B: High side
	OCR1B = highswitch_ontime;

	// We need to rewind TCNT1 to OCR1A so that the lowside gets turned off.
	// Otherwise it will stay on for a full PWM cycle until it reaches the
	// lowered OC1A on the next cycle and by that point we've had quite the
	// boost pulse. At 10kHz such a pulse will create about 50V of extra voltage
	// on the MG side.
	if(TCNT1 >= OCR1A)
		TCNT1 = OCR1A-1;
}
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
User avatar
celeron55
Posts: 774
Joined: Thu Jul 04, 2019 3:04 pm
Location: Finland
Has thanked: 27 times
Been thanked: 110 times
Contact:

Re: Gen 3 inverter converter control software

Post by celeron55 »

Bigpie wrote: Thu Aug 06, 2020 6:51 am TEST_BOOST_VOLTAGE is what I added to do just that. Bucking works (not tested using your software) but not boosting, looks like I might need to dig further and spend some time to understand timers and registers.

Am I right is assuming boosting is just doing PWM on pin 9 instead of 10 or am I reading this code wrong?
Yes, it is supposed to just do PWM on the other pin. Do you have a scope or something handy to measure it directly on the atmega328 pin?
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: Gen 3 inverter converter control software

Post by Bigpie »

So as a test I've pulled the board out, set 9 and 10 at 50% duty.
Output from the pins looks good.
Screenshot 2020-08-06 at 1.02.15 pm.png
I've followed this to TR8 and TR9 then the R88 and R87 to the 50way connector, both the same
Screenshot 2020-08-06 at 1.15.30 pm.png
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
User avatar
celeron55
Posts: 774
Joined: Thu Jul 04, 2019 3:04 pm
Location: Finland
Has thanked: 27 times
Been thanked: 110 times
Contact:

Re: Gen 3 inverter converter control software

Post by celeron55 »

That looks ok assuming the IGBT driver board is disconnected. Once connected it will supply the 5V pull-up to the lines. If it doesn't supply 5V, that means it's detecting a fault in the IGBT.
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: Gen 3 inverter converter control software

Post by Bigpie »

Both look good when hooked up. I'll put the inverter back together tomorrow and stuck a voltage on the DC bus and see if I get any boosting with just setting the PWM and 50%.
Attachments
Screenshot 2020-08-06 at 9.03.33 pm.png
Screenshot 2020-08-06 at 9.02.43 pm.png
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: Gen 3 inverter converter control software

Post by Bigpie »

I must be doing something wrong.

I've got 83v on the RHS side as in the photo. I've got a multimeter on LHS (1 & 2) an no load

Code: Select all

|.  RHS (in).    |.    LHS (out).        |.    Pin 9 PWM.        |.    Pin 10 PWM.     |
|.    83         |         0             |            0          |          0          |
|     83         |         0             |           50%         |          0          |
|     83         |        83             |            0          |         50%         |
|     83         |        83             |            0          |         20%         |
|     83         |         0             |           20%         |          0          |
|     83         |         0             |           80%         |          0          |
I've checked BOOST_FAULT and it remains at 5v.
I've noticed a lower value for PWM results in a higher percentage PWM.

PWM = 50 gives 80%
PWM = 200 gives 20%


I must be missing something. I don't seem to be able to buck or boost

Code: Select all

#include <Arduino.h>

#define DCBUS1_PIN               A0
#define DCBUS2_PIN               A1
#define BOOST_LOW_SWITCH_PIN      9
#define BOOST_HIGH_SWITCH_PIN    10

int PWMDuty = 0;    //pwm duty cycle

void setup() {
  Serial.begin(115200);//
  TCCR1B = TCCR1B & B11111000 | B00000010;    // set timer 1 divisor to  8 for PWM frequency of  3921.16 Hz
  pinMode(9, OUTPUT); //boost low side
  pinMode(10, OUTPUT); //boost Hi side
  pinMode(A0, INPUT); //boost Hi side
  pinMode(A1, INPUT); //boost Hi side

  analogWrite(9,0); //low side off
  analogWrite(10,0); //low side off

  PWMDuty=0;
}
// the loop function runs over and over again forever
void loop() {

PWMDuty=20;
//  analogWrite(10,PWMDuty);
analogWrite(9, PWMDuty); //low side off

delay(1500);
}
Attachments
1600px-20200705_190723.jpg
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: Gen 3 inverter converter control software

Post by Bigpie »

Right, now I can buck from dc bus 2 down to dc bus 1. Is this thing able to buck and boost in both directions?
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
johnstef
Posts: 2
Joined: Sat Oct 03, 2020 2:46 pm
Been thanked: 1 time

Re: Gen 3 inverter converter control software

Post by johnstef »

Jack Bauer wrote: Wed Jun 17, 2020 2:13 pm
jalovick wrote: Wed Jun 17, 2020 1:22 pm I know this isn't exactly associated, but I had a thought, is it possible to use any part of the inverter/converter to add a 240V AC 50 Hz single phase output, or is that best done separately?
Working on just that....
Any progress on outputting 240v AC from the Inverter? My interest is for the USA grid, 240v AC 60 Hz. The inverter would supply AC mains current to my home from a 7kw to 10kw Li battery pack.
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Gen 3 inverter converter control software

Post by Jack Bauer »

viewtopic.php?f=14&t=969

Lets keep this thread on topic please.
I'm going to need a hacksaw
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: Gen 3 inverter converter control software

Post by Bigpie »

So I was running the prius3charger_buck (latest version), and all was well. I had single phase connected through a lightbulb, to MG1 (1&3) it light briefly and went out. Using TEST_BUCK = true.

I turned the mains power off and when I turned it off I heard a click sound from the inverter. Now when I turn mains back on the bulb stays on. Any clues what I've done and what I've killed?
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
User avatar
celeron55
Posts: 774
Joined: Thu Jul 04, 2019 3:04 pm
Location: Finland
Has thanked: 27 times
Been thanked: 110 times
Contact:

Re: Gen 3 inverter converter control software

Post by celeron55 »

Do some continuity measurements and you'll probably find out. Definitely sounds like the converter high or low side died.
Post Reply