Tesla Model 3 Rear Drive Unit Hacking
- outlandnish
- Posts: 17
- Joined: Thu Sep 01, 2022 2:23 pm
- Has thanked: 19 times
- Been thanked: 16 times
Re: Tesla Model 3 Rear Drive Unit Hacking
My inverter PCB arrived today! Waiting for a new 980 inverter that I'm using as the donor board. Hoping to have it mostly assembled tomorrow.
If I have time, I'll try to get the thermistor and current sense blocks 3D prints designed.
If I have time, I'll try to get the thermistor and current sense blocks 3D prints designed.
- Jack Bauer
- Posts: 3831
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 75 times
- Been thanked: 696 times
- Contact:
Re: Tesla Model 3 Rear Drive Unit Hacking
Volvo with the M3 moved for the first time today. Seized rear brakes were no match for throtcur 10. Initial impression is very smooth. Dave , I#m too dumb for my own good but could you remind me again of the oic command to save params to flash.
I'm going to need a hacksaw
-
davefiddes
- Posts: 375
- Joined: Mon Jan 18, 2021 12:39 pm
- Location: Edinburgh, Scotland, UK
- Has thanked: 149 times
- Been thanked: 195 times
Re: Tesla Model 3 Rear Drive Unit Hacking
Congratulations on getting things running.
"oic cmd save" or bonk the "Save to Flash" button on the "Device Control" page of oic-gui.
"oic cmd save" or bonk the "Save to Flash" button on the "Device Control" page of oic-gui.
- Jack Bauer
- Posts: 3831
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 75 times
- Been thanked: 696 times
- Contact:
Re: Tesla Model 3 Rear Drive Unit Hacking
Sooo, I don't have any experience with driving a car with OI FOC firmware but what I can say is the V50 / M3 test vehicle that I call the T3RD is now the smoothest car I own to date. And thats just with my ham fisted attempt at tuning params that I do not understand. Sadly it's monsoon season in Ireland so not much traction just mud and burnouts in gravel.
I can make it trip desat by either A)maxing out all the kp params or B)slamming it into reverse at over 6k rpm.
Driveshafts are holding out so far.
I can make it trip desat by either A)maxing out all the kp params or B)slamming it into reverse at over 6k rpm.
Driveshafts are holding out so far.
I'm going to need a hacksaw
- Jack Bauer
- Posts: 3831
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 75 times
- Been thanked: 696 times
- Contact:
Re: Tesla Model 3 Rear Drive Unit Hacking
Ok, first real world data. This was captured while pulling uphill with the handbrake locking the rear wheels and foot to the floor. Front tyres were periodically breaking loose on the gravel and spinning up to roughly 3600rpm. No feild weakening used.
- Attachments
-
- T3RD_Burnout.txt
- (3.95 KiB) Downloaded 4 times
I'm going to need a hacksaw
- Jack Bauer
- Posts: 3831
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 75 times
- Been thanked: 696 times
- Contact:
Re: Tesla Model 3 Rear Drive Unit Hacking
Scratch that. I had fmax set too low. Actual base speed around 4500rpm at 350v.
I'm going to need a hacksaw
- Jack Bauer
- Posts: 3831
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 75 times
- Been thanked: 696 times
- Contact:
Re: Tesla Model 3 Rear Drive Unit Hacking
Current parameter load. Still no field weakening.
- Attachments
-
- T3RD_Base_tune2_500hz.json
- (2.11 KiB) Downloaded 4 times
I'm going to need a hacksaw
-
davefiddes
- Posts: 375
- Joined: Mon Jan 18, 2021 12:39 pm
- Location: Edinburgh, Scotland, UK
- Has thanked: 149 times
- Been thanked: 195 times
Re: Tesla Model 3 Rear Drive Unit Hacking
A parts order arrived. I've fitted my STGAP1BS gate drivers (not the STGAP1AS Tesla fit). They seem to be working fine so far and report no faults. I've not put HV on them yet though.
I've also got a set of hall-effect current sensors but haven't fitted them just yet either.
I've also got a set of hall-effect current sensors but haven't fitted them just yet either.
- Jack Bauer
- Posts: 3831
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 75 times
- Been thanked: 696 times
- Contact:
Re: Tesla Model 3 Rear Drive Unit Hacking
I think someone is looking at 3d printing the current sensor block so if we can find the same or similar ferrite ring would be one less thing to remove. Last unobtanium is the 30 way pin header.
I'm going to need a hacksaw
- outlandnish
- Posts: 17
- Joined: Thu Sep 01, 2022 2:23 pm
- Has thanked: 19 times
- Been thanked: 16 times
Re: Tesla Model 3 Rear Drive Unit Hacking
Just waiting on some temperature sensors, but it has passed all the power up tests so far!
When I pulled out the 30 pin header, I used spare aluminum bus bars to block of the rest of the PCB from damage from the blow torch. A bit overkill, but it worked. I saw another technique on YouTube where someone used a bit of copper wire as a bus bar between the pins to distribute the heat without damaging a plastic housing. Worth trying if someone wants to experiment!
I also inquired with Molex about designing a custom 30 pin header an am waiting to hear back. If anyone wants the measurements, the length of the headers are 45mm and the pitch is 2.54mm. they have a 7mm mating face (to the outer face of the black plastic), 35mm from black plastic to black plastic outer faces, and 3mm for the other mating face.
I'll get the current sensor block modeled this weekend. I pulled out one of them temp sensors from the original board and think it's pretty doable to make a 3D print. Damien, do you want a setup that matches the OEMs as close as possible or something we can adapt to the currently selected temp sensors?
When I pulled out the 30 pin header, I used spare aluminum bus bars to block of the rest of the PCB from damage from the blow torch. A bit overkill, but it worked. I saw another technique on YouTube where someone used a bit of copper wire as a bus bar between the pins to distribute the heat without damaging a plastic housing. Worth trying if someone wants to experiment!
I also inquired with Molex about designing a custom 30 pin header an am waiting to hear back. If anyone wants the measurements, the length of the headers are 45mm and the pitch is 2.54mm. they have a 7mm mating face (to the outer face of the black plastic), 35mm from black plastic to black plastic outer faces, and 3mm for the other mating face.
I'll get the current sensor block modeled this weekend. I pulled out one of them temp sensors from the original board and think it's pretty doable to make a 3D print. Damien, do you want a setup that matches the OEMs as close as possible or something we can adapt to the currently selected temp sensors?
- Jack Bauer
- Posts: 3831
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 75 times
- Been thanked: 696 times
- Contact:
Re: Tesla Model 3 Rear Drive Unit Hacking
I'd say make whatever is easy for the new sensors.
I'm going to need a hacksaw
- Jack Bauer
- Posts: 3831
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 75 times
- Been thanked: 696 times
- Contact:
- Jack Bauer
- Posts: 3831
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 75 times
- Been thanked: 696 times
- Contact:
Re: Tesla Model 3 Rear Drive Unit Hacking
So as usual it turns out i'm a class 2 moron. Johannes spotted that my rotor direction and selected direction were not the same. Adding 32768 to syncofs fixed that. Then I could add the correct lqminusld and flux linkage values for the rear motor and its burnout time again but this time pegging out the V50's tach at 8krpm. Attached is a parameter set and a snapshot of params during a burnout.
- Attachments
-
- T3RD_TuneFW1.json
- (2.12 KiB) Downloaded 3 times
-
- T3RD_Burnout_FW.txt
- (3.95 KiB) Downloaded 7 times
I'm going to need a hacksaw
-
davefiddes
- Posts: 375
- Joined: Mon Jan 18, 2021 12:39 pm
- Location: Edinburgh, Scotland, UK
- Has thanked: 149 times
- Been thanked: 195 times
Re: Tesla Model 3 Rear Drive Unit Hacking
Stumbled across a source for the Sumitomo connector for the main inverter: https://www.aliexpress.com/item/1005005920568514.html
It's from the same supplier, Jorch, as the ZombieVerter VCU housing.
It's from the same supplier, Jorch, as the ZombieVerter VCU housing.
- Jack Bauer
- Posts: 3831
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 75 times
- Been thanked: 696 times
- Contact:
-
davefiddes
- Posts: 375
- Joined: Mon Jan 18, 2021 12:39 pm
- Location: Edinburgh, Scotland, UK
- Has thanked: 149 times
- Been thanked: 195 times
Re: Tesla Model 3 Rear Drive Unit Hacking
I've just pushed support for the motor temp sensor. Managed to temperature cycle it between 0 degrees and 100 degrees and got a nice fit to get the Steinhart-Hart coefficients.
To use it just set snsm to "TeslaM3" (ditto snshs):
Note: The option is TelsaM3 for both sensors but they are different types of sensors. The inverter picks the correct device for the heatsink or motor as required.
To use it just set snsm to "TeslaM3" (ditto snshs):
Code: Select all
oic write snsm TeslaM3
oic write snshs TeslaM3
Re: Tesla Model 3 Rear Drive Unit Hacking
My inverter is now neatly assembled, with working temperature sensors. but I really can't find the Tesla wiring harness anywhere anymore so I had to order a new one, which is on its way so in the meantime I've been doing something else.
maybe a bit late but since the holes don't align everywhere and I have a 3D scanner I might be able to contribute to the project. So I made a scan and based on that created a step and dxf file, maybe it's useful. I will also add the 3D scan mesh (if possible with the file size) for those who are interested.
size of the mesh is to big so here a link on grabcad:
https://grabcad.com/library/tesla-model ... rter-pcb-1
Hopefully the wiring harness will arrive soon and I can get my motor running too
FYI, this scan is of a 3D3 front motor PCB with IGBT drivers. This PCB has the pyro for the motor phases on the side screen to be able to break. So, the current sensor is the same as the "older" model, but the middle screw is simply missing because that's where the pyro is.
maybe a bit late but since the holes don't align everywhere and I have a 3D scanner I might be able to contribute to the project. So I made a scan and based on that created a step and dxf file, maybe it's useful. I will also add the 3D scan mesh (if possible with the file size) for those who are interested.
size of the mesh is to big so here a link on grabcad:
https://grabcad.com/library/tesla-model ... rter-pcb-1
Hopefully the wiring harness will arrive soon and I can get my motor running too
FYI, this scan is of a 3D3 front motor PCB with IGBT drivers. This PCB has the pyro for the motor phases on the side screen to be able to break. So, the current sensor is the same as the "older" model, but the middle screw is simply missing because that's where the pyro is.
- Attachments
-
- inverter pcb 2 v26.step.zip
- (67.39 KiB) Downloaded 2 times
-
- tesla model 3 inverter pcb.dxf
- (25.81 KiB) Downloaded 7 times
- Jack Bauer
- Posts: 3831
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 75 times
- Been thanked: 696 times
- Contact:
Re: Tesla Model 3 Rear Drive Unit Hacking
Thank you Dave and nathaniel. It's funny how this simple board made possible by the kindness of (mostly) strangers and stuffed into a 500 euro car in a cow shed in the south of Ireland has caused so many to become animated. Relax please. I'm a threat to nobody.
I'm going to need a hacksaw
- Jack Bauer
- Posts: 3831
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 75 times
- Been thanked: 696 times
- Contact:
Re: Tesla Model 3 Rear Drive Unit Hacking
Dave, some drive units don't have a motor temp sensor at all. Could there be an option to use the oil temp from the pump?
I'm going to need a hacksaw
-
davefiddes
- Posts: 375
- Joined: Mon Jan 18, 2021 12:39 pm
- Location: Edinburgh, Scotland, UK
- Has thanked: 149 times
- Been thanked: 195 times
Re: Tesla Model 3 Rear Drive Unit Hacking
I could add an OilTemp option to snsm that would copy the tmpoil value into tmpm. This would be passed on to others va the default CAN map on ID 0x190.
Internally the only thing we use tmpm for is derating the throttle (in association with tmpmmax). We probably also need to add a tmpoilmax param and derate the throttle with that for all drive units.
Relatedly, one of the last bits of work I can see is coming up with a better control strategy for the oil pump than a fixed speed. It seems to me it needs to be a function of the motor speed and oil and motor temperatures. Perhaps we need to get units into vehicles and get some data logs to see how it behaves.
Edit: Quick tip for grabbing a log of what is happening when testing:
Look at the results in LibreOffice Calc, Excel, etc
Internally the only thing we use tmpm for is derating the throttle (in association with tmpmmax). We probably also need to add a tmpoilmax param and derate the throttle with that for all drive units.
Relatedly, one of the last bits of work I can see is coming up with a better control strategy for the oil pump than a fixed speed. It seems to me it needs to be a function of the motor speed and oil and motor temperatures. Perhaps we need to get units into vehicles and get some data logs to see how it behaves.
Edit: Quick tip for grabbing a log of what is happening when testing:
Code: Select all
oic log VALUES my-big-burnout-4.csv
- outlandnish
- Posts: 17
- Joined: Thu Sep 01, 2022 2:23 pm
- Has thanked: 19 times
- Been thanked: 16 times
Re: Tesla Model 3 Rear Drive Unit Hacking
Here's the OEM to OpenInverter pin mapping if anyone needs it:
Pin 1 is the lower right from the outside of the inverter and the lower left of the housing facing towards the PCB.
Pins are ascending in each column - the bottoms pins are Pin 1 / Pin 11 / Pin 21
Got everything setup but unfortunately I'm getting two errors on my Phase C Hi Gate Driver: REGERRR | REGERRL that I'm currently investigating
Pin 1 is the lower right from the outside of the inverter and the lower left of the housing facing towards the PCB.
Pins are ascending in each column - the bottoms pins are Pin 1 / Pin 11 / Pin 21
Got everything setup but unfortunately I'm getting two errors on my Phase C Hi Gate Driver: REGERRR | REGERRL that I'm currently investigating
- Jack Bauer
- Posts: 3831
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 75 times
- Been thanked: 696 times
- Contact:
Re: Tesla Model 3 Rear Drive Unit Hacking
That's a brilliant diagram. I have added it to the Github repo. The Reg errors are likely caused by a short dropping the Phase C hi isolated power rail. it wont cause any harm as each supply has its own current limiter.
I'm going to need a hacksaw
- outlandnish
- Posts: 17
- Joined: Thu Sep 01, 2022 2:23 pm
- Has thanked: 19 times
- Been thanked: 16 times
Re: Tesla Model 3 Rear Drive Unit Hacking
Thanks! I've updated the diagram in that post to account for a couple more OEM pin mappings.Jack Bauer wrote: ↑Tue Nov 18, 2025 9:48 am That's a brilliant diagram. I have added it to the Github repo. The Reg errors are likely caused by a short dropping the Phase C hi isolated power rail. it wont cause any harm as each supply has its own current limiter.
As for the reg errors, I've removed the board again and desoldered the MOSFETs for Phase C entirely and then lifted the Phase C hi gate driver and and re-soldered it on. I'm still getting those errors. Any chance it might just be a faulty gate driver? Or should I be looking at other parts of the circuit for Phase C Hi?
-
davefiddes
- Posts: 375
- Joined: Mon Jan 18, 2021 12:39 pm
- Location: Edinburgh, Scotland, UK
- Has thanked: 149 times
- Been thanked: 195 times
Re: Tesla Model 3 Rear Drive Unit Hacking
Did you check the board was working before soldering it to the inverter chassis & mosfets? I would recommend bench testing with just 12V and CAN. The inverter should come up and report that the gate drivers are all OK. It doesn't need the big mosfets to function. You shouldn't need to dismount to debug though.
The REGERRR and REGERRL errors are the sort of thing I have seen when the gate drive PSU is turned off. It would be worth double checking the gate drive PSU for each phase in turn. You do this with TP6/TP7/TP8 for phase A, TP9/TP10/TP11 for phase C and TP12/TP13/TP14 for phase B. I measured 12.7V for the positive supply and -5.1V for the negative supply for each phase. This matches Damien's video I think.
If the phase C PSU is not working it may have current limited as Damien explained. You might have to desolder the relevant STGAP1AS to see if it is a PSU problem or a gate driver chip problem. I found access around the "hot" side of the gate drivers to be quite fiddly. I can imagine it being really easy to end up with a short or nudging one of the many passives.
The REGERRR and REGERRL errors are the sort of thing I have seen when the gate drive PSU is turned off. It would be worth double checking the gate drive PSU for each phase in turn. You do this with TP6/TP7/TP8 for phase A, TP9/TP10/TP11 for phase C and TP12/TP13/TP14 for phase B. I measured 12.7V for the positive supply and -5.1V for the negative supply for each phase. This matches Damien's video I think.
If the phase C PSU is not working it may have current limited as Damien explained. You might have to desolder the relevant STGAP1AS to see if it is a PSU problem or a gate driver chip problem. I found access around the "hot" side of the gate drivers to be quite fiddly. I can imagine it being really easy to end up with a short or nudging one of the many passives.
- Jack Bauer
- Posts: 3831
- Joined: Wed Dec 12, 2018 5:24 pm
- Location: Ireland
- Has thanked: 75 times
- Been thanked: 696 times
- Contact:
Re: Tesla Model 3 Rear Drive Unit Hacking
Running the latest build in the V50 now from Dave's github. All temps reporting correctly.
In general, do please follow the procedure in the video. I know it's tempting to skip parts when you want to see a result , I know that all too well but it almost never works out to be quicker.
In general, do please follow the procedure in the video. I know it's tempting to skip parts when you want to see a result , I know that all too well but it almost never works out to be quicker.
I'm going to need a hacksaw