Have a look at the SimpBMS manual for the info. https://github.com/Tom-evnut/SimpBMS/bl ... 0V0.29.pdfbigdaveakers wrote: ↑Mon Jan 30, 2023 7:48 pm So I see that the charge hysteresis actually defines the where the battery will charge to.
Outlander VCU - Rear inverter, Charger and BMS
- tom91
- Posts: 2295
- Joined: Fri Mar 01, 2019 9:15 pm
- Location: Bristol
- Has thanked: 199 times
- Been thanked: 524 times
Re: Outlander VCU - Rear inverter, Charger and BMS
-
- Posts: 51
- Joined: Fri Mar 04, 2022 11:46 am
- Has thanked: 5 times
- Been thanked: 5 times
Re: Outlander VCU - Rear inverter, Charger and BMS
I did, and while it gives a brief description of the variables it does not fully describe their interactions and effects on the different stages of the process. I wasn't expecting the hysteresis, for example, to influence the process such that the setpoint was unobtainable. Once the voltage per cell reached setpoint-hysteresis the current was basically reduced to a value that stopped charging. This can only be seen by looking at the code.tom91 wrote: ↑Mon Jan 30, 2023 8:02 pm Have a look at the SimpBMS manual for the info. https://github.com/Tom-evnut/SimpBMS/bl ... 0V0.29.pdf
I suspect there are temperature interactions also that may contribute to not being able to attain the setpoint due to the derate.
Once I have more confidence in what is happening I may write some more detailed notes

- tom91
- Posts: 2295
- Joined: Fri Mar 01, 2019 9:15 pm
- Location: Bristol
- Has thanked: 199 times
- Been thanked: 524 times
Re: Outlander VCU - Rear inverter, Charger and BMS
The software is modified by others to implement the charger and everything is freely configurable so there are so many ways it can be impacted.
lucky most of the control is on the canbus so you can just see what has changed on it with savvy can for example to witness direct results.
lucky most of the control is on the canbus so you can just see what has changed on it with savvy can for example to witness direct results.
-
- Posts: 3554
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 131 times
- Been thanked: 330 times
- Contact:
Re: Outlander VCU - Rear inverter, Charger and BMS
I have decided throttle matrix is too complex for me and i am looking towards Lebowski polynomal throttle.
There are three coefficients you can set in code that determine the curve. a, b, and c are floats because they can be less then 1.
x is the throttle value and y is the result.
y = a*x + b*x^2 + c*x^3
I will think on how to make those coefficients possible to set in code as well.
@aot93 how would your RWD motor behave if you would apply full torque request? Does it have any sanity buit in or is it just trying to fulfil command?
I am asking because i would probably have to make a terminating factor (multiply by zero) in case of brake input and overspeed protection. I might built it as a dw/dt filter like acceleration limiter
There are three coefficients you can set in code that determine the curve. a, b, and c are floats because they can be less then 1.
x is the throttle value and y is the result.
y = a*x + b*x^2 + c*x^3
I will think on how to make those coefficients possible to set in code as well.
@aot93 how would your RWD motor behave if you would apply full torque request? Does it have any sanity buit in or is it just trying to fulfil command?
I am asking because i would probably have to make a terminating factor (multiply by zero) in case of brake input and overspeed protection. I might built it as a dw/dt filter like acceleration limiter
-
- Posts: 3554
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 131 times
- Been thanked: 330 times
- Contact:
Re: Outlander VCU - Rear inverter, Charger and BMS
I am not sure if this came up before or on different thread...
Can you advise how to connect ignition signal for inverter. I see that we need to activate a precharge relay and contactor at some point in start. But would we have to activate the internal inverter logic before or after precharge? Can you confirm my assumptions?
1. We have a permanent 12V/GND connection to inverter.
2. We use IGCT signal to activate inverter on precharge by a latching relay triggered by "start" key position which will keep it alive
3. If we need to use emergency off signal we can wire IGCT through normaly closed NC contacts of notaus. That will disable inverter while rest of the car will still function.
I need to setup the succession logic for my inverter.
Re: Outlander VCU - Rear inverter, Charger and BMS
Hope the garage is warming up, I'm keen to use Chademo myself.
Random question as I study your code prepping for my "I'll get there one day" i-Miev powered Spitfire project. Is the inverter torque command a 10:1 ratio to convert to Nm (after the -10000 that is)?
- aot93
- Posts: 212
- Joined: Mon Feb 15, 2021 5:45 pm
- Location: UK, West Sussex
- Has thanked: 8 times
- Been thanked: 48 times
Re: Outlander VCU - Rear inverter, Charger and BMS
Here is a wiring diagram of my setup that help:
The logic being the inverter gets +12v via my ignition change over over relay, this relay is NC to the ignition switch and NO to the type 2 socket PP pin.
Inverter RSDN is connected to BMS main contactor out via relay so the BMS can safely shut down the inverter if needed.
The inverter starts up very quickly so there is no need for any delays.
- aot93
- Posts: 212
- Joined: Mon Feb 15, 2021 5:45 pm
- Location: UK, West Sussex
- Has thanked: 8 times
- Been thanked: 48 times
Re: Outlander VCU - Rear inverter, Charger and BMS
Some progress, new boards built and socket contactors and other bits installed some wiring left and of course a lot of code and de-bugging to done!JamesWLG wrote: ↑Wed Mar 01, 2023 10:21 am Hope the garage is warming up, I'm keen to use Chademo myself.
Random question as I study your code prepping for my "I'll get there one day" i-Miev powered Spitfire project. Is the inverter torque command a 10:1 ratio to convert to Nm (after the -10000 that is)?
As for the torque command yes -10000 then divide by 10 for Nm.
-
- Posts: 3554
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 131 times
- Been thanked: 330 times
- Contact:
Re: Outlander VCU - Rear inverter, Charger and BMS
Well that was unexpected. I didnt know RSDN pin is effective when connected to 12V. So i tried a simple code from Damien first and it worked. Damn that motor is responsive.aot93 wrote: ↑Wed Mar 01, 2023 7:02 pm Here is a wiring diagram of my setup that help:
image.png
The logic being the inverter gets +12v via my ignition change over over relay, this relay is NC to the ignition switch and NO to the type 2 socket PP pin.
Inverter RSDN is connected to BMS main contactor out via relay so the BMS can safely shut down the inverter if needed.
The inverter starts up very quickly so there is no need for any delays.
As a fact i tested motor and inverter that were NOT from the same car. And the test was made on 360Vdc battery.
-
- Posts: 3554
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 131 times
- Been thanked: 330 times
- Contact:
Re: Outlander VCU - Rear inverter, Charger and BMS
Ok another question @aot93;
Can you let us know how you inhibit inverter when charging? By which function? I would like to add a physical signal sensing and charging to this main VCU. I would like to use PP signal to detect charge phase. I dont use teensy BMS module and i will make my own interface...any day now
.
I see there is a constant int preparead but i dont see it leading anywhere.
So i will need to replace PP pin sensing and integrate charger command message 0x286 which is important for running motors as well.
Looking through the main VCU code i cant seem to find easy wasy to use a pullup with PP pin. Every input seems to be opto isolated and positive trigger signal. This means i would need to use another VCU in that stead? Do you have a suggestion to transform that particular signal to pullup gnd sensing signal?
Can you let us know how you inhibit inverter when charging? By which function? I would like to add a physical signal sensing and charging to this main VCU. I would like to use PP signal to detect charge phase. I dont use teensy BMS module and i will make my own interface...any day now

I see there is a constant int preparead but i dont see it leading anywhere.
So i will need to replace PP pin sensing and integrate charger command message 0x286 which is important for running motors as well.
Looking through the main VCU code i cant seem to find easy wasy to use a pullup with PP pin. Every input seems to be opto isolated and positive trigger signal. This means i would need to use another VCU in that stead? Do you have a suggestion to transform that particular signal to pullup gnd sensing signal?
- aot93
- Posts: 212
- Joined: Mon Feb 15, 2021 5:45 pm
- Location: UK, West Sussex
- Has thanked: 8 times
- Been thanked: 48 times
Re: Outlander VCU - Rear inverter, Charger and BMS
Good job spinning the motor it's nice to have confirmation we can use inverters and motors from different cars
Inverter inhibit is in two ways
1, RSDN is pulled high via the BMS
2, message 0x287 byte 6 is set to 0x00 the inverter will not run if this byte is not 0x03
AS for PP detect i used an AT tiny for this job because at the time the teensy deep sleep was not working so well, the ATtiny is always on in deep sleep waiting for the PP to pull a pin low, this can then switch a relay and power everything else up so no need to turn anything on manually for charging.
I put provision in the code to have PP in there but ended up not using it as my thinking was the BMS should be in control of the state of the VCU, so only allowing drive modes when battery status is good and not charging.
Having said that it would be possible to bypass the opto isolator on an input by adding a jumper wire to the board, of course there would then be no protection to the teensy's fragile inputs!
Removing the BMS dependencies is possible (i have test version with these removed if want) but you will need add the checks in else where.
Integrating the charger should be straight forward, handling of message 0x286 will need to be changed, ideally used as kind of HV interlock which appears to be the OEM application.
Inverter inhibit is in two ways
1, RSDN is pulled high via the BMS
2, message 0x287 byte 6 is set to 0x00 the inverter will not run if this byte is not 0x03
AS for PP detect i used an AT tiny for this job because at the time the teensy deep sleep was not working so well, the ATtiny is always on in deep sleep waiting for the PP to pull a pin low, this can then switch a relay and power everything else up so no need to turn anything on manually for charging.
I put provision in the code to have PP in there but ended up not using it as my thinking was the BMS should be in control of the state of the VCU, so only allowing drive modes when battery status is good and not charging.
Having said that it would be possible to bypass the opto isolator on an input by adding a jumper wire to the board, of course there would then be no protection to the teensy's fragile inputs!
Removing the BMS dependencies is possible (i have test version with these removed if want) but you will need add the checks in else where.
Integrating the charger should be straight forward, handling of message 0x286 will need to be changed, ideally used as kind of HV interlock which appears to be the OEM application.
-
- Posts: 3554
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 131 times
- Been thanked: 330 times
- Contact:
Re: Outlander VCU - Rear inverter, Charger and BMS
Can you possibly send (or link) me that code version for testing.aot93 wrote: ↑Thu Mar 02, 2023 11:23 am
Having said that it would be possible to bypass the opto isolator on an input by adding a jumper wire to the board, of course there would then be no protection to the teensy's fragile inputs!
Removing the BMS dependencies is possible (i have test version with these removed if want) but you will need add the checks in else where.
Integrating the charger should be straight forward, handling of message 0x286 will need to be changed, ideally used as kind of HV interlock which appears to be the OEM application.
Regarding PP signal i have in mind a simple Mosfet module with precharge resistor on opto which would allways signal ON... untill PP would pull id down and signal OFF. Teensy would in turn signal low when NOT in charge mode

The problem with this setup is i need to depend on PP signal to run other things as coolant pumps and other stuff while charging.
My BMS runs at 250kbaud so i cant talk to it and the chargers on the same bus.
Also can you declare how CAN lines are distributed? If inverter is on CAN2 what you have on CAN1 and CAN3?
My intention is to replicate inverter signals on CAN1 for another inverter and use CAN3 as charger, heater and AC compressor logic. Or could i just use CAN1 for that still?
- aot93
- Posts: 212
- Joined: Mon Feb 15, 2021 5:45 pm
- Location: UK, West Sussex
- Has thanked: 8 times
- Been thanked: 48 times
Re: Outlander VCU - Rear inverter, Charger and BMS
I'll send you a link in DM, don't really want test code in the wild!
VCU takes care of cooling pump and DC-DC whilst charging, but if you have other things..I can see your system working fine should be almost no current draw to drain your aux battery whilst no being used.
CAN bus configuration is :
CAN 1 Inverter
CAN 2 BMS + Charger
CAN 3 Dash comms this baud rate could be different, easy to change if you are using the dash module or free to use for another purpose.
VCU takes care of cooling pump and DC-DC whilst charging, but if you have other things..I can see your system working fine should be almost no current draw to drain your aux battery whilst no being used.
CAN bus configuration is :
CAN 1 Inverter
CAN 2 BMS + Charger
CAN 3 Dash comms this baud rate could be different, easy to change if you are using the dash module or free to use for another purpose.
-
- Posts: 3554
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 131 times
- Been thanked: 330 times
- Contact:
Re: Outlander VCU - Rear inverter, Charger and BMS
Its a deal then! I will repurpose CAN3 for rear inverteraot93 wrote: ↑Thu Mar 02, 2023 1:01 pm I'll send you a link in DM, don't really want test code in the wild!
VCU takes care of cooling pump and DC-DC whilst charging, but if you have other things..I can see your system working fine should be almost no current draw to drain your aux battery whilst no being used.
CAN bus configuration is :
CAN 1 Inverter
CAN 2 BMS + Charger
CAN 3 Dash comms this baud rate could be different, easy to change if you are using the dash module or free to use for another purpose.
CAN2 will be charger and other auxilliaries
CAN1 front inverter then
As for aux battery I already designed DUE based application which reads DCDC aux battery report and reacts with periodical top-ups even if the car is not powered. This will prevent draining of aux battery and perhaps even allow use of independent HV battery heating/cooling.
On other note i am still in system design phase... do you think it would be possible to operate CAN1 and CAN2 on 500kbaud for car systems and use CAN3 exclusively for BMS communication at 250kbaud. Is it possible to operate teensy wuth asynchronous CAN lines?
- aot93
- Posts: 212
- Joined: Mon Feb 15, 2021 5:45 pm
- Location: UK, West Sussex
- Has thanked: 8 times
- Been thanked: 48 times
Re: Outlander VCU - Rear inverter, Charger and BMS
I see no problem with running asynchronous CAN rates, in fact for a reason I can't remember I already run CAN3 at 50k baud.
-
- Posts: 3554
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 131 times
- Been thanked: 330 times
- Contact:
Re: Outlander VCU - Rear inverter, Charger and BMS
For better understanding of the code...
Question1:
I see you reduce torque on some RPM limit
Code: Select all
if (motorRPM < -2000)
{
torqueRequest = 0;
}
Also is negative sign -2000 a requirement? Is this because you are running motor in reverse or just some other reason?
tnx
- aot93
- Posts: 212
- Joined: Mon Feb 15, 2021 5:45 pm
- Location: UK, West Sussex
- Has thanked: 8 times
- Been thanked: 48 times
Re: Outlander VCU - Rear inverter, Charger and BMS
This particular code is to limit speed in reverse, it's about 15mph with my gearing.
Negative is required as this is what gets reported when the motor is spinning in reverse.
It's a hard cut so not pleasant, but I put in for a bit of safety as wheel spin in reverse would be quite exciting for a limited time!
Negative is required as this is what gets reported when the motor is spinning in reverse.
It's a hard cut so not pleasant, but I put in for a bit of safety as wheel spin in reverse would be quite exciting for a limited time!
-
- Posts: 3554
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 131 times
- Been thanked: 330 times
- Contact:
Re: Outlander VCU - Rear inverter, Charger and BMS
Ok, so i should add a positive limitation then since i will be testing this with no real load. Something the likes of...aot93 wrote: ↑Sat Mar 04, 2023 7:04 pm This particular code is to limit speed in reverse, it's about 15mph with my gearing.
Negative is required as this is what gets reported when the motor is spinning in reverse.
It's a hard cut so not pleasant, but I put in for a bit of safety as wheel spin in reverse would be quite exciting for a limited time!
Code: Select all
if (motorRPM > 5000)
{
torqueRequest = 0;
}
- aot93
- Posts: 212
- Joined: Mon Feb 15, 2021 5:45 pm
- Location: UK, West Sussex
- Has thanked: 8 times
- Been thanked: 48 times
Re: Outlander VCU - Rear inverter, Charger and BMS
Just to note you may well get unexpected results with no load on these motors (re-gen will not work etc..) and they spin up to high RPM very quickly with even small torque request.
-
- Posts: 3554
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 131 times
- Been thanked: 330 times
- Contact:
Re: Outlander VCU - Rear inverter, Charger and BMS
I will have my hand near the EMGCY button then thanks.

- midway
- Posts: 89
- Joined: Mon Feb 15, 2021 3:52 pm
- Location: Ural
- Has thanked: 10 times
- Been thanked: 12 times
Re: Outlander VCU - Rear inverter, Charger and BMS
At the moment I modified the code for Hankzor balancers, I use only the main VCU based on Teensy 4.1, without using a separate module to control the balancers and the charger. Additionally connected automatic transmission lever from Mitsubishi outlander PHEW All in one. I can share the code if needed.
-
- Posts: 3554
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 131 times
- Been thanked: 330 times
- Contact:
Re: Outlander VCU - Rear inverter, Charger and BMS
Yes please do that as my idea is exactly that. I will only omit the transmission lever as i will use something more analog.midway wrote: ↑Sun Mar 05, 2023 4:51 pm At the moment I modified the code for Hankzor balancers, I use only the main VCU based on Teensy 4.1, without using a separate module to control the balancers and the charger. Additionally connected automatic transmission lever from Mitsubishi outlander PHEW All in one. I can share the code if needed.
A
-
- Posts: 3554
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 131 times
- Been thanked: 330 times
- Contact:
Re: Outlander VCU - Rear inverter, Charger and BMS
Recently i had a lot of back and forth with aot93 because of my ignorance of his VCU system process. I have decided it would benefit all if i write here how the code should work and my experience. Aot93 let me know if i missed something.
I assume the use of only VCU, not BMS or other support boards.
VCU connects to inverter and receives reports about votlage and current, so CAN2 lines are connected to inverter.
Main process streamline is as follows:
1. We provide ignition 12V supply to VCU from the key
2. VCU must be in Drive Neutral or Charging State for contactors to go on
- Negative Contactor OFF
- Negative Contactor goes ON
- 500ms Wait > Precharge and Positive are OFF
- Prechage turns ON
- 1000ms Wait
- Inverter reports Voltage for VCU > BMS_PackVoltage -5v
- Main contactor ON
- Wait 500ms and Check all contactor are ON
- Turn Precharge OFF
4. Provide Forward signal to roll out
To enable neutral mode:
- Start and Brake must be ON
- direction FWD and direction REV must both be OFF
- Start and brake can be relesed as VCU changes to state 3
I might change this so VCU will be allways powered as PP signal will have to be a simple pulldown
DC contactor will be latching so when precharge is done this will be locked and the only way to remove HV will be to turn off 12V from the key.
I assume the use of only VCU, not BMS or other support boards.
VCU connects to inverter and receives reports about votlage and current, so CAN2 lines are connected to inverter.
Main process streamline is as follows:
1. We provide ignition 12V supply to VCU from the key
2. VCU must be in Drive Neutral or Charging State for contactors to go on
- Negative Contactor OFF
- Negative Contactor goes ON
- 500ms Wait > Precharge and Positive are OFF
- Prechage turns ON
- 1000ms Wait
- Inverter reports Voltage for VCU > BMS_PackVoltage -5v
- Main contactor ON
- Wait 500ms and Check all contactor are ON
- Turn Precharge OFF
4. Provide Forward signal to roll out
To enable neutral mode:
- Start and Brake must be ON
- direction FWD and direction REV must both be OFF
- Start and brake can be relesed as VCU changes to state 3
I might change this so VCU will be allways powered as PP signal will have to be a simple pulldown
DC contactor will be latching so when precharge is done this will be locked and the only way to remove HV will be to turn off 12V from the key.
- aot93
- Posts: 212
- Joined: Mon Feb 15, 2021 5:45 pm
- Location: UK, West Sussex
- Has thanked: 8 times
- Been thanked: 48 times
Re: Outlander VCU - Rear inverter, Charger and BMS
Thanks all looks good.
I open the pre-charge as I burnt a few resistors and wanted to try and stop it, turns out it was just super poor quality resistors breaking on their own!
I open the pre-charge as I burnt a few resistors and wanted to try and stop it, turns out it was just super poor quality resistors breaking on their own!