Page 4 of 12

Re: Gen 3 inverter converter control software

Posted: Thu Aug 06, 2020 9:42 am
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?

Re: Gen 3 inverter converter control software

Posted: Thu Aug 06, 2020 12:17 pm
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

Re: Gen 3 inverter converter control software

Posted: Thu Aug 06, 2020 12:42 pm
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.

Re: Gen 3 inverter converter control software

Posted: Thu Aug 06, 2020 8:12 pm
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%.

Re: Gen 3 inverter converter control software

Posted: Sun Aug 16, 2020 6:43 pm
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);
}

Re: Gen 3 inverter converter control software

Posted: Wed Aug 19, 2020 9:19 pm
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?

Re: Gen 3 inverter converter control software

Posted: Sat Oct 03, 2020 3:03 pm
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.

Re: Gen 3 inverter converter control software

Posted: Sun Oct 04, 2020 9:03 am
by Jack Bauer
viewtopic.php?f=14&t=969

Lets keep this thread on topic please.

Re: Gen 3 inverter converter control software

Posted: Sat Oct 31, 2020 1:33 pm
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?

Re: Gen 3 inverter converter control software

Posted: Sat Oct 31, 2020 2:09 pm
by celeron55
Do some continuity measurements and you'll probably find out. Definitely sounds like the converter high or low side died.

Re: Gen 3 inverter converter control software

Posted: Sat Oct 31, 2020 2:24 pm
by Bigpie
Would be be kind enough to point me to where I'd be probing? I'm not sure which legs are for the buck boost mosfets

EDIT found this: Image

I have a short between + and -, It's dead, Jim.
20201031_144655.jpg
1/ If I cut the legs of the boost IGBTs I'm guessing that would allow me to still drive a motor with MG1/MG2?
2/ I'm assuming I've had both the high and low on at the same time? I was only running test_buck, does some dead time need bringing in to stop the happening when I get another inverter?

Re: Gen 3 inverter converter control software

Posted: Tue Nov 03, 2020 7:33 pm
by Bigpie
20201103_191139.jpg
A bad thing has happened. I've been in to the goo and cut away. Hopefully can still use mg2 for now.

I'll pick up another inverter at some point.

Re: Gen 3 inverter converter control software

Posted: Tue Nov 03, 2020 7:57 pm
by celeron55
In these cases it's difficult to tell what the root cause is.

I think some of the used inverters on sale do have problems with the boost IGBTs, so there's a chance it's bad luck.

My code might just suck, altough I've personally ran it more than enough to give it a chance to destroy my IGBTs.

It could also be that some versions of the inverter have worse protection than others, and only the better ones survive the code. Who knows.

Re: Gen 3 inverter converter control software

Posted: Tue Nov 03, 2020 8:14 pm
by Bigpie
I'm not sure, it went pop when I'd turned the mains off but with no load on the dc bus, the 12v supply was still on to the inverter, using test buck. Not sure if thats anything to do with it.

I don't know much about using timers so I get lost following your code there. I did wonder why the code that appears to set deadtime isn't used?

Code: Select all

// Sets high side switch PWM, and low side switch PWM based on it
static void set_pwm_buck_active(uint16_t highswitch_ontime)
{
	if(!current_sensor_zero_offsets_calibrated)
		return;
#if 0
	const float deadtime_ns = 2500;
	const uint16_t deadtime = (uint16_t)((float)deadtime_ns/(1.0/16e6*1e9));
	set_ontimes(highswitch_ontime + deadtime, highswitch_ontime);
#else
	set_ontimes(ICR1+1, highswitch_ontime);
#endif
}


Re: Gen 3 inverter converter control software

Posted: Tue Nov 03, 2020 8:58 pm
by celeron55
It doesn't activate the low side IGBT at all. The low side is just used as a diode. If you change it to #if 1, then the lowside is also driven, but I didn't test that option at all because on my inverter the low side IGBT is toast. The diode works and it isn't shorted, but it can't be activated.

Note that set_ontimes() has weird parameters. The first parameter is lowside offtime and the second parameter is highside hightime. I wrote it to directly match to how the underlying timer is set up.

Re: Gen 3 inverter converter control software

Posted: Sun Dec 27, 2020 8:28 pm
by Jack Bauer
going to make this a sticky as it seems to have fallen off the radar and is an important development.

Re: Gen 3 inverter converter control software

Posted: Mon Jan 11, 2021 3:57 pm
by Bigpie
I've started working on a basic web interface for this so I don't have to plug in.

https://github.com/jamiejones85/PriusCh ... bInterface

So far it uses Web Sockets to display the serial output from the charger.
Screenshot 2021-01-11 at 3.45.21 pm.png
Plans are to allow uploading of new firmware and set configuration options at least, someones written code https://github.com/rene-win/esp_avr_programmer that I'm going to be ripping off for that.

I'm using a Wemos D1 mini, even though it's supposed to be 3.3v hooking the RX and TX pins up directly seems to work.

Contributions will be greatly appreciated.

EDIT
It's a bit rough round the edges, but you can now upload a hex file to flash the attached atmega.

Re: Gen 3 inverter converter control software

Posted: Mon Jan 11, 2021 6:44 pm
by celeron55
So you directly connect (taking care of different pinout) the Wemos D1 mini to GND, 5V, RX, TX and RST in the "FTDI 5V" connector and it just works?

Re: Gen 3 inverter converter control software

Posted: Mon Jan 11, 2021 6:54 pm
by Bigpie
pretty much, yea. I'd read https://hackaday.com/2016/07/28/ask-hac ... -tolerant/ and though what the hell, I'll give it a go.

I've flashed a hex with the web interface that prints a serial message and this started appearing in the output. So on to cleaning up the code.

Re: Gen 3 inverter converter control software

Posted: Wed Jan 13, 2021 12:11 pm
by Bigpie
Screenshot 2021-01-13 at 12.07.44 pm.png
Web Interface now supports
-Updating the Atmega Firmware
-Sending Commands
-Viewing Output Log

I'll have to look at some changes to the charger code next, moving the configuration parameters in to EEPROM and allowing this to be set from the Web Interface.

Re: Gen 3 inverter converter control software

Posted: Wed Jan 13, 2021 3:37 pm
by Jack Bauer
Fantastic!

Re: Gen 3 inverter converter control software

Posted: Thu Jan 14, 2021 8:18 pm
by Leo M
Ждём продолжения ! Очень интересно.

Re: Gen 3 inverter converter control software

Posted: Sat Jan 16, 2021 11:43 am
by Bigpie
I'm starting to try charging again with my new inverter but I'm having issues with the current sensor calibration.
Not accepting current calibration values: 503, 1023 (out of range)
How have you selected the values in

Code: Select all

	if(il1_1 < 460 || il1_1 > 570 || il2_1 < 460 || il2_1 > 570){

Re: Gen 3 inverter converter control software

Posted: Sat Jan 16, 2021 12:00 pm
by celeron55
They're just values in the middle of the range around 2.5V. 1023 sounds like something isn't connected right, as it's the maximum value the ADC can read and would mean hundreds of amps. Good thing I bothered to add that check...

Re: Gen 3 inverter converter control software

Posted: Sat Jan 16, 2021 12:21 pm
by Bigpie
You're right there, I've probed the via for A5 and it's up at 5v. Can't see a reason why that would be, I'll have a poke around.

Unplugging the current sensor drops it to 0v. Same issue with my old current sensors too. Not sure what else to check