Outlander VCU - Rear inverter, Charger and BMS

Mitsubishi hybrid drive unit hacking
User avatar
aot93
Posts: 198
Joined: Mon Feb 15, 2021 5:45 pm
Location: UK, West Sussex
Has thanked: 6 times
Been thanked: 43 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by aot93 »

I handle this sort of thing with my dash controller companion board, but there is no reason why you could not do this directly on the VCU it self.

All (HC) Outputs are PWM capable and low side driven through the darlington arrays.

Out7 (PIN 25) Is currently unused so that might be a good one foe this purpose.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

aot93 wrote: Sun Dec 17, 2023 10:36 am I handle this sort of thing with my dash controller companion board, but there is no reason why you could not do this directly on the VCU it self.

All (HC) Outputs are PWM capable and low side driven through the darlington arrays.

Out7 (PIN 25) Is currently unused so that might be a good one foe this purpose.
Great thanks! Out7 i will use then. I will add one 12V pullup resistor directly to the darlington pin.

Do you have a preference which function to use for Teensy PWM frequency modulation? Or should i simply use analogWriteFrequency(pin, frequency)? Would that interfeere with your other functions?
Or should i use tone function tone(pin, frequency) Would that be any easier? I can also add a film capacitor to transform the square weave to sine function if needed.

I need to map PWM from 12Hz to 220z which would mean 3km/h to 160km/h.
final drive ratio is about 7:1
Wheel size is 15in 195 R55 which is about 0,595m diameter. Circumference should then be 1.87m and that is the distance for one revolution.
I see about 1.375Hz/km/h ratio from 30km/h to 160km/h. Before the function is a bit skewed...
v [km/h] = (RPM * circumference) / 1000.

Then i can map v [km/h] to [Hz] and output it through Out7 pin.
User avatar
aot93
Posts: 198
Joined: Mon Feb 15, 2021 5:45 pm
Location: UK, West Sussex
Has thanked: 6 times
Been thanked: 43 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by aot93 »

I think I've only ever used the standard arduino analogWrite() function.
It should not interfere with other operations, not really any different to updating the temp gauge.

Do let us know how it goes once you have it running.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

aot93 wrote: Sun Dec 17, 2023 12:28 pm I think I've only ever used the standard arduino analogWrite() function.
It should not interfere with other operations, not really any different to updating the temp gauge.

Do let us know how it goes once you have it running.
I will let you all know when i get there...

1. Could you elaborate on the wiring behind your VCU. I am not familliar with ULN2803A and i am not sure if i can wire VCU outputs to drive relays or other devices directly or you suggest i use maybe 8channel relay module?

2. Is ULN2803A capable of providing positive signal or is it a sink device like ULN2003? Do you suggest using 2K7 pullup relays for PWM use?

Thanks for the info

Arber
User avatar
midway
Posts: 79
Joined: Mon Feb 15, 2021 3:52 pm
Location: Ural
Has thanked: 5 times
Been thanked: 8 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by midway »

I used AnalogWriteFrequency(pin, Frequency) to control the Mercedes W168 fan, I simply connected the output of the VCU ULN2803A to the fan control input and immediately everything worked, I can smoothly control the fan speed.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

midway wrote: Tue Dec 26, 2023 8:30 am I used AnalogWriteFrequency(pin, Frequency) to control the Mercedes W168 fan, I simply connected the output of the VCU ULN2803A to the fan control input and immediately everything worked, I can smoothly control the fan speed.
Tnx for the info. Can you tell if you used additional pullup resistor with the fan?
I want to know if the ULN2803A output is direct GND sink or does it output 12V? tnx.
User avatar
midway
Posts: 79
Joined: Mon Feb 15, 2021 3:52 pm
Location: Ural
Has thanked: 5 times
Been thanked: 8 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by midway »

arber333 wrote: Tue Dec 26, 2023 10:03 am Tnx for the info. Can you tell if you used additional pullup resistor with the fan?
I want to know if the ULN2803A output is direct GND sink or does it output 12V? tnx.
The fan PWM is controlled at a low level, I simply connected the VCU output to the input of the fan control unit.
For other purposes, a pull-up of +12 or +5 V is needed. Or use this opti https://aliexpress.ru/item/100500511793 ... 730asEu4OL
User avatar
midway
Posts: 79
Joined: Mon Feb 15, 2021 3:52 pm
Location: Ural
Has thanked: 5 times
Been thanked: 8 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by midway »


Customized the dashboard based on the recorder from aliexpress
https://aliexpress.ru/item/100500584222 ... 4543817174
User avatar
aot93
Posts: 198
Joined: Mon Feb 15, 2021 5:45 pm
Location: UK, West Sussex
Has thanked: 6 times
Been thanked: 43 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by aot93 »

1. Could you elaborate on the wiring behind your VCU. I am not familliar with ULN2803A and i am not sure if i can wire VCU outputs to drive relays or other devices directly or you suggest i use maybe 8channel relay module?

2. Is ULN2803A capable of providing positive signal or is it a sink device like ULN2003? Do you suggest using 2K7 pullup relays for PWM use?
HI,

1. they are simple low side drivers that can be directly hooked up to the negative side of contactor or relay coil. Outputs 1 - 4 are parallel for extra capacity (4.8amps in theory..), they all cope well with PWM and can also drive the cheap relay modules I use these for convenience.
There are some wiring diagrams in the easyeda project which might help, some of the pin numbers are out dated now though.
2. Low sink as above, I have not yet needed to use a pullup driving things like fuel and temp gauges but there could well be times where you would need one.

@midway i like the dash 8-)
User avatar
midway
Posts: 79
Joined: Mon Feb 15, 2021 3:52 pm
Location: Ural
Has thanked: 5 times
Been thanked: 8 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by midway »

According to the datasheet, the maximum current of ULN2803A is 0.5A, with a parallel connection of 1A. The contactor has a starting current of up to 4A, I think you should not exceed the maximum current.
Attachments
DOC000223811.pdf
(97.67 KiB) Downloaded 46 times
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

aot93 wrote: Wed Dec 27, 2023 10:36 pm HI,

1. they are simple low side drivers that can be directly hooked up to the negative side of contactor or relay coil. Outputs 1 - 4 are parallel for extra capacity (4.8amps in theory..), they all cope well with PWM and can also drive the cheap relay modules I use these for convenience.
There are some wiring diagrams in the easyeda project which might help, some of the pin numbers are out dated now though.
2. Low sink as above, I have not yet needed to use a pullup driving things like fuel and temp gauges but there could well be times where you would need one.

@midway i like the dash 8-)
Tnx for making it clear. I am wiring my 8ch relay module and other inputs.
While working on my new schematic it occured to me outlander heater input is not part of this VCU design.
In my haste i connected Inverter, Charger and Heater to the same CAN bus line which seemed logical as i had that in my Pug as well. So now i need to use the same VCU for all.
I am thinking of simply using the Eco input and deleting the Eco trigger using only Normal and Sport.
I will put in your code the CAN function for the heater and temperature control loop as well.
Let me know if you have a different suggestion please.

tnx

A
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

midway wrote: Tue Dec 26, 2023 8:30 am I used AnalogWriteFrequency(pin, Frequency) to control the Mercedes W168 fan, I simply connected the output of the VCU ULN2803A to the fan control input and immediately everything worked, I can smoothly control the fan speed.
Maybe you can help here @midway...
I set the code up with derivative of aot93 code with your lines for JK BMS. I am using 84cell setup but i decided to use 12S JK BMS modules for ease of wiring... abd servicing later.

Now when i try to get the code to compile i get a single error:
error: no matching function for call to 'FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16>::setMBFilter(FLEXCAN_MAILBOX, int, int, int, int, int, int, int)'
How is that call NOT part of the flexcan? Do i have to declare ints or another function here? Or should i call separate mailboxes?
I am calling for 7 modules:

Code: Select all

Can1.setMBFilter(MB1, 0x01,0x02,0x03,0x04,0x05,0x06,0x07);
Do i need to increase mailbox number maybe?

tnx
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

arber333 wrote: Sun Dec 31, 2023 8:52 pm Maybe you can help here @midway...
----
Now when i try to get the code to compile i get a single error:
error: no matching function for call to 'FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16>::setMBFilter(FLEXCAN_MAILBOX, int, int, int, int, int, int, int)'
How is that call NOT part of the flexcan? Do i have to declare ints or another function here? Or should i call separate mailboxes?
I am calling for 7 modules:

Code: Select all

Can1.setMBFilter(MB1, 0x01,0x02,0x03,0x04,0x05,0x06,0x07);
Do i need to increase mailbox number maybe?
I managed to compile when i replaced call for IDs with range as in FlexCAN library

Code: Select all

  Can1.setMBFilterRange(MB1, 0x01,0x07);
It now compiles good. Tomorrow i will test it.
Please let me know if you have any comments...
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

Some report back...
I managed to wire additional 10K resistor to ISO8 pin which keeps opto activated so Teensy will think charger is not connected.

There is another issue though.When i tested both ADC inputs i get smooth sgnal on ADC0 and some 1 trough 5 jumpiness on ADC1. This got me to investigate signal further and i can see diodes clamped down on the signal. I removed diodes and replaced them with 4K7 / 10K resistor divider which gives good signal ratio when teensy is not inserted. However when i insert Teensy i get 3.2V signal on ADC0 nd something is clamping down on ADC1, giving only 0.5V when it should show 2.4V.If i remove Teensy signal jumps back up.

This leads me to belive ADC1 (A16) is toast. Is there any other ADC channel close so i could simply rewire to it? I could cut the line to ADC1 and pull a wire to A15 input close by and then declare the A15 in code as POT B. What do you recommend?
User avatar
aot93
Posts: 198
Joined: Mon Feb 15, 2021 5:45 pm
Location: UK, West Sussex
Has thanked: 6 times
Been thanked: 43 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by aot93 »

D39 and D38 are right next door so could jump across to those.

Before doing that can you test the teensy on a bread board or similar?
The diodes are there for input protection as we all know how easy it is to kill one of these boards.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

aot93 wrote: Tue Jan 02, 2024 4:16 pm D39 and D38 are right next door so could jump across to those.

Before doing that can you test the teensy on a bread board or similar?
The diodes are there for input protection as we all know how easy it is to kill one of these boards.
I already did that. pin40 is drawing too much power and not reacting to analog input.

I had to cut traces to pin40 and replaced it with pin39. In my haste i managed to damage trace to pin41 as well and so i enhanced that line as well.
Now when i connect throttle i get a good singal to calibrate from both channels.

I added 1K2 resistor as pullup for ISO8 pin to work with my PP signal from charge port. I use J1772 charge port which has 2K7 pulldown resistor inside. Charging action is activated when a switch inside charge plug connects 1K3 pin in parallel creating stronger pulldown. To counter this when not connected i had to add 1K2 resistor as pullup.

And now a question regarding charging mechanics...
How would i go about charging (and start DCDC) when my car is not in use?

I use a single DC contactor, a precharge relay a DCDC relay, a single pump/Fan relay
I want for this VCU to be able to start precharge and close DC contactor BEFORE it will activate charger or DCDC.

I am asking because now when i connect VCU without HV a DCDC relay starts for a minute or so. I dont see any evidence of precharge or DC contactor active. VCU is in mode 2 at the time.

EDIT: i also noticed precharge can be started and HV contactor is closed (negative as well). I can change from Neutral to Forward and Reverse state but when i want to stop and remove ignition (and start) signal VCU wont go back to state 2 and state 3 remains despite i turned my car off. Any idea?

TNX
Attachments
20240102_181121.jpg
20240102_181102.jpg
User avatar
midway
Posts: 79
Joined: Mon Feb 15, 2021 3:52 pm
Location: Ural
Has thanked: 5 times
Been thanked: 8 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by midway »

arber333 wrote: Tue Jan 02, 2024 5:30 pm I already did that. pin40 is drawing too much power and not reacting to analog input.

I had to cut traces to pin40 and replaced it with pin39. In my haste i managed to damage trace to pin41 as well and so i enhanced that line as well.
Now when i connect throttle i get a good singal to calibrate from both channels.

I added 1K2 resistor as pullup for ISO8 pin to work with my PP signal from charge port. I use J1772 charge port which has 2K7 pulldown resistor inside. Charging action is activated when a switch inside charge plug connects 1K3 pin in parallel creating stronger pulldown. To counter this when not connected i had to add 1K2 resistor as pullup.

And now a question regarding charging mechanics...
How would i go about charging (and start DCDC) when my car is not in use?

I use a single DC contactor, a precharge relay a DCDC relay, a single pump/Fan relay
I want for this VCU to be able to start precharge and close DC contactor BEFORE it will activate charger or DCDC.

I am asking because now when i connect VCU without HV a DCDC relay starts for a minute or so. I dont see any evidence of precharge or DC contactor active. VCU is in mode 2 at the time.

TNX
My charger is at the debugging stage, I can share the code. To enable charging, I use bus messages from the charger about the permissible current.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

midway wrote: Tue Jan 02, 2024 5:38 pm My charger is at the debugging stage, I can share the code. To enable charging, I use bus messages from the charger about the permissible current.
I dont think you understand, my problem is that i would need to close HV contactor everytime any component would go active, be that DCDC or charger or inverter...even heater if we want to go that far... And now VCU doesnt seem to start precharge and contactor before starting charger.
I do have it all connected without HV for now. I dont want to damage anything...

EDIT: I managed to wire for frequency modulated PWM signal for speedo on Out7. I first connected 10K pullup to 12V directly and applied tone() function at 25Hz. I couldnt get speedo to move so i remembered i had similar problems with Peugeot RPM dial. So i added one 1uF film cap on the line in series. This made signal go down and cross 0V and i got speedo to run!
Attachments
20240101_201650.jpg
20240101_201626.jpg
20240101_201610.jpg
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

I write this post to separate issue from previous points...
I noticed precharge can be started and HV contactor is closed (negative as well). I can change from Neutral to Forward and Reverse state but when i want to stop and remove ignition (and start) signal, VCU wont go back to state 2 and state 3 remains despite i turned my car off. Relays 1 and 8 (HV contactor and HV cont. negative) remain on.

Any idea?
User avatar
aot93
Posts: 198
Joined: Mon Feb 15, 2021 5:45 pm
Location: UK, West Sussex
Has thanked: 6 times
Been thanked: 43 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by aot93 »

Hi good work on the speedo :)

I hope I have understood you correctly and i will try to explain;

Ok so the way I thought this should work is the charger is controlled by the BMS and the VCU simply listens to a can message from the BMS telling it to go in to charging state (6).

Now I think we covered earlier about changing a CAN message for a digital read, it's worth noting the pre-charge sequence is started when the VCU goes into state 6 so perhaps you can call that if you want HV aux devices but no inverter run.

As for going back to state 2 by design the VCU and contactors are powered (via a relay) from the car ignition switch, same with charging pulling the plug throws a relay and powers off the VCU thus resetting it ready for next power on.
I was thinking like a traditional ICE car you turn off the engine by turning off the ignition.

For it to remain powered on continually we would have to add in some ways to know when to shut down HV, one would be seeing if the ignition is off, for charging and aux power most likely this would be when what ever signal turned it on goes away.

Hope that helps a bit!
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

aot93 wrote: Tue Jan 02, 2024 10:01 pm Hi good work on the speedo :)

I hope I have understood you correctly and i will try to explain;

Ok so the way I thought this should work is the charger is controlled by the BMS and the VCU simply listens to a can message from the BMS telling it to go in to charging state (6).

Now I think we covered earlier about changing a CAN message for a digital read, it's worth noting the pre-charge sequence is started when the VCU goes into state 6 so perhaps you can call that if you want HV aux devices but no inverter run.

As for going back to state 2 by design the VCU and contactors are powered (via a relay) from the car ignition switch, same with charging pulling the plug throws a relay and powers off the VCU thus resetting it ready for next power on.
I was thinking like a traditional ICE car you turn off the engine by turning off the ignition.

For it to remain powered on continually we would have to add in some ways to know when to shut down HV, one would be seeing if the ignition is off, for charging and aux power most likely this would be when what ever signal turned it on goes away.

Hope that helps a bit!
Thank you for that explanation. I really struggled in the code. Its kind of obvious as i didnt go through the other boards code...

I will go and try to fix code conditionals on this VCU to go to state 6 when PP is active.
I imagine BMS part should mainly control 0x285 telegram section. It seems without that anything made by Mitsubishi will stop operating.
Other than that i will use JK BMS active balancing only when car is out of modes 3, 4 and 5.

Ok power to relays was an oversight. I am now supplying power to relay signals through permanent 12V fuse. I imagined this should be because we need relay power even without ignition signal. How am i to start charging process without ignition signal then?
I didnt expect for VCU to be off when ignition is off though. That would defeat my application of VCU as BMS and charge controler.
I would imagine it would be sensible for VCU to transition from 3, 4, 5 states to state 2 whenever i would remove ignition signal.
Likewise i would expect transition from state 6 back to state 2 when PP signal is absent.

I could Y split PP signal and connect other end to opto relay trigger to turn ON power to ignition. I have to think on how to proceed...
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

midway wrote: Tue Jan 02, 2024 5:38 pm My charger is at the debugging stage, I can share the code. To enable charging, I use bus messages from the charger about the permissible current.
@midway How did you connect your VCU? Do you keep it off when car is inactive?
User avatar
midway
Posts: 79
Joined: Mon Feb 15, 2021 3:52 pm
Location: Ural
Has thanked: 5 times
Been thanked: 8 times

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by midway »

arber333 wrote: Wed Jan 03, 2024 7:52 pm @midway How did you connect your VCU? Do you keep it off when car is inactive?
My power comes either from the ignition switch, or the relay from the charging pistol is switched on through an optocoupler.
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

midway wrote: Fri Jan 05, 2024 7:56 am My power comes either from the ignition switch, or the relay from the charging pistol is switched on through an optocoupler.
I see... since we are using watchdog it seemed logical to keep teensy powered up at all times.
Damn!... i am trying to setup the loop for jumping from active states back to starting case with resetting all relays when it gets there... and first attempt was not successful. Well... partially but i was not able to repeat results every single time.
Will keep you posted...
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

Now we are talking! I managed to reprogrammed loops to always end at ready state when ignition or pp goes off. At first it wasnt as obvious but i had to play with bms_state switch. I will definitely use it in future loop to control VCU through BMS.

When i start the car it goes correctly to neutal and then into fwd or rev. If i connect charging port VCU will reliably go into charging.
Then if i remove ignition or PP signal VCU will reliably revert to ready state.
One important thing is also to keep the new code part at therear of the code in individual case so as not to interfere with change in BMS_status change... Code sample for reverting from drive forward is here...

Code: Select all

      // Check for ISO_IN7 ignition inactivity
   if ((digitalRead(ISO_IN1) == LOW) && (digitalRead(ISO_IN7) == HIGH))
      {
     if (VCUstatusChangeCounter > VCUstatusChangeThreshold)
      {
        VCUstatusChangeCounter = 0;
        BMS_Status = 1;
        VCUstatus = ready;
      }
      else
      {
        VCUstatusChangeCounter++;
      }
      }
Also the code for reverting from charging...

Code: Select all

 // Check for ISO_IN8 PP inactivity
      if (digitalRead(ISO_IN8) == LOW) 
      {
     if (VCUstatusChangeCounter > VCUstatusChangeThreshold)
      {
        VCUstatusChangeCounter = 0;
        BMS_Status = 1;
        VCUstatus = ready;
      }
      else
      {
        VCUstatusChangeCounter++;
      }
      }
Next step: testing with HV
Post Reply