Page 1 of 10

Prius Gen2 Adapter Board for CHARGING

Posted: Tue Oct 06, 2020 11:05 am
by RetroZero
Hope everyone is OK with me setting up a new Topic for using Prius Gen 2 and Adapter board in CHARGE MODE.

Latest Update software means Charge Function requires BUCK MODE when using MG1 as rectifier and have battery connected to stock battery input

So if I understand correctly:
1 - FORWARD and REVERSE signals HIGH (inverter in RUN Mode) AND HV DC contactors OPEN - No connection to 200V battey.
2. CPWM with 470R to switch Charge mode - HIGH
3. Precharge DC to rectified AC (One 400W halogen light for the moment) with connections as mentioned in previous post.
4. Set duty cycle (40% = 320V down to 200 V) (I noted, the higher the duty cycle, the higher the voltage)
5.Close DC contactor and AC Main contactor at same time. (To be confirmed)

For the "switch to PI charge controller", this would be the regulation of current and/or voltage into the Battery Pack?
From my basic automotive electrics undertsanding, If the potential is different between two batteries, there will be a transfer of current to balance each other. The greater the difference, the greater the current flow.

So if I set duty cycle "a bit higher" than pack voltage, I will have a current flow towards pack. If I set it to around 10 Amps MAX (Ampmeter on HV Cable), I could monitor it over a few hours of charging. (the simple way until BMS knowledge is improved)

From what I understand, using Johu's existing Wiki diagram, and previous discussions, this would be the correct wiring set up to the Inverter for CHARGE MODE.
This is my understanding, and hope to post on the Wiki (If forum agrees) IF it's correct!

Blow up your Inverters at your own risk :!: (Had to do the disclaimer slogan) ;)
testing i
EDIT- Modified Relay K4 / P4 output to +12v supply relay K5 / S4 (allows for Main DC Contactor to close at same time as AC contactor)
No Precharge required on DC connection to battery - To be confirmed

Deleted schema untill more complete testing is caried out.

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Tue Oct 06, 2020 5:57 pm
by RetroZero
I thought if running a few "LY4 12v 8 pin" relays to switch AC side... Any other easy options to suggest?

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Tue Oct 06, 2020 6:04 pm
by ZooKeeper
I am going to plan on using a second Leaf relay board, since I will end up with two anyway :D

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Tue Oct 06, 2020 6:45 pm
by johu
Basically step #4 in your list is not yet implemented, charge mode only knows PI control. But it can be worked around. Also you must set chargemode to "boost" (which is a bit counter-intuitive because we are bucking)
So to set dutycycle to a given value just use the limiting parameter "chargemax" to the dutycycle you want and chargecur to non-zero value. Well, had I not forgotten to actually implement that parameter - new firmware later... Until then you can set chargeki=0 play with chargekp until you get your duty cycle.

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Tue Oct 06, 2020 7:35 pm
by LRBen
I'm glad you made a new thread for charging. I've been wondering a couple of things recently regarding the charging capabilities and didn't really want to go on that tangent on the main thread.

Is there an upper limit to what this inverter can charge? From the original thread it looks like it's ideal for a 200v battery. I'm considering running a 120s battery for 444v nominal and 504v max charge. I know the IGBTs are fine for this and MG2 should be fine to run this to the motor.
But I am uncertain if MG1 could charge this battery setup from 240v AC.

My understanding is that it will rectify 240vac to 320vdc and it can then buck that voltage down as required. But I don't know if it can also boost it up or if I would require three phase 415vac input.

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Tue Oct 06, 2020 8:19 pm
by rstevens81
LRBen wrote: Tue Oct 06, 2020 7:35 pm
Is there an upper limit to what this inverter can charge? From the original thread it looks like it's ideal for a 200v battery. I'm considering running a 120s battery for 444v nominal and 504v max charge. I know the IGBTs are fine for this and MG2 should be fine to run this to the motor.
But I am uncertain if MG1 could charge this battery setup from 240v AC.

My understanding is that it will rectify 240vac to 320vdc and it can then buck that voltage down as required. But I don't know if it can also boost it up or if I would require three phase 415vac input.
As the minimum voltage if your batteries is greater than 320v, (2.67v @ 320v) you could use the motor as an inductor and boost upto the required voltage (see wiki for diagram) that way you would only be using mg2 and no need to worry about mg1 buck/boost converter.

https://openinverter.org/wiki/Battery_Charging

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Tue Oct 06, 2020 9:36 pm
by ZooKeeper
There certainly are some minor advantages to boost charging from 120v mains here in the US. Given the utter lack of 240V outlets, or local charging stations, I think that will be my plan. Especially since my conversion is not intended for "trips", but only as a local "grocery getter" as it were.

Now, to read, re-read and re-re-read the Battery Charging Wiki and design the external wiring :)

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Tue Oct 06, 2020 9:41 pm
by johu
rstevens81 wrote: Tue Oct 06, 2020 8:19 pm As the minimum voltage if your batteries is greater than 320v, (2.67v @ 320v) you could use the motor as an inductor and boost upto the required voltage (see wiki for diagram) that way you would only be using mg2 and no need to worry about mg1 buck/boost converter.

https://openinverter.org/wiki/Battery_Charging
Sorry, with the gen2 inverter you cannot. For motor based charging only one of six IGBT is used. They 5 other ones must be OFF. In the Gen2 always 3 IGBTs are ON.

The integrated DC/DC converter (the X -> 12V one) is only populated with 400V caps, so when running the Gen2 inverter at more than 400V I'd disconnect the DC/DC completely. By default the upper buck/boost converter IGBT is on and conducts the inverter DC link voltage to the DC/DC converter.

My current take is that packs above 300V max cannot be charged.

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Wed Oct 07, 2020 4:56 am
by LRBen
Perfect thank you for the information. I will add this charging information to the wiki tonight.

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Wed Oct 07, 2020 5:58 am
by RetroZero
Yes, re-read and re-read the wiki.... So say by some miracle, the nice wiki diagram I butchered is correct for the Gen 2 inverter, and I sourced contacters, and disconnected MG1, where would the PI charge control fit to regulate current and voltage?

I will attempt Johu's run around option first, but might as well go into the deeper and finer details. We are playing with lithium batteries after all.

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Wed Oct 07, 2020 6:11 am
by RetroZero
PI control is Proportional - Integral Control right?
This means we're measuring currents and voltages at Input and Output(of inverter) , comparing them, and then with some magic codes, adjust the PWM duty cycles to supply constant "corrected" value to the battery (which we would have to know/calculate before)?
Is this where ISA Shunt comes in?

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Wed Oct 07, 2020 7:13 am
by RetroZero
ZooKeeper wrote: Tue Oct 06, 2020 9:36 pm There certainly are some minor advantages to boost charging from 120v mains here in the US. Given the utter lack of 240V outlets, or local charging stations, I think that will be my plan. Especially since my conversion is not intended for "trips", but only as a local "grocery getter" as it were.

Now, to read, re-read and re-re-read the Battery Charging Wiki and design the external wiring :)
You could also use a transformer 110V to 240V?? Would simplify things maybe? I'm off hunting for contactors and bits today.....Can't complete fine tuning my bench set-up as the Prius battery pack is not holding charge. 8-) I hope my diagram is correct :roll:

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Wed Oct 07, 2020 7:41 am
by johu
The board measures the AC input current into MG1. It just selects the current sensor that is most active. So may be best to connect AC to one phase without current sensor and one with.
Now it will software-rectify that current (while the diodes in MG1 hardware rectify it), low pass filter it, and compare the measured current with the set current "chargecur". It will then accumulate the difference between the two. The PWM duty cycle is then calculated like

Code: Select all

PWM = Kp * error + Ki * accumulated_error / pwm_freq
Note that no voltage is ever used. Note also that we are controlling input current, not output current - because we have no output current sensor.

Due to the fast cycle time of the charge controller the proportional part will improve the power factor because it increases the duty cycle as the sine nears the valley and decreases it when it nears its peak. Of course that works much better with boost charging.

Now I'll just brain storm at how to be able to boost charge with a Gen2 inverter when U_ac,peak < U_battery
  • Can't use MG1 as rectifier anymore, because our input current must now come from "the other side" of the buck/boost converter, i.e. from the stock DC input
  • Thus we need an external rectifier
  • We could permanently enable one phase leg (with current sensor) of MG1 to be able to measure OUTPUT current with an MG1 sensor
  • B- connected to DC bus -
  • B+ connected to said MG1 phase leg
  • no difference software-wise

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Wed Oct 07, 2020 8:18 am
by RetroZero
Just edited first post and "Butchered" Wiki Diagram.

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Wed Oct 07, 2020 9:42 am
by RetroZero
Any ideas on 10 Pin relay (K5) and 8 pin relay (K4) ?
Requires 12v_dc for switching 220 v_ac. Seems very specific, and the few I found, well, thank goodness I was sitting down.

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Wed Oct 07, 2020 2:16 pm
by johu
The German term is Koppelschütz. Like this one here: https://www.ebay.de/itm/Siemens-3RH1140 ... Sw8Y5fPRV-

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Wed Oct 07, 2020 4:10 pm
by RetroZero
Thanks, doing it 'the manual way' tonight. I am the relays...
This is what I understand from set up procedure instructions
"Connect CPWM to 12v via 480 ohn resistor for Charge mode... Looks correct?

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Wed Oct 07, 2020 4:33 pm
by johu
Yes

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Wed Oct 07, 2020 5:08 pm
by RetroZero
OK, I manage to get Boost Mode (no Ac connected as yet)
MacGyver precharge system in place.
Have 12 volt battery connected to HV DC side of inverter.
Next stupid question... How to set Duty Cycle in Parameters?

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Wed Oct 07, 2020 6:18 pm
by RetroZero
johu wrote: Wed Oct 07, 2020 2:16 pm The German term is Koppelschütz. Like this one here: https://www.ebay.de/itm/Siemens-3RH1140 ... Sw8Y5fPRV-
Sorry for being a bother, I have seen heaps of these, but the switching voltage is 24 Volts. From my little "Google" research, it's not going to be enough to switch the relays.. Should I get a boost module for the switching side?

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Wed Oct 07, 2020 6:21 pm
by johu
The Sirius contactor I have works fine from 12V so I'm hoping the entire series will

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Wed Oct 07, 2020 6:30 pm
by RetroZero
OK, thanks

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Sat Oct 10, 2020 8:53 am
by RetroZero
Whilst waiting on those relays, I went back and re-read the last few posts after some "research".
So Duty Cycle is calculated by the difference between Current IN and the value of "chargecur" set manually in Parameters. There is no way to set Duty Cycle "manually".?
Say that I got that part right, what about voltage.
If I want to copy Johu's video on the wiki, and start testing with lower voltage, to recharge 12v battery with 1A, setting "udcmin" and "udcmax" will take 320vdc and buck it down to within these parameters? ( example 12v min and 14v max)

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Sat Oct 10, 2020 9:08 am
by johu
No easy way to set DC manually, yes. The charge controller only uses the 3 parameters "chargekp", "chargeki" and "chargecur", everything else is irrelevant.
It is all a bit special with the Prius buck/boost converter because either the top or bottom IGBT are always on. Very annoying. When I get my new Prius inverter on the bench I think I will make a video about charging to make it clear.

viewtopic.php?f=14&t=701&p=12856#p12856

Re: Prius Gen2 Adapter Board for CHARGING

Posted: Sat Oct 10, 2020 4:14 pm
by RetroZero
So for example I want to charge up original Prius pack for testing: 5amps to max of 210VDC (trickle charge to avoid overheating)

Udcmax is set to 215v ( max battery voltage allowed)
Udcsw or Udcnom = 210v (for now the maximum voltage allowed when charging)? (28 modules with max 7.5V average per module)
Chargeki (integral) = 0
Chargekp (proportional) = >0 A - set low and increase whilst monitoring amps to HV Battery? (using ampmeter on HV + cable)
Chargecur = 5amps (amount of current we allow INTO the inverter in Boost mode )?

Chargemax is not used on Gen2 inverter?
Did I just let out the black Japanese dust?