Toyota Gen 3 inverter charger

Topics concerning the Toyota and Lexus inverter drop in boards
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 »

I'm happy to redo the board if we all agree on a common design.
I'm going to need a hacksaw
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Toyota Gen 3 inverter charger

Post by arber333 »

celeron55 wrote: Thu Jan 23, 2020 7:37 pm My ADC inputs from the inverter are as follows. These are Arduino pin names which translate to the atmega328 PC0...PC5, A6 and A7 pins:
- A0: DCBUS1 (output side, i.e. where the battery in a Prius is)
- A1: DCBUS2 (input side, i.e. MG1/MG2 HV rail)
- A2: Not in ADC use
- A3: MG2 L1 current (10k/10k resistor divider)
- A4: MG2 L2 current (10k/10k resistor divider)
- A5: BOOST T1
- A6: BOOST T2
- A7: COOLANT T

Is this the EMW charger code? https://github.com/dmills483/EMW-charge ... 21_V06.pde
What you quote is an old code for EMW charger, maybe V12 with no serial link and no PID interface. Current swings in the old version move as high as +/-5A. And you have to control it through a LCD with 2 button interface with long cable where buttons were tripped by themselves occasionally.

More modern code V14.7 i published couple of posts back. It includes LCD and serial interface, PID code and remapped pins to vary PWM frequency more and use more of the chip EEPROM for actual work.

EMW works by boosting single phase to 450Vdc and then bucking it to whatever is needed. That is why they use PFC chip to run the boost transistor at fixed output. Code only needs to control buck transistor. Boost is HW controlled.
Ok Here is the current pinout for AT328 in V14.7:
//========== analog pins
pin_C=0; // output current pin,
pin_bV=1; // output / battery voltage pin
pin_heatSinkT=2; // charger heatsink temp - for thermal derating
pin_12Vsense=3; // implementing undervoltage protection
pin_temp2=4; // spare pin prewired as temp input
pin_mV=5; // mains HV voltage sense pin
// const byte pin_mC=7; // needed only for full digital PFC control
//========== digital pins
// 0/1 reserved for serial comms with display etc
pin_pwrCtrlButton=2; // this is wired to the button1
pin_pwrCtrl2Button=3; // this is wired to the button2
pin_inrelay=4; // AC relay - precharge is prewired by 3x 330R 20W resistors across contactor
pin_outrelay=5; // output relay - this is needed for CHAdeMO
pin_DELTAQ=6; // deltaQ pin that was meant to get a digital enable to operate
pin_J1772=7; // J1772 pilot input. 1k is hardwired on V14+ pcbs so J1772 will power on on connect
pin_fan=8; // fan control or water pump control
pin_PWM=9; // main PWM pin!
byte pin_110relay=11; //We dont use this, can we use it for anything else?
pin_maxC=10; // max current reference voltage so that we can use higher PWM frequency 20kHz PWM
pin_EOC=12; // end-of-charge output (see pinout diagram) - pulled low when charge is complete
pin_BMS=13; // end-of-charge input from BMS. Pull low / disconnect from positive TTL signal to activate

This pinout was developed after quite a few versions and i find it to be most effective in 3phase buck configuration. No PFC needed then.
Yes even driving Chademo was considered with this charger, but like you said Arduino due was used because of more power. That code was proprietary.
But Prius inverter now can drive boost with very little HW changes.

I still think we do not need to reinvent the wheel for the first iteration. Code has already been written and at least in Europe 3phase is common for EVSE L2. Thus it will involve less programming work and people will understand it better. We can have a fully functioning product with nice interace out there soon and then work on Chademo unit with big processor and functions.
User avatar
celeron55
Posts: 776
Joined: Thu Jul 04, 2019 3:04 pm
Location: Finland
Has thanked: 28 times
Been thanked: 110 times
Contact:

Re: Toyota Gen 3 inverter charger

Post by celeron55 »

Under what license is the newest EMW charger code provided?

EDIT: Looks like it's not really a free license, and definitely not any well known one:
This software is released as open source and is free for any personal use.
Commercial use prohibited without written approval from the Author and / or Emotorwerks
Absolutely no warranty is provided and no guarantee for fit for a specific purpose

Original version created Jan 2011 by Valery Miftakhov, Electric Motor Werks, LLC & Inc.
All rights reserved. Copyright 2014
At some point we need some real open source software for charging that anyone can use freely. This one you need to ask for permission from EMW if you're doing a project for anyone other than yourself. Even a non-profit school project would require permission to be asked. Or if you sell your personal EV conversion in which you used the code.
MattsAwesomeStuff
Posts: 898
Joined: Fri Apr 26, 2019 5:40 pm
Has thanked: 291 times
Been thanked: 177 times

Re: Toyota Gen 3 inverter charger

Post by MattsAwesomeStuff »

celeron55 wrote: Fri Jan 24, 2020 9:31 amThis one you need to ask for permission from EMW if you're doing a project for anyone other than yourself.
Language barrier perhaps, but I don't think that's what's meant by "personal use". Personal use covers helping others.
Even a non-profit school project would require permission to be asked.
Under the Bern Convention (just about every country in the world has signed), there are agreed exemptions for copyright. One is educational use. A for-profit school would probably still be fine.
Or if you sell your personal EV conversion in which you used the code.
No, I don't think that's an issue. Something can be for personal use, and still sold.

"Commercial use" in common context would be like an EV shop selling them. Running a business that sells things is different than an individual who built their own vehicle that they owned, and then chose to sell the vehicle.

Regardless of license, factors for copyright exemption still apply. Also, every country defines and weighs these factors differently (for example, I believe either Spain or Switzerland put almost the entire weight on commercial use, so, for example, if you're pirating movies or music and not selling it, any copyright case is dead in the water. In the US, not as much so).

Also, they might've shot themselves in the foot by even using the term Open Source without a more expansive detailing of the license itself.

https://en.wikipedia.org/wiki/The_Open_ ... Definition

Anyway, a real open source project would be nice.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Toyota Gen 3 inverter charger

Post by arber333 »

celeron55 wrote: Fri Jan 24, 2020 9:31 am Under what license is the newest EMW charger code provided?

EDIT: Looks like it's not really a free license, and definitely not any well known one:
This software is released as open source and is free for any personal use.
Commercial use prohibited without written approval from the Author and / or Emotorwerks
Absolutely no warranty is provided and no guarantee for fit for a specific purpose

Original version created Jan 2011 by Valery Miftakhov, Electric Motor Werks, LLC & Inc.
All rights reserved. Copyright 2014
At some point we need some real open source software for charging that anyone can use freely. This one you need to ask for permission from EMW if you're doing a project for anyone other than yourself. Even a non-profit school project would require permission to be asked. Or if you sell your personal EV conversion in which you used the code.
Yeah well it is technically open source with limitations. But EMW is now not even a company brand https://evcharging.enelx.com/.
I can ask Valery if our community can further develop his work.
EDIT: Every aspect of V14 design is/was open to the public. Nothing hidden, not even the R2 uLCD protocol which Valery had quite some pains with.

I agree though if we want to make DIY portable L2 3phase chademo charger we need a new HW and SW base.
User avatar
celeron55
Posts: 776
Joined: Thu Jul 04, 2019 3:04 pm
Location: Finland
Has thanked: 28 times
Been thanked: 110 times
Contact:

Re: Toyota Gen 3 inverter charger

Post by celeron55 »

If they can release the code under a well known license without limitations, it could be a good base for further development. Otherwise it can be a stepping stone but new code has to be written from scratch, or maybe based on my code that I haven't released yet, or someone else's.

I don't know if CHAdeMO is a good goal for this at all, it's difficult to implement properly and not really useful for most EV projects.
User avatar
Kevin Sharpe
Posts: 1345
Joined: Fri Dec 14, 2018 9:24 pm
Location: Ireland and US
Been thanked: 4 times

Re: Toyota Gen 3 inverter charger

Post by Kevin Sharpe »

celeron55 wrote: Fri Jan 24, 2020 1:01 pm I don't know if CHAdeMO is a good goal for this at all, it's difficult to implement properly and not really useful for most EV projects.
Agreed... why not focus on CCS which is clearly the way forward for the DC interface to the EV 8-)
This is a personal post and I disclaim all responsibility for any loss or damage which any person may suffer from reliance on the information and material in this post or any opinion, conclusion or recommendation in the information and material.
User avatar
Kevin Sharpe
Posts: 1345
Joined: Fri Dec 14, 2018 9:24 pm
Location: Ireland and US
Been thanked: 4 times

Re: Toyota Gen 3 inverter charger

Post by Kevin Sharpe »

arber333 wrote: Fri Jan 24, 2020 12:45 pm EDIT: Every aspect of V14 design is/was open to the public. Nothing hidden, not even the R2 uLCD protocol which Valery had quite some pains with.
License is explicit though... no point putting effort into something that has these license restrictions.
This is a personal post and I disclaim all responsibility for any loss or damage which any person may suffer from reliance on the information and material in this post or any opinion, conclusion or recommendation in the information and material.
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 »

I think the oppertunity presented by the Prius/Yaris inverter for motor control and charging is too good to pass up. A few options :

1)Use EMW code for development proof of concept. As arber says we know it works and that use does not violate the license.
2)Perhaps use Johannes inverter charger code and an STM32 device in the next rev.
I'm going to need a hacksaw
martii
Posts: 10
Joined: Fri Mar 22, 2019 10:07 am
Has thanked: 2 times

Re: Toyota Gen 3 inverter charger

Post by martii »

celeron55 wrote: Fri Jan 24, 2020 1:01 pm I don't know if CHAdeMO is a good goal for this at all, it's difficult to implement properly and not really useful for most EV projects.
CHAdeMO is way easier to implement (just CAN) compared to CCS that needs some PLC device (more expensive?) and full TCP stack AFAIK.
User avatar
celeron55
Posts: 776
Joined: Thu Jul 04, 2019 3:04 pm
Location: Finland
Has thanked: 28 times
Been thanked: 110 times
Contact:

Re: Toyota Gen 3 inverter charger

Post by celeron55 »

Kevin Sharpe wrote: Fri Jan 24, 2020 1:04 pm
celeron55 wrote: Fri Jan 24, 2020 1:01 pm I don't know if CHAdeMO is a good goal for this at all, it's difficult to implement properly and not really useful for most EV projects.
Agreed... why not focus on CCS which is clearly the way forward for the DC interface to the EV 8-)
martii wrote: Fri Jan 24, 2020 5:39 pm
celeron55 wrote: Fri Jan 24, 2020 1:01 pm I don't know if CHAdeMO is a good goal for this at all, it's difficult to implement properly and not really useful for most EV projects.
CHAdeMO is way easier to implement (just CAN) compared to CCS that needs some PLC device (more expensive?) and full TCP stack AFAIK.
Well I didn't mean that. What I mean is CHAdeMO simply isn't a good application for this Toyota inverter charger project due to it not being directly suited for it. (And I hate CCS, but that's not the topic of this discussion. The inverter is even less suitable for CCS of course.)
User avatar
celeron55
Posts: 776
Joined: Thu Jul 04, 2019 3:04 pm
Location: Finland
Has thanked: 28 times
Been thanked: 110 times
Contact:

Re: Toyota Gen 3 inverter charger

Post by celeron55 »

Back to the actual topic at hand:

If I were to design the boost converter section with charging in mind, I would make sure it's capable of working as a charger independently of the STM32 motor control portion. I also like to integrate things on CANbus.

This makes it important for the charger atmega328 to:
- have its own access to the CANbus (maybe MCP2515 + some PHY) and
- be able to directly ADC the
- input and output voltage
- the MG1 currents
- the boost and coolant temperatures and
- read the EVSE PWM signal (with correct diode+pulldown to activate an EVSE).
- In addition to that it needs an analog input for an extra current sensor at the output when accurate current control is desired (I think the EMW software requires this sensor).
- I guess some users want to have some buttons or an LED directly wired to it. Personally I would just implement charger UI on some display device on the CANbus.

The exact pinout doesn't really matter as long as
- a high resolution PWM pin is connected to the half bridge high side input and
- the EVSE PWM is connected to an external interrupt capable pin.
- If I can have my MCP2515, it of course has to live at the SPI pins.
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's all very doable.
I'm going to need a hacksaw
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Toyota Gen 3 inverter charger

Post by arber333 »

I am not inclined of using Prius current sensors for charger function. It is on the wrong side and the mechanism which would control output definitely has some phase shift. Not a good idea anyways also for CAN control.

My application is designed around ACS758LCB-100U sensor. I am sure we wont need more :).
What i did is solder the ACS758LCB-100U onto the positive battery track of large cap and then used dremel cutter to cut the track between sensor prongs. Then i reinforced the joint with some PCB plastic sheet and generous ammount of gasket sealant. Sealant hardens and provides good adhesion to reinforce soldered track against vibration.
IMG_20200124_210049.jpg
IMG_20200124_210104.jpg
Charger board design includes space for 3x relays. One AC/DC relay, one liquid pump relay and enable relay for DCDC part and interlock function. This means if i have connected charger then car wont drive as well as charger wont function if car is started.
IMG_20200124_210123.jpg
Another option would be to cut/remove the positive track from the cap and use a 10mm2 cable and 100A rated 5V hall current sensor. It would require some calibration in software but would maybe be cleaner installation. See here how i would cut positive track from Yaris cap and install cable from that bolt to positive battery connection. Current sensor could be some 100A LEM on the side.
IMG_20200124_211552.jpg
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Toyota Gen 3 inverter charger

Post by arber333 »

celeron55 wrote: Fri Jan 24, 2020 5:49 pm Well I didn't mean that. What I mean is CHAdeMO simply isn't a good application for this Toyota inverter charger project due to it not being directly suited for it. (And I hate CCS, but that's not the topic of this discussion. The inverter is even less suitable for CCS of course.)
What would be your caveat in using Chademo protocol with Toyota inverter chargers? I think f we use charger as the source of CC at specified voltage that is drawn from 3phase home charging plug directly into a Leaf then we got a winner.
Not only is the Leaf charged at fast 11kW rate also the network doesnt suffer since the load is then much more uniform.
also you could charge at 22kW at L2 EVSE directly into a chademo port. Only Zoe and Smart EV have such a fast L2 charging capability as far as i know.

Now last one is a bit stretched, but what about open chademo V2G and V2H? This charger would suitt perfectly if we would implement Boost-Buck function in the same process. But i think this could be made only with STM32 or similar chip.
User avatar
celeron55
Posts: 776
Joined: Thu Jul 04, 2019 3:04 pm
Location: Finland
Has thanked: 28 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: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 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: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 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: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 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 124 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: 776
Joined: Thu Jul 04, 2019 3:04 pm
Location: Finland
Has thanked: 28 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
Post Reply