Outlander VCU - Rear inverter, Charger and BMS

Mitsubishi hybrid drive unit hacking
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

aot93 wrote: Sat Mar 19, 2022 10:14 pm
I am working on your BMS module, adapting it for my use. I will use it with VW code.
Can you tell me why do you use 3V3 output pin C7 on your BMS board? Is it some sensor? I know CAN transciever is 5V tolerant.
Do you mean the 3v3 take off on the teensy?

I tried to keep the amount of 5v signals to a minimum to avoid possibility of damaging the teensy, the T3 is much better and is 5v tolerant the T4's die very quickly at 5v

Also the can transceivers have 3v3 printed on them so it's a little less confusing when fault finding

If you mean pin C7 on the plug, this is for connection to analogue current sensor and not used in this setup.
OK i will use C7 for CP pull down signal if i dont use Outlander charger then.
I just like to use signal inversion. Like with ULN2803 ladder. 12V signal goes in and signal to GND comes out. Internal (or external) pullup then helps with active pin sensing. I use this with my DUE and it is kind of like opto isolation. Cant damage DUE/Teensy pins with signal to GND :).

One question though. Why dont we use remaining free pins on Teensy for PP sensing? Its just sensing pull up to GND. Is there any reason for ATtiny chip?
Or is it just full compatibility with the code?
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 »

One question though. Why dont we use remaining free pins on Teensy for PP sensing? Its just sensing pull up to GND. Is there any reason for ATtiny chip?
Or is it just full compatibility with the code?
Short answer is power saving.
I don't want to have the main boards live all the time, so the ATtiny is powered separately waiting to be pulled low by PP, this then switches a SPDT really that powers the main boards.
ATtiny with the sleep code draws very little power, and I found it easier than coming up with a passive PP detection circuit
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

aot93 wrote: Mon Mar 21, 2022 10:27 am
One question though. Why dont we use remaining free pins on Teensy for PP sensing? Its just sensing pull up to GND. Is there any reason for ATtiny chip?
Or is it just full compatibility with the code?
Short answer is power saving.
I don't want to have the main boards live all the time, so the ATtiny is powered separately waiting to be pulled low by PP, this then switches a SPDT really that powers the main boards.
ATtiny with the sleep code draws very little power, and I found it easier than coming up with a passive PP detection circuit
OK, but then BMS is not active if car is stationary on a parking lot then? Safe, unsafe...?
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 »

No BMS is not active when car is off / not charging.
The way I see it is all the BMS can do in the event of a fault is turn off main contactors, these are off when the car is off.

Happy to hear reasons for leaving the BMS active all the time.
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

aot93 wrote: Mon Mar 21, 2022 1:55 pm No BMS is not active when car is off / not charging.
The way I see it is all the BMS can do in the event of a fault is turn off main contactors, these are off when the car is off.

Happy to hear reasons for leaving the BMS active all the time.
Ok, i see your rationale. If i will use attiny i will need to design my dc system around that philosophy.
bigdaveakers
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

Post by bigdaveakers »

Well, my chips came! I now have inputs all working and the code is updated to get rid of BMS checks and HV checks. With my 'foot/finger' on the brake when I turn the key the contactors do their thing :D

Now I need to check CAN comms with the inverter and find 300V.

One thing I have noticed is that turning the key off doesn't shut down the contactors, so I will be adding some code for that.

Happy days!
bigdaveakers
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

Post by bigdaveakers »

Added a new case in the state handler

Code: Select all

case ignitionoff:
  {
    
      if (digitalRead(OUT1) == HIGH) //Check if Neg Contactor is on then start the sequence
      {digitalWrite(OUT1, LOW); //Negative Contactor
      Serial.println("Negative Off!...");
      digitalWrite(OUT3, LOW); //Positive Contactor
      Serial.println("Positive Off!...");
      digitalWrite(OUT11, LOW); //Green LED OFF
      Serial.println("Green LED Off!...");
      digitalWrite(OUT10, HIGH); //Red LED ON
      Serial.println("Red LED On!...");
      digitalWrite(OUT4, LOW);  //Turn off Barke Lights
      Serial.println("Brake Lights Off!...");
      digitalWrite(OUT12, LOW); //Turn off Rev Lights
      Serial.println("Reverse Lights Off!...");
      VCUstatus = 2;
    }
 
and called it from driveNuetral, driveForward and driveReverse

Code: Select all

    
    if (ignition == 1)
    {    
       VCUstatusChangeCounter = 0;
       VCUstatus = ignitionoff;
    }
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

@aot93, do you use creep mode with your VCU code? As with ATX? We could use N as a separate function before we turn the key to START.
Then you would have either FWD or RWD and creep would be effective allways if no brake pressed. Does it work that way?
I still need to put the code together...

tnx
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 »

Contactors are powered via a spdt relay which is either on from ignition or pp detect. So when ignition is off and not charging contactors will always be off.
My logic here is this acts like an e-stop, turn the key off everything goes off in a basic mechanical seperation way.

Off course you might damage inverter and or motor if you turn the ignition off at speed...

As for creep function I didn't implement it. I don't like creep in car, I planned to use a minimum torque parameter should I ever want it.
It should be easily implemented.
bigdaveakers
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

Post by bigdaveakers »

I plugged the CAN in to the inverter and got some inverter temps.......I guess it is working. Need to connect the motor to the inverter now and see if I can get some motor temps less than 215 and motor rpm less than 45000 :o (0 would be good)
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

aot93 wrote: Thu Mar 24, 2022 3:47 pm Contactors are powered via a spdt relay which is either on from ignition or pp detect. So when ignition is off and not charging contactors will always be off.
My logic here is this acts like an e-stop, turn the key off everything goes off in a basic mechanical seperation way.

Off course you might damage inverter and or motor if you turn the ignition off at speed...

As for creep function I didn't implement it. I don't like creep in car, I planned to use a minimum torque parameter should I ever want it.
It should be easily implemented.
OK i would need to really be a dork to switch off my car at speed. Dont forget my power steering runs when key is on!

Will sift through the code for creep option. Tnx
bigdaveakers
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

Post by bigdaveakers »

bigdaveakers wrote: Thu Mar 24, 2022 4:36 pm I plugged the CAN in to the inverter and got some inverter temps.......I guess it is working. Need to connect the motor to the inverter now and see if I can get some motor temps less than 215 and motor rpm less than 45000 :o (0 would be good)
So, turns out that when a pin is broken off you get no connection to the resolver :o

Fortunately I had a spare pin so I have fixed it, but need to get the broken pin out of the connector......
pinbroke.jpg
bigdaveakers
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

Post by bigdaveakers »

It is spinning..........using the mains and a bridge rectifier.......

Need to adjust the throttle as the ADC values are 200 for low and 234 for high which makes it a bit pokey!
User avatar
EV_Builder
Posts: 1199
Joined: Tue Apr 28, 2020 3:50 pm
Location: The Netherlands
Has thanked: 16 times
Been thanked: 33 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by EV_Builder »

bigdaveakers wrote: Fri Mar 25, 2022 4:57 pm It is spinning..........using the mains and a bridge rectifier.......

Need to adjust the throttle as the ADC values are 200 for low and 234 for high which makes it a bit pokey!
Becarefull with regen... :!:
Converting an Porsche Panamera
see http://www.wdrautomatisering.nl for bespoke BMS modules.
bigdaveakers
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

Post by bigdaveakers »

EV_Builder wrote: Sat Mar 26, 2022 8:45 am
bigdaveakers wrote: Fri Mar 25, 2022 4:57 pm It is spinning..........using the mains and a bridge rectifier.......

Need to adjust the throttle as the ADC values are 200 for low and 234 for high which makes it a bit pokey!
Becarefull with regen... :!:
It is fine, the fuse in the plug went pop when I tried to regen back to the national grid :lol:
User avatar
EV_Builder
Posts: 1199
Joined: Tue Apr 28, 2020 3:50 pm
Location: The Netherlands
Has thanked: 16 times
Been thanked: 33 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by EV_Builder »


It is fine, the fuse in the plug went pop when I tried to regen back to the national grid :lol:
Becarefull because you can damage the inverter if it can't dump the energy somewhere before browning out its own field...
Converting an Porsche Panamera
see http://www.wdrautomatisering.nl for bespoke BMS modules.
bigdaveakers
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

Post by bigdaveakers »

Any ideas why my adc readings are so close together? The Voltages are between 1.1V and 3V but the adc readings are 200 and 234 - I would like a bigger separation to get a better resolution
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 »

Have you set the offsets on the pedal correctly?

Is you pedal a dual pot type, with 1 running half the resistance to the other?

If not you will get strange results.

Also make sure the 1/2 pot is connected the ADC that has *2 applied to it.

You can use the debug functions to check the raw data
bigdaveakers
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

Post by bigdaveakers »

aot93 wrote: Sat Mar 26, 2022 3:31 pm Have you set the offsets on the pedal correctly?

Is you pedal a dual pot type, with 1 running half the resistance to the other?

If not you will get strange results.

Also make sure the 1/2 pot is connected the ADC that has *2 applied to it.

You can use the debug functions to check the raw data
Ahhhhhh, I may have to do some maths and mapping

It is a hall effect pedal and the outputs are

1.1 to 3.23 V

and

1.6 to 3.8V
bigdaveakers
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

Post by bigdaveakers »

OK, project is on lay up for a few days - bought a polo pedal for £8 as I know this is what you have used successfully :)

I assume you use 3.3V and GND rather than 12V
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 »

Yes 3v3!

Those VW pedals are a safe bet
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Outlander VCU - Rear inverter, Charger and BMS

Post by arber333 »

aot93 wrote: Sat Mar 26, 2022 6:31 pm Yes 3v3!

Those VW pedals are a safe bet
Would Toyota pedal not work? If I provide 5V supply, it would show 0.8V to 3.6V on one channel and 1.2 to 4.2 on another. Then i would just need to select correct channel and use than no? Or should i add a simple divider to analog line? It already has 10K to GND. If i added 2K7 inline i would get just the voltage i need.
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 »

In theory it should be fine, the clamping diodes should limit to 3v3 max (i think talked about this earlier)
But a divider would be safest.

After that yes as you say choose the right channel and you should be good to go.

I wonder though if it's worth exposing the multiplier and channels as an option in settings this should make it easier to adapt to other pedals?
bigdaveakers
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

Post by bigdaveakers »

Well, where did the last month go?! I have hooked up the Polo pedal and I am experiencing the same behaviour, so I no believe that it is by design......

In Reverse everything is working fine as there is no regen logic, blip the throttle, get some spinning, release the throttle, spinning freewheels to stop.

In Forward, blip the throttle,get some spinning, freewheels for a short period, then spins up to ~1500rpm and holds. Blip the throttle, speed reduces, then spins back up to 1500rpm.

I hooked up an old light cluster and I can see the brakes light comes on while holding 1500rpm, goes off if I blip the throttle. So I am concluding that as I dont have any load on the motor it cant do regen properly and goes to a creep torque? First time it happened I thought I had a runaway motor to deal with!

Back to unravelling the code around regenState!
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 you need to get some load on it, I saw similar behaviour with no load on the motor
Post Reply