Toyota Gen 3 inverter charger

Topics concerning the Toyota and Lexus inverter drop in boards
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: Toyota Gen 3 inverter charger

Post by celeron55 »

Well, I am assuming a Leaf will shut down when you try doing that, due to the inverter not having free floating isolation from ground. I could be wrong.
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Toyota Gen 3 inverter charger

Post by arber333 »

celeron55 wrote: Fri Jan 24, 2020 11:55 pm Well, I am assuming a Leaf will shut down when you try doing that, due to the inverter not having free floating isolation from ground. I could be wrong.
Hah if only THAT. I am using my charger - non isolated for 5years now and never I had PROBLEMS with that. Well never in normal use. Once a glob of mud got into the unprotected charging port and all Evse L2 would throw a ground fault.
My charger is on rubber blocks so isolated from GND. We would just have to be careful.
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: Toyota Gen 3 inverter charger

Post by Jack Bauer »

Arber I really like that current sensor setup. What I'm going to do here is adapt the Prius/Auris boards to use the EMW code (which will allow for future development of non restricted code anyway) and test. I'm happy to supply a board or two then to anyone willing to help with the development.
I'm going to need a hacksaw
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: Toyota Gen 3 inverter charger

Post by Jack Bauer »

Arber, how are you connecting the esp wifi module to the emw atmega?
I'm going to need a hacksaw
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Toyota Gen 3 inverter charger

Post by arber333 »

Jack Bauer wrote: Sat Jan 25, 2020 1:17 pm Arber, how are you connecting the esp wifi module to the emw atmega?
Yes I connect wemos d1 directly to at328 programming pins tx rx. Yes Nano is 5v chip and I use 5v and GND pins of the board for d1 supply. UART pins are 5v tolerant.

If you use one power section for MG control and one for rectifier you must add some sort of interlocking so neither is able to work if other is already turned on.
I can send you my current layout if it will help with EMW schematic. I had some problems due to Prius IGBT turn on signal. Let’s avoid making same mistakes.
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: Toyota Gen 3 inverter charger

Post by Jack Bauer »

That would be great. Thanks Arber. I also remember compiling the emw code was a nightmare that needed a specific version of the arduino ide. Is this still the case?
I'm going to need a hacksaw
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Toyota Gen 3 inverter charger

Post by arber333 »

Jack Bauer wrote: Sat Jan 25, 2020 1:58 pm That would be great. Thanks Arber. I also remember compiling the emw code was a nightmare that needed a specific version of the arduino ide. Is this still the case?
Yes and no. It still needs Arduino V0.22 because of various dependences. But luckily i have that in one package. Once everything is compiled its a breeze. Alternatively i can post .bin file of the very basic compilation.

I really hoped PaulDBs version would get rid of .pde file but i am not sure which version he used for his work. Well that does not mattter now since serial interface is accessible thanks to Dima. I imagine uLCD would be used only in the case if one would build everything acc to EMW plans. As it is now Toyota reads voltage with 5V signal and EMW used ISO124 dual op amp in the same way. So now in firmware we only emulate resistor divider values and we get the correct reading down to a volt or so.

I have a Ampera battery in my Pug now so i need to get inverter to the car and setup everything to test on 3phase 600V.
There is where i posted the code that works for me.
viewtopic.php?f=14&t=257&start=50#p5663
Also you need ibraries that i append here:
Attachments
libraries.rar
(240.36 KiB) Downloaded 116 times
PatrykS
Posts: 38
Joined: Mon Jan 06, 2020 11:22 pm
Been thanked: 1 time

Re: Toyota Gen 3 inverter charger

Post by PatrykS »

Jack Bauer wrote: Sat Jan 25, 2020 1:03 pmI'm happy to supply a board or two then to anyone willing to help with the development.
I got Yaris inverter, some experience in electronics and programming (including Arduino with ATmega328, also in CAN and in CHAdeMO), a battery from Outlander and 3 phase socket in the garage. Can't guarantee a lot of time for that, but that's quite interesting project, especially to retrofit existing EVs with fast AC charging.
PatrykS
Posts: 38
Joined: Mon Jan 06, 2020 11:22 pm
Been thanked: 1 time

Re: Toyota Gen 3 inverter charger

Post by PatrykS »

I have added my Yaris inverter to the wiki: G9200-52010, F1759-52010 04, F1789-52010, 154x143mm.
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: Toyota Gen 3 inverter charger

Post by celeron55 »

I finally converted my CHAdeMO-ish test charger to an on-board charger and installed it into my 1992 Previa. It's currently managing 16kW 24A 3 phase (that's input power, and efficiency isn't the best), but somehow stumbling at 17-22kW. 16kW is fairly fast already though, from these ubiquitous and reasonably priced Type 2 charge stations.

I tested it without coolant flow, and it could manage almost 1kWh of charging until it got too hot. My temperature sensor calibration is probably wrong, but my software limited it to what it thought was 70°C, from a starting temperature of maybe 5°C (didn't check) (very scientific, LOL).

The inside of the inverter still looks like this, just with some cables added towards the external world and with insulation added around the obvious places: viewtopic.php?p=3840#p3840

Added externally to the inverter: 32A 3 phase circuit breaker + AC RCD (the RCD part is unnecessary as you want to power this through a DC capable one externally - altough that's expensive), an overkill contactor (50A? 63A? don't remember) and precharge contactor to make sure the input terminals will not stay live after charging no matter how badly the thing explodes, an universal-ish control PCB modified for this use with two Arduino Nano clone boards (connected via SPI to each other - one does the charging algorithms, PWM and CANbus comms, the other one reads the EVSE CP PWM and PP resistance and controls two LEDs in the charging connector) and a 12V power supply tuned up to 13.5 or so volts. It connects to the rest of the car via CANbus, a 12V "ignition" signal to power up the rest of the car and 16mm² HV+ and HV- cables connected into the rest of the system via a 100A fuse.
20200303_204633.jpg
Pros and cons of this approach compared to a Tesla OBC?

Well...

It's loud, potentially cheap, and lots of work. When I have the charger and the Eberspacher diesel heater in use at the same time, this minivan sounds like a jet engine.

Here it mounted to the Previa:
photo5992185659978265211.jpg
20200308_175455.jpg
photo5992185659978265269.jpg
Darrenptalbot
Posts: 4
Joined: Sun Oct 13, 2019 7:57 am

Re: Toyota Gen 3 inverter charger

Post by Darrenptalbot »

This is great news, but in keeping with the Open Source approach, any wiring diagrams etc, so we can all help move this forward?
celeron55 wrote: Sun Mar 08, 2020 8:14 pm I finally converted my CHAdeMO-ish test charger to an on-board charger and installed it into my 1992 Previa. It's currently managing 16kW 24A 3 phase (that's input power, and efficiency isn't the best), but somehow stumbling at 17-22kW. 16kW is fairly fast already though, from these ubiquitous and reasonably priced Type 2 charge stations.

I tested it without coolant flow, and it could manage almost 1kWh of charging until it got too hot. My temperature sensor calibration is probably wrong, but my software limited it to what it thought was 70°C, from a starting temperature of maybe 5°C (didn't check) (very scientific, LOL).

The inside of the inverter still looks like this, just with some cables added towards the external world and with insulation added around the obvious places: viewtopic.php?p=3840#p3840

Added externally to the inverter: 32A 3 phase circuit breaker + AC RCD (the RCD part is unnecessary as you want to power this through a DC capable one externally - altough that's expensive), an overkill contactor (50A? 63A? don't remember) and precharge contactor to make sure the input terminals will not stay live after charging no matter how badly the thing explodes, an universal-ish control PCB modified for this use with two Arduino Nano clone boards (connected via SPI to each other - one does the charging algorithms, PWM and CANbus comms, the other one reads the EVSE CP PWM and PP resistance and controls two LEDs in the charging connector) and a 12V power supply tuned up to 13.5 or so volts. It connects to the rest of the car via CANbus, a 12V "ignition" signal to power up the rest of the car and 16mm² HV+ and HV- cables connected into the rest of the system via a 100A fuse.

20200303_204633.jpg

Pros and cons of this approach compared to a Tesla OBC?

Well...

It's loud, potentially cheap, and lots of work. When I have the charger and the Eberspacher diesel heater in use at the same time, this minivan sounds like a jet engine.

Here it mounted to the Previa:

photo5992185659978265211.jpg

20200308_175455.jpg

photo5992185659978265269.jpg
User avatar
clanger9
Posts: 203
Joined: Mon Oct 28, 2019 7:41 am
Location: Chester, UK
Been thanked: 1 time
Contact:

Re: Toyota Gen 3 inverter charger

Post by clanger9 »

Nice work! Any chance you can post the Arduino source? This will help make the Gen 3 inverter super-useful...
RetroZero
Posts: 702
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 311 times
Been thanked: 38 times
Contact:

Re: Toyota Gen 3 inverter charger

Post by RetroZero »

Oh, is this an open source solution? Excellent advancement!
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: Toyota Gen 3 inverter charger

Post by celeron55 »

Darrenptalbot wrote: Mon Mar 09, 2020 11:29 am This is great news, but in keeping with the Open Source approach, any wiring diagrams etc, so we can all help move this forward?
This is really just proof of concept, you really don't want to repeat all the hacks I made to get this running.

But I just proved it will work, once it's done without hacks.

So.

Concern 1:

What if, instead of having to add a current sensor, the boost converter already has one, and we haven't found it? See second paragraph: viewtopic.php?p=7601#p7601

It's a royal pain to tear down the charger now to check out a couple of signals while it's running. Could someone with a gen3 inverter on a test bench check those?

I still am not using an added current sensor, the charger simply adjusts its PWM very slowly, which works fine for charging a battery. When it detects something weird happening, it simply resets the PWM to 0 which can be done quickly without fast measurements and starts rising it slowly again. But if there is a current sensor already in the boost converter, I'd like to use it.

Concern 2:

Whoever is designing EMW compatible boards: I noticed that for an EU style Type 2 connector you also need to read the PP pin resistance to ground to know what the amperage of the bring-your-own-cable is. The cable can be 16A and the charger 24A, 32A or higher, and the charger doesn't necessarily lower its CS pin PWM accordingly, in which case it's up to the vehicle to not pull more than the cable can handle.

If not already, this starts to bring the pin count higher than an atmega328 can do; should we switch to for example an atmega256 to have compatibility with code designed for the atmega328 but enough i/o for this application, or have dual atmega328 like I'm running now for spreading both the i/o and the processing?

Concern 3:

I never got any of those esp wifi modules nor the huebner inverter configuration web interface working that you seem to be using on everything, so I don't feel I should be designing any boards or software when everyone wants to use exactly those. I just add a waterproof USB panel connector to my things to program and diagnose them; it's simple and works.

But this will be open source if I get it to a non hacky state that is actually repeatable.
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: Toyota Gen 3 inverter charger

Post by celeron55 »

Also to whoever is designing EMW compatible boards: I'd like to have one, once there is one. The current V2 inverter control board is certainly not suited for this. I will port my software on it, test it and share the software and the remaining board modifications required.

I also noticed I just happen to have some ACS758LCB-100B current sensors in my component box so I can install one if it's necessary for the board design.
User avatar
clanger9
Posts: 203
Joined: Mon Oct 28, 2019 7:41 am
Location: Chester, UK
Been thanked: 1 time
Contact:

Re: Toyota Gen 3 inverter charger

Post by clanger9 »

Proof-of-concept is good! It’s interesting to learn about your hacks/workarounds (however ugly ;-). We like ugly.
There’s a few of us here would like to help develop this into a usable solution...
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: Toyota Gen 3 inverter charger

Post by celeron55 »

Do we, by the way, have a standard CANbus protocol for a charger talking with a BMS? Publishing code that talks my own protocol doesn't make much sense when there could be an open protocol.

This proof of concept charger communicates with my BMS:
- to know whether charging is permitted at the moment (mainly depends on battery temperature and charge state),
- to know when the BMS considers the charging to be complete,
- to know whether the main contactor is closed and the BMS is promising to keep the main contactor closed for the next few seconds
- to know what maximum current the BMS allows for charging at the moment
- to send a request to close the main contactor for charging

The charger also sends a message for disabling the inverter so that the car can't be driven when charging.

Also in my conversion the charger must act as a DC power source for powering the coolant heater and DC-DC converter without the main contactor being closed when the battery is below 0°C, so that the battery can be heated with AC power without causing any potentially damaging current flow to/from the battery. The heater HV contactor, pumps and solenoid valves are controlled by other modules that talk on the bus.

Is there any ongoing effort to have a plug and play protocol?
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: Toyota Gen 3 inverter charger

Post by celeron55 »

Okay to reply to myself again, here's something:

https://openinverter.org/wiki/Introduction_CAN_STD
https://openinverter.org/wiki/CAN_table_CAN_STD

For the charger, seems to be pretty far from anything I need.

For the BMS, the Simp BMS messages don't seem fleshed out enough to be usable as-is, but could be a starting point.
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: Toyota Gen 3 inverter charger

Post by Jack Bauer »

So I'm going to be ordering some more gen 3 boards from jlc soon. @Celeron55 Would you like to suggest what pins on the atmega328 go where and then I can send you some boards?
I'm going to need a hacksaw
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: Toyota Gen 3 inverter charger

Post by celeron55 »

Jack Bauer wrote: Sun Mar 15, 2020 2:36 pm So I'm going to be ordering some more gen 3 boards from jlc soon. @Celeron55 Would you like to suggest what pins on the atmega328 go where and then I can send you some boards?
I'd try something like this:

PB0: MCP2515 CS
PB1: Boost low side switch output (OC1A)
PB2: Boost high side switch output (OC1B)
PB3: MOSI in ISP connector for flashing, also connect to an MCP2515
PB4: MISO in ISP connector for flashing, also connect to an MCP2515
PB5: SCK in ISP connector for flashing, also connect to an MCP2515, also an on-board indicator LED (common feature in arduinos at this pin, as it is arduino pin 13)

PC0: Bus 1 voltage
PC1: Bus 2 voltage
PC2: Boost temperature 1
PC3: Boost temperature 2
PC4: MG1 L1 current via a 10k/10k voltage divider (or so)
PC5: MG1 L2 current via a 10k/10k voltage divider (or so)
PC6: RESET in ISP connector for flashing, 10k pullup to 5V

ADC6: Input from an added ACS758LCB-100U output current sensor, route to a connector with: 1. GND, 2. this pin, 3. VCC 5V (maybe include RC filter for signal)
ADC7: EVSE Proximity Pilot (PP) input (*), with 330 Ohm pullup to 5V. This probably also needs a small capacitor for noise filtering.

PD0: UART RX: Route to some connector for either debugging, esp wifi or programming via arduino bootloader
PD1: UART TX: Route to some connector for either debugging, esp wifi or programming via arduino bootloader
PD2: EVSE Control Pilot (CP) input (*), via a diode, with a 2.74k pulldown to ground after the diode, and a switchable additional 1.3k pulldown to ground. It's a PWM signal that has to vary in amplitude between 12V and smaller values, so connect via a 10k resistor to the mcu pin. This probably also needs a small capacitor for noise filtering. (external interrupt INT0 pin)
PD3: MCP2515 INT (external interrupt INT1 pin)
PD4: Output for controlling the EVSE CP (*) 1.3k pulldown transistor.
PD5: Output for input side main contactor control, let's say 12V 3A output (MOSFET pull to ground?)
PD6: "Ignition" output that allows the charger to power up the BMS, coolant pump relays and whatnot, let's say 2A output with a PPTC for current limiting, or possibly a smart switch. (Of course connected to some external connector, via a diode so that the ignition key can also power the line) (Could also be connected to some external connector via another diode, to light up a "charger active" LED) (**)
PD7: Output for input side precharge contactor control, let's say 12V 3A output (MOSFET pull to ground?)

* For the two EVSE lines, refer to https://upload.wikimedia.org/wikipedia/ ... ircuit.gif

** I've used BTS5215LAUMA1 for foolproof 3A 12V outputs in other projects.

This is really tight for pins.

Maybe drop L1 and L2 current inputs and instead add outputs for a "charging" and an "error" LED? Not sure how important either would be here.
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: Toyota Gen 3 inverter charger

Post by Jack Bauer »

Cool thanks. I'll make this happen and get some boards on the way.
I'm going to need a hacksaw
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: Toyota Gen 3 inverter charger

Post by celeron55 »

Edited the post a bit to add important missing details.

I'm a bit worried about signal conditioning for the EVSE PP (resistance) and CP (PWM) measurement. There will be lots of noise from the charging cable. I hope we can get away with RC filters, one with a long time constant for PP and one with something like 20µs for CP.

My current version has no filtering, and it's getting too much noise in the CP pin for reliable PWM measurement.

I think the standard says something along the lines of the charger having to adjust its current within 5 seconds from the PWM changing while charging, so it has to be measured and acted upon while charging noise is present.
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Toyota Gen 3 inverter charger

Post by arber333 »

celeron55 wrote: Sun Mar 15, 2020 7:55 pm
I'm a bit worried about signal conditioning for the EVSE PP (resistance) and CP (PWM) measurement. There will be lots of noise from the charging cable. I hope we can get away with RC filters, one with a long time constant for PP and one with something like 20µs for CP.
PP is only there to signal EVSE what is the cable capacity. It works from PP to resistor and then to PE. There is no need to use it in your circuit.
CP on the other hand is the one used. You only want to pickup the signal AFTER the diode and resistor pair. You want to add a relay which pulls 1K3 in paralel to 2K7 and GND. Some EVSE need comfirmation that chip has decided to charge.
https://mazdamx3ev.wordpress.com/2018/0 ... nica-evse/
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: Toyota Gen 3 inverter charger

Post by celeron55 »

I won't trust EVSEs to act correctly based on PP, so I will read it myself also. Melting a cable because someone else messed up isn't cool when you could have easily avoided doing so.
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: Toyota Gen 3 inverter charger

Post by celeron55 »

The power supply design on the board should be such that the charger atmega328 can be always powered while the rest of the inverter is powered only in an ignition key ON state, or when the atmega328 activates the "ignition" signal that is also sent to elsewhere in the vehicle.

For this a separate low quiescent current linear regulator might be needed for the atmega328 in order to not cause a significant drain on the 12V system while the charger is in standby and car is turned off. In this state the atmega328 will periodically wake up to measure the EVSE signal lines.

That way the charger can appropriately wake up, listen and signal to the EVSE before the EVSE has applied power to the charging cable, without the ignition key being active, and the charger doesn't need a separate 12V power supply from mains.
Post Reply