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 »

Good morning,

I have lost track of this thread somewhat just wanted to ask

1. should the mod be implemented or was this an issue due the the voltage measurement?
2. Why take DC bus voltage measurement? We have a BMS that will report total voltage?
Rule 1 of EV Club is don't buy a rust bucket....
Which rule does everyone forget 🤪
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Gen 3 inverter converter control software

Post by bexander »

rstevens81 wrote: Tue Jun 22, 2021 7:32 am Good morning,

I have lost track of this thread somewhat just wanted to ask

1. should the mod be implemented or was this an issue due the the voltage measurement?
2. Why take DC bus voltage measurement? We have a BMS that will report total voltage?
1. Are you referring to the voltage measurement modification? It is only required if you have a maximum battery voltage over 350V.
2. The "charger" can work stand-alone without any external inputs if internal dc-bus voltage is used.
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 »

Sorry causes confusion is my middle name(s) :D

My question was about
I have now added a op-amp circuit instead of voltage division on MG1 current sensor output. This removes the 2 time damping and adds a 2,5 time amplification so in total 5 times the voltage at the 328P and a max measurable current of 50A
Was this a symptom of the voltage measurement limit is is this worth doing?

Also the voltage limit would become accdemic of you were to use values from the BMS? (If the code were modified to accommodate)
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 »

The current measurement has nothing to do with voltage measurement. They are completely separate things and you probably want the op-amp current measurement amplification, it makes the charger work much nicer when it actually knows the current by more than a few noisy bits.

Are you seriously suggesting a charger shouldn't measure voltage by itself but completely rely on external voltage measurement on a vehicle wide canbus? Sounds like a good way to set your car on fire.
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 was not proposing using solely can bus, I was suggesting with the appropriate time outs, fault signals and voltage measurement from other places i.e ISA shunt, inverter etc.
Personally I would probably use at least 2 independent voltage measurements and if the delta exceeded a set value to fault out.

Edit

DOH just realised how simple the voltage mod was, please ignore my stupidity 🤣
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 »

Well, nothing stops you from doing that of course. It doesn't make any sense to me though, the voltage sensing modification is just a few resistors. Your proposal sounds like an overengineered bad design.

EDIT: The resistor modification for dc bus 1 voltage measurement above 350V is here: viewtopic.php?p=25293#p25293
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Gen 3 inverter converter control software

Post by bexander »

I've started using the "EVSE sens" in the code and quickly relized there is a timing conflict between the two interrupts. The EVSE interrupt measures the time between toggle of EVSE CP pin to get the duty-cycle and hence current capabillity, in the region of 100-1000us. The pwm interrupt is massive and uses AnalogRead which takes 112us to execute and also sometimes alot of calculations making worste case close to 270us. One interrupt routine can't be run inside another interrupt so very possible to get a delay of 270us when measuring CP duty-cycle making the reading very far off.

To mitigate this I have made some changes to remove AnalogRead, spread the calculations over several occations and also tried to simplify the calculations as much as I could.
I have also made some changed to the EVSE interrupt to decrease the time it takes to execute as well.

Attached is my current version of celeron55:s code.
prius3charger_buck_modified.zip
(31.3 KiB) Downloaded 195 times
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 »

Nice work.

Personally, I have a problem with my code: It's working fine enough for me so I don't feel like trying out changes. Merging suggestions on Github without testing them myself doesn't feel right. I guess I'll have to get to testing once summer is over and there's more time for tinkering with code.
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Gen 3 inverter converter control software

Post by bexander »

No worries, just sharing so others can make changes as well if the want to.
I agree that it should be more tested before any merges.
m.art.y
Posts: 550
Joined: Sat Jun 06, 2020 6:54 pm
Location: UK
Has thanked: 24 times
Been thanked: 17 times

Re: Gen 3 inverter converter control software

Post by m.art.y »

bexander wrote: Wed Aug 11, 2021 7:20 pm No worries, just sharing so others can make changes as well if the want to.
I agree that it should be more tested before any merges.
Are you also running prius gen3 inverter as an AC charger? How has it been performing and did your code modifications made it better? I'm looking for a charging solution for trips and am considering prius gen3 inverter as I already have it. As I understand prius gen3 can only charge at 3 phases and needs a 3 phase type 2 socket?
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Gen 3 inverter converter control software

Post by bexander »

m.art.y wrote: Tue Oct 26, 2021 11:25 am
bexander wrote: Wed Aug 11, 2021 7:20 pm No worries, just sharing so others can make changes as well if the want to.
I agree that it should be more tested before any merges.
Are you also running prius gen3 inverter as an AC charger? How has it been performing and did your code modifications made it better? I'm looking for a charging solution for trips and am considering prius gen3 inverter as I already have it. As I understand prius gen3 can only charge at 3 phases and needs a 3 phase type 2 socket?
Yes, I'm running the gen3 prius as AC charger.
I think it works better but not as good as I want it to so more work is required.
True, as it's setup it requires 3-phase but it does not require type2 connector. Can be run on any 3-phase input with enought voltage, connect PP to ground and set current limit in SW or externally via can-bus.
m.art.y
Posts: 550
Joined: Sat Jun 06, 2020 6:54 pm
Location: UK
Has thanked: 24 times
Been thanked: 17 times

Re: Gen 3 inverter converter control software

Post by m.art.y »

bexander wrote: Wed Oct 27, 2021 5:32 am I think it works better but not as good as I want it to so more work is required.
True, as it's setup it requires 3-phase but it does not require type2 connector. Can be run on any 3-phase input with enought voltage, connect PP to ground and set current limit in SW or externally via can-bus.
What exactly are you still having trouble with and do you have ideas how to solve it?
I haven't got 3 phase at home so I only intend to use it with 3 phase public charging stations and use different charger for single phase charging at home. Currently I only have type 1 socket that I could wire to the charger but surely this won't support 3 phase charging with the prius inverter or I missunderstood what you meant?
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 »

The Prius charger only works for 3 phase supply.
For public charging you will need a 3 phase type 2 socket
If you work in an industrial unit you could charge from the mains with the above wiring.
My advice would be to get a type 2 from ali (preferably with CCS for future proofing) as most new public chargers (at least in UK) seem to be type 2 nowerdays
Rule 1 of EV Club is don't buy a rust bucket....
Which rule does everyone forget 🤪
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Gen 3 inverter converter control software

Post by bexander »

m.art.y wrote: Wed Oct 27, 2021 9:18 pm What exactly are you still having trouble with and do you have ideas how to solve it?
The current measurement is still not stable and I suspect this is down to hardware issues. I have not looked into it further but I suspect poor AVCC decoupling on the 328p and also perhaps pulsing current due to low base resistors in PWM drive transistors (might be better of using mosfets).
At this point, this is my best guesses and I will investigate this further when I have the time. Right now my main focus is to get the inverter work well with the Toyota MGR.
Yahha777
Posts: 52
Joined: Wed Feb 27, 2019 7:03 am
Location: Belorussia. Borisov
Has thanked: 15 times
Been thanked: 1 time
Contact:

Re: Gen 3 inverter converter control software

Post by Yahha777 »

Hello members of the forum! Someone can tell you how to solve this problem - compiling the Platformio web interface gives the following error:
lib/avr/IntelHexParse.cpp: In member function 'byte* IntelHexParse::GetData(byte*, int)':
lib/avr/IntelHexParse.cpp:86:1: error: no return statement in function returning non-void [-Werror=return-type]
86 | }
| ^
cc1plus: some warnings being treated as errors
*** [.pio/build/d1_mini/lib6f5/avr/IntelHexParse.cpp.o] Error 1
In my opinion, the parenthesis is where it is needed. But the compiler doesn't like it. :(
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 »

if you've cloned from my repo, grab the latest update and try again, I've just made a change.. Just note, I'm not sure if anyone uses the web interface, I went a different direction with charging.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Yahha777
Posts: 52
Joined: Wed Feb 27, 2019 7:03 am
Location: Belorussia. Borisov
Has thanked: 15 times
Been thanked: 1 time
Contact:

Re: Gen 3 inverter converter control software

Post by Yahha777 »

Bigpie wrote: Mon Dec 20, 2021 9:15 am if you've cloned from my repo, grab the latest update and try again, I've just made a change.. Just note, I'm not sure if anyone uses the web interface, I went a different direction with charging.
Thanks to! This update helped, everything compiles and loads! It remains to overcome the problem with DHCP
viewtopic.php?f=5&t=2001 :evil:
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 »

I reverse engineered the power board a little more and found that pin 30 is high rail OVP and pin 26 is low rail OVP. For my Prius C inverter, the trip points are 700V and 275V. (Could not determine exactly since I was using a CCFL inverter on a bench supply plus some rectifiers to supply the test voltage, with a small high voltage cap as the filter.) The 275V is very reasonable but 700V seems awfully high when the high rail cap is supposedly rated to 650V, I suspect overshoots happen in normal operation and the cap has a surge rating that accounts for it. It can make sense to add some logic to handle those fault conditions, what I'm coming up with is a flip flop that is tripped by the fault signals (disabling PWM using some additional gates) and is reset when the PWM from the controller is returned to off.

This leaves no signal from the power board for inductor current, which I find a little surprising. I suspect the ASIC on the original logic board knows the exact characteristics of the inductor and then calculates the current based on what voltage is applied to it based on the switching states. It's cheaper and more reliable than adding a sensor to measure the current and maybe it turns out the current sensing built into the transistors is less accurate than calculating. There is a pin that's not connected on the power board and a few blank spots on the board for opamps or something, I suspect it's for the current signal but was left out when they found little value in having it.

I plan to just install a sensor for my use, it's a lot easier than trying to reverse engineer the exact characteristics of the inductor and then write an algorithm to calculate the current taking into account all the nonidealities. I'm using a dsPIC for the controller since it has very good PWM resolution.
My first solar power system helped Naomi Wu, now I want to do even more with DIY solar.
Yahha777
Posts: 52
Joined: Wed Feb 27, 2019 7:03 am
Location: Belorussia. Borisov
Has thanked: 15 times
Been thanked: 1 time
Contact:

Re: Gen 3 inverter converter control software

Post by Yahha777 »

Hello everyone! Anyone have any success in getting data from atmega to wemos via the web interface? Atmega sends data to the port monitor, wemos sends the "params" command correctly and it is visible in pytty. I connect uart esp and atmega - there are no parameters in the web interface ...
atmega firmware:download/file.php?id=10638 from Bexander. ESP firmware: https://github.com/jamiejones85/PriusCh ... bInterface in which I changed the speed of the serial port from 57600 to 115200 (the same in atmeg) (I did the right thing?)
wemos_uart-message.png
atmega_uart-message.png
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 made changes to the firmware also for the parameters, https://github.com/jamiejones85/prius3charger_buck (out of date with Bexanders firmware), but I've not used or developed it further, I went with a different charging setup.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Yahha777
Posts: 52
Joined: Wed Feb 27, 2019 7:03 am
Location: Belorussia. Borisov
Has thanked: 15 times
Been thanked: 1 time
Contact:

Re: Gen 3 inverter converter control software

Post by Yahha777 »

Bigpie wrote: Tue Dec 28, 2021 8:08 pm I went with a different charging setup.
can you tell about it in more detail?
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've used an outlander charger due to my battery voltage and only having access to single phase. My full voltage is higher than rectified single phase so cannot use bucking.
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
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 »

Bigpie wrote: Tue Dec 28, 2021 8:57 pm I've used an outlander charger due to my battery voltage and only having access to single phase. My full voltage is higher than rectified single phase so cannot use bucking.
You can connect a bridge rectifier to the low voltage side of the boost converter and then use the boost converter to step it up.
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 »

I'd have to switch from bucking to boosting mid charge, my minimum voltage is below rectified mains voltage. The outlander charger was a simpler and cheap solution, though not as powerful.
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
TheSilverBuick
Posts: 187
Joined: Mon Jun 08, 2020 5:01 pm
Location: Nevada, United States
Has thanked: 3 times
Been thanked: 1 time

Re: Gen 3 inverter converter control software

Post by TheSilverBuick »

I'm about to put a control board into a Yaris inverter with the intent of using it for a battery charger. It looks like most of you are running it through 3-phase power, but can you confirm it will work on 240v single phase to charge a 144v battery pack? Thanks!
Need to learn. Starting from the basics.
Post Reply