# DIY Tesla Controller



## Tomdb (Jan 28, 2013)

This thing should be as easy to get working as with the Chevy Volt unit I reverse engineered.

If you need any help doing some board layout or something let me know. 

Ofcourse thank you for posting this in the public domain.


----------



## jhuebner (Apr 30, 2010)

This will be a major improvement on Tesla drive train recycling, thumbs up 

I guess the drop in board won't be 2 stories high but the stm32 will be directly on it?
Make sure to use the rev2 main board schematic and maybe double check the IGBT fault detect pins as they are new. BTW some STM32 pins are 5V tolerant and all others can take 5V with a simple 10k series resistor. More in the data sheet.
Once you figure out the temp sensors I can integrate them in the software.


----------



## jackbauer (Jan 12, 2008)

Yeh it will be a single sided smt board. I've already ordered the connectors from mouser. Good to know about the STM pins. It seems the driver will accept 3.3v or 5v signals although the fault pins are 5v.

The temp sensors should not be too much trouble. May have to pump warm water through the unit to get a second setpoint.

Given the problems we have seen with usb comms and the fact this thing will be pumping 1200A+ into the motor i'm thinking of using a MAX232 or similar for serial. What I would really like is to be able to communicate over CAN 

Thanks for the offer Tom


----------



## jhuebner (Apr 30, 2010)

CAN communication is in the making. All parameters will be settable via CAN.

I recommend you use RS485 over twisted pair, it is by far more fault tolerant and you can get cheap Chinese USB adapters, too.


----------



## riba2233 (Apr 29, 2015)

Wow, nice work and thank you for doing this!


----------



## Arlo (Dec 27, 2009)

Great work. Its good to see someone working on this. There is a couple different drive units. I believe the "P" models have the more powerful version then the rest of the models in the rear all the fronts I think are the same.


----------



## jhuebner (Apr 30, 2010)

Oh, forget what I said about using RS485. It needs a transmit enable pin and there isn't one... Perhaps RS422 is an option as it's also differential but bidirectional.


----------



## jackbauer (Jan 12, 2008)

jhuebner said:


> Oh, forget what I said about using RS485. It needs a transmit enable pin and there isn't one... Perhaps RS422 is an option as it's also differential but bidirectional.


So something like the SN65HVD379 on the logic board?
http://www.ti.com/lit/ds/symlink/sn65hvd379.pdf

and a usb adapter on the pc :
http://www.ebay.co.uk/itm/USB-to-RS...991839&hash=item361a7deffe:g:6kQAAOSw8GtZQezG

Looking forward to the CAN configuration. Will need to look at some sort of a pc front end for that.


----------



## jackbauer (Jan 12, 2008)

Arlo said:


> Great work. Its good to see someone working on this. There is a couple different drive units. I believe the "P" models have the more powerful version then the rest of the models in the rear all the fronts I think are the same.


Thanks Arlo. Do you know if the P model drive units are any different in hardware or is it just firmware limited?


----------



## jackbauer (Jan 12, 2008)

So the current sensors are plain vanilla 5v supply and 2.5v out at zero current. Positive current decreases the voltage and negative current increases. 

Pinout :

Black = GND
Red = +5V
Grey = screen GND
White = 2.5v referrence
Green = current output. 2.5v at 0A. Scale TBD.

This will interface perfectly with the inverter current sensing circuit.


----------



## jhuebner (Apr 30, 2010)

Lovely, none of that old-school +-15V stuff. I really like their straight forward design. I reckon their BOM cost is lower then that of far less powerful inverters out there (including my own in the Polo)


----------



## jackbauer (Jan 12, 2008)

More news : Worked out the DC bus voltage sensing , DC bus discharge circuit and temperature sensors. The two case mounted temp sensors read around 15k at ambient and decrease resistance when warmed. Resistance is the same in both polarities so i'm thinking plain jane NTC. The sensors buried in the motor read 146k at ambient in both directions. No way to warm them .....yet!

The DC bus voltage sensor outputs 30mV for 10V on the bus , 60mV for 20V etc in a linear range. 

Video and pinouts to follow.


----------



## Arlo (Dec 27, 2009)

jackbauer said:


> Thanks Arlo. Do you know if the P model drive units are any different in hardware or is it just firmware limited?


The hardware is different this is why you can't pay for a over the air update to get a P added to the car at a later point. 

I believe all the front units are the same just the rear is different.


----------



## Arlo (Dec 27, 2009)

jackbauer said:


> So the current sensors are plain vanilla 5v supply and 2.5v out at zero current. Positive current decreases the voltage and negative current increases.


What part number?

I have found it is common to get a bit of residual magnetism on the current sensors as well as temp plays a small roll in the calibration of 0 amps. 
I am using 2 types 1 is the melexis type for a buss bar and the other is a Honeywell csla2en for the inverter phase outputs them selves and both types have a bit of a problem with showing a true 0.


----------



## jackbauer (Jan 12, 2008)

They are actually shunts to the best of my knowledge. If you want to eliminate drift when reading hall type sensors you need to take a differential reading between current output and refference output. I have used this on the LEM HTFS800 series to good effect. You would need at least 16 bit accuracy though.


----------



## jhuebner (Apr 30, 2010)

Arlo said:


> The hardware is different this is why you can't pay for a over the air update to get a P added to the car at a later point.
> 
> I believe all the front units are the same just the rear is different.


Different as in weaker/less IGBTs? I read about 14 in parallel, maybe they populate a few less for non-P versions?


----------



## Arlo (Dec 27, 2009)

jackbauer said:


> They are actually shunts to the best of my knowledge. If you want to eliminate drift when reading hall type sensors you need to take a differential reading between current output and refference output. I have used this on the LEM HTFS800 series to good effect. You would need at least 16 bit accuracy though.


I didn't realize you were using the OEM sensors yes they are shunts.

Thanks for the pointers on the hall type.


----------



## jackbauer (Jan 12, 2008)

Working out some more parts of the inverter :

https://www.youtube.com/watch?v=PzazVv5q20o


----------



## jackbauer (Jan 12, 2008)

Arlo , you might find this interesting. 0.114v Vce drop on the Tesla igbts using your diode test method.


----------



## jhuebner (Apr 30, 2010)

Maybe the overshoot on the voltage sensor anticipates a fast over voltage shutdown? Should definitely get rid of the low pass filter on the mainboard udc input.

I wonder what to do with all the temp sensors as there are only two inputs.

On the current sensors I wouldn't worry about accuracy too much as their value is NOT part of the control loop but only server diagnostic purposes and over current protection. Both not requiring high accuracy.


----------



## jackbauer (Jan 12, 2008)

Well if you liked those temp sensors I found 3 more Seems each igbt heatsink has it's own sensor. 52k at around 20c ambient tonight.


----------



## Arlo (Dec 27, 2009)

jackbauer said:


> Arlo , you might find this interesting. 0.114v Vce drop on the Tesla igbts using your diode test method.


Hmm cool. 

I was not actually trying to measure the voltage drop as you need real current for that.

What I found was i was able to prove some IGBTs were fake because they turned on at a higher gate voltage.  

I have a way to use the desat pin and watch the current sensor to get accurate voltage drop info over a range of currents.


----------



## jackbauer (Jan 12, 2008)

Got an hour to work on the inverter this evening. Fully mapped out the 24 pin IGBT connector plug on the mainboard. Only one pin per driver board remains a slight mystery. The logic board feeds it 5v upon powerup. This pin seems to have no function that I can discern. It draws no measurable current even down to the best resolution of a 6 1/2 digit microammeter and is tracked to 3 unpopulated pads so I'm taking a guess it's unused in this version of the driver. Perhaps an optional fault reset for the drivers?

Anyway , removed the Tesla logic board and have started wiring up one of my logic boards to see if we can fire up the inverter and drive a small motor on the bench.


----------



## jackbauer (Jan 12, 2008)

Major milestone today. Spinning a small motor on the bench with Tesla inverter and Heubner logic :

https://www.youtube.com/watch?v=y1d6GVxoqdU


----------



## jackbauer (Jan 12, 2008)

Started defining the components and board and laying out the logic pcb. This will be a drop in replacement board for the Tesla original. Unlike previous versions of the Heubner inverter, this will not use the Olimex STM card but rather places the STM32F103 device directly on the PCB.


----------



## riba2233 (Apr 29, 2015)

Oh man, this will be a real revolution for converting to EV


----------



## jackbauer (Jan 12, 2008)

So I have now all the pcb connectors on the logic board fully mapped. One thing I need to work out is the remapping of certain pins in the 23 pin Ampseal connector for use with the open source inverter. Took a quick look at it and I think it will work. Take a look at the pdf and see if it makes sense.


----------



## jhuebner (Apr 30, 2010)

Couldn't see any mishaps at first glance. So the missing pins are


mtmp+ and mtmp- - probably connected internally
in_bms - unused
out_pwm - unused
in_emcystop - must be internally tied high
out_vtg - unused
out_err - unused
in_mprot - must be internally tied high
in_cruise - unused
Would it be worthwhile to put in_cruise and out_err on the two vacant pins?


----------



## jackbauer (Jan 12, 2008)

Sadly those Can out pins are not wired to the board connector. They are just looped at the socket to Can in so can't be used. I think things like errors and cruise control etc will need to be over can.


----------



## jhuebner (Apr 30, 2010)

Oh, could have read that in the comments  Well, not a big deal I suppose and mapping it to CAN should not be too hard either.


----------



## jackbauer (Jan 12, 2008)

Cool. Settled on the ADM3101E to handle RS232. Simple and cheap and will work for setting params and software updates etc while waiting for CAN.


----------



## jackbauer (Jan 12, 2008)

Well , the schematic is done. Now comes the real fun part

....might be time for 4 layer...


----------



## jhuebner (Apr 30, 2010)

Though I do hope you'll fit in on two layers  I think it's possible.


----------



## jackbauer (Jan 12, 2008)

Kept myself sane in a hospital waiting room for 3 hours yesterday with the laptop and a wireless mouse. All components now placed on the board. I have decided to go for 4 layer with one power and one ground plane on the inside. Should be possible later to revert to 2 layers but just for safety and ease of layout decided to go for 4.


----------



## Tomdb (Jan 28, 2013)

This should actually not be too hard on a two layer design.

Not alot of components on there.


----------



## jhuebner (Apr 30, 2010)

Wow, this is as empty as Canada  You could route our names in there. Speaking of which: it's Huebner instead of Heubner


----------



## jackbauer (Jan 12, 2008)

jhuebner said:


> Wow, this is as empty as Canada  You could route our names in there. Speaking of which: it's Huebner instead of Heubner


Aw crap sorry. I should know by now Blame the drugs from hospital

Yeh it is fairly sparse but I am keeping space for another micro to look after all those temperature sensors. It does makes the Tesla board look ridiculously complex.


----------



## jhuebner (Apr 30, 2010)

Not a problem 

So yeah, if you put a small µC on there just for the temp sensors it could stimulate the inverters input with the respective maximums. I.e. tmphs gets stimulated with max{tmphs1, tmphs2, tmphs3} and the like for the motor. Don't even need a DAC for that, just low-passed PWM. AtTiny24 would do the job, it has 7 ADC channels, 2 PWM outputs and I used it before 

For diagnosis the values can go on the CAN bus. Not sure if the UART shares the same bus so well?


----------



## jackbauer (Jan 12, 2008)

That's a cool idea but I don't think it would have enough pins. We need 7 ADC inputs and 2 pwm outputs.


----------



## jackbauer (Jan 12, 2008)

Some late night tracking later ....


----------



## jhuebner (Apr 30, 2010)

Wow, that was quick, nice work 
Now is it 2 or 4 layers?

Atmel processors really are a bit short on ADC inputs or they are shared with some other essential pin  Ah well, not so important for a first release...


----------



## jackbauer (Jan 12, 2008)

4 layers for now. The inner layers are gnd and +5v. Apart from the ease of layout I like the ground layer as we are going to be pumping over 1000A per phase here


----------



## jackbauer (Jan 12, 2008)

Video of the pcb and schematic layout so far : https://www.youtube.com/watch?v=h5SHA3AEQ2s


----------



## jhuebner (Apr 30, 2010)

Ok, good summary. If you feel like throwing out parts you could remove the 32kHz crystal as it's unused.

Want to share the BOM cost?

Would it make the difference to EMC shielding if the ground plane were bottom-most?


----------



## jackbauer (Jan 12, 2008)

Not sure on the BOM cost yet but I'd guess around the 100 Euros mark including pcb and excluding assembly. The design files will go on release in a few weeks as soon as the design is verified on the bench. I don't want people running off building this thing if I have made a mistake.

So mostly when I make a dual layer board I use the bottom as GND and top as Vcc using copper pour. As I said in the video I felt the 4 layer was justified here for robustness etc.


----------



## jackbauer (Jan 12, 2008)

Our favorite automaker use the TI TPS5420 to provide the main 5V rail on the logic board. Very nice looking part. Might just use it myself


----------



## Tony Bogs (Apr 12, 2014)

Thanks. Great buck controller. Thumbs up







.


----------



## jackbauer (Jan 12, 2008)

Getting close to pulling the trigger and ordering boards. Have checked all pinouts both schematic and pcb against datasheets. Been stung before with library parts! Checked power and grounds on all connectors against the Tesla board. Identical. Rechecking signal connections for the last time. Checked component fits and ran drc. Schematic and pcb are identical.

....what am I missing.....I always miss something

edit : board size identical to Tesla , mounting holes identical to Tesla


----------



## nitrousnrg (Feb 25, 2016)

I think your drive does not have populated the components for a dynamic gate drive.

I bet its the line your're missing.

This is the tesla patent describing their dynamic gate drive..
https://www.google.com/patents/US20120194119

I think they use a PWM signal over an optocoupler to control the negative gate voltage. I think you measured -8v, well, they could change that voltage dynamically to have faster switching. Faster switching means higher efficiency. But faster switching at high currents means more overshoot, which can damage the igbts.

So at low currents -> high speed switching for efficiency
At high currents -> normal speed switching to keep overshoot at safe levels

I could be wrong though, just my $0.02

Wanna check if that is the case?
It could be something like this schematic
https://eyrie.io/board/c5ac1a5f21ce...1&y=2058528&w=4843482&h=2644835&flipped=false


----------



## nitrousnrg (Feb 25, 2016)

As a side note, this is also a stm32 controller

https://eyrie.io/board/6f397be72375...&y=4134000&w=16667380&h=9101400&flipped=false

Maybe its interesting for you. I use an isolated can bus PHY for example, and schottky diodes for input protection everywhere. Its discussed here


----------



## jackbauer (Jan 12, 2008)

nitrousnrg said:


> I think your drive does not have populated the components for a dynamic gate drive.


An interesting concept. The unused line on my gate driver board tracks to several unpopulated parts. Perhaps they only implement this on the P models? Guess I'll just have to get a P drive unit


----------



## jackbauer (Jan 12, 2008)

nitrousnrg said:


> As a side note, this is also a stm32 controller
> 
> https://eyrie.io/board/6f397be72375...&y=4134000&w=16667380&h=9101400&flipped=false
> 
> Maybe its interesting for you. I use an isolated can bus PHY for example, and schottky diodes for input protection everywhere. Its discussed here


Looks like a great project. I'll have a read. I'm not fully sold on the need to isolate everything. Yes things like gate drive , bus voltage etc but I tend to leave it there. Besides , in this application Tesla have done it anyway


----------



## jackbauer (Jan 12, 2008)

Well , it's done. 10 boards and a stencil ordered from SeeedStudio. Wish me luck 

Made a last minute decision to track out all ununsed pins both from the connectors and the MCU to pin headers just in case.


----------



## jhuebner (Apr 30, 2010)

jackbauer said:


> An interesting concept. The unused line on my gate driver board tracks to several unpopulated parts. Perhaps they only implement this on the P models? Guess I'll just have to get a P drive unit


Haha, maybe thats the difference in hardware Arlo pointed out 

The patent on figure 9 only has a switch as if you could select between 2 negative drive voltages.


----------



## jackbauer (Jan 12, 2008)

So here is a pic of one of my gate drivers. If you look to the mid left edge at R71 , R70 and C72 this is where the mystery pin goes. These are unpopulated on this board as well as several other ICs and passives. Certainly supports the theory as this is a S70 inverter.


----------



## nitrousnrg (Feb 25, 2016)

Yes, makes sense. Maybe they use a digital 1/0 control instead of an analog control., the patent shows both. The only difference between digital vs analog would be an 8 pin opamp or top and one for bottom gate driver, which could be on the bottom side o the board.

Anyway, maybe they figured how to tune the gate driver without the dynamic control. Its odd if they are trying to cut down costs with that, its only a couple of bucks in components. Probably this makes for a simple and more reliable operation rather than lower costs.


----------



## nitrousnrg (Feb 25, 2016)

The difference arlo pointed out I'd say is more like a different IGBT part number. That would make a bigger difference than this dynamic gate control. Could be both of course.

Maybe this helps you figure out that igbt driver. Mine is kind of similiar, but less cramped and with components only in one side, so its easier to follow. The overshoot ctrl is the dynamic gate drive, discussed here
https://endless-sphere.com/forums/download/file.php?id=218233&mode=view


Its a day too late, but one tiny thing I would change in your board is that series diode in the power input for reverse protection.
A mosfet would do a better job
http://www.ti.com/lit/an/slva139/slva139.pdf

And maybe move L1 switching node closer to the controller,, and with more vias. The trace is kind of thin and long, switching supplies can be tricky


----------



## dima (Dec 1, 2015)

Making Tesla a true open source ...not just the patents 



jhuebner said:


> Wow, this is as empty as Canada


Ah, we got many carbon absorbing trees here.


----------



## jackbauer (Jan 12, 2008)

dima said:


> Making Tesla a true open source ...not just the patents
> 
> 
> Ah, we got many carbon absorbing trees here.


Love the logo 
Boards are in production!


----------



## jackbauer (Jan 12, 2008)

Boards and stencil shipped today from SeeedStudio


----------



## Tony Bogs (Apr 12, 2014)

EVTV and Eldis have hacked the high power drivetrain of a "standard" model S.
Lots of torque. Great if I ever want to convert a mobilhome, but for now it looks like it going to be a Renault Espace in 2018. 

Here's the point: a 150kW front drivetrain of 85D. 
The Espace has a fiberglass body, so from an EMC perspective an integrated drivetrain is ideal. 
The torque from a "standard" S drivetrain, however, is a bit too much to handle for the steel chassis, suspension and wheels of an Espace.
The power rating of the battery pack is also going to be an issue.

The 150kW drivetrain in the front of a Tesla 85D seems more suitable.
Any ideas about compatibility of the drivetrain (inverter) in the front of a 85D?


----------



## jackbauer (Jan 12, 2008)

So I'm not in any way trying to out do the work of EVTV or Michal Elias. This is just a different approach. I'm a hardware guy. I can write a bit of simple software but not in the league of what would be needed to run the Tesla inverter from CAN. From looking around it also became apparent that Tesla have been further locking down the drive units with various security systems in firmware. Possibly in response to the media hype about car hacking. A replacement logic board gets around this in a way that is not so easy for Tesla to block. IF this project works then it won't matter what race , color or creed of your drive unit it will just run. With the added bonus that you can go full race car and ignore the temp sensors and burn out your motor in one race AND possibly , just possibly , squeeze out more power.

Regards the front drive unit I have just today received an offer of just such a unit from a gentleman in the UK from a 2016 P85 who is prepared to loan it to me for "Research"  Don't touch that dial folks. The Tesla project is just getting started!


----------



## jackbauer (Jan 12, 2008)

Getting the kit together for my PCB builders. Hope to drop the kit and boards to them this weekend and run two prototypes next week.


----------



## jackbauer (Jan 12, 2008)

Ok so I think I have a simple strategy to deal with the multiple temp sensors in the Tesla inverter. Plan to stick a 74HC4852 dual 4:1 analog switch on the rev 2 board. Driving it's select pins from two of the unused pins on the main micro should allow each of the 3 heatsink and 4 motor temp sensors to be routed to the analog inputs in turn and sampled.


----------



## Tony Bogs (Apr 12, 2014)

jackbauer said:


> So I'm not in any way trying to out do the work of EVTV or Michal Elias.


I'm not implying anything with regard to your motives. Jason Hughes has a video online showing a front drivetrain spinning. Only saying: they have already shown that it can be done.

And yeah, you have a different approach and I really like it. Open source, Huebner's software and an integrated Tesla drivetrain. 

Ok, so you're confident a front drivetrain will also work. That's great. 
I won't touch that dial, but I might start a build (2018) and try to keep up. Won't be easy with your track record.


----------



## jackbauer (Jan 12, 2008)

Bare boards and stencil arrived today. Test number one passed : they fit the inverter

Dropping them to my pcb builder on friday to have 2 pieces professionally built as I don't have time to do a hand build right now. Fingers and toes crossed


----------



## Tony Bogs (Apr 12, 2014)

Best Tumanako board design so far.







Took quite a bit of time to get the detailed info from the video, but I didn't see anything huge that might blow up the cat or the house.

It seems that a level shifter is needed between the STM32 controller and the EDxxx chips on the driver boards. The EDxxx has 3.5V as lower limit for logic high.
I don't think it will cause problems during test runs and the solution is simple: for instance a 74HCT573.


----------



## jackbauer (Jan 12, 2008)

Tony Bogs said:


> Best Tumanako board design so far.
> 
> 
> 
> ...


Thanks Yes I had thought about putting in a level shifter and still might. I tested on the bench and the gate drivers seem to switch high at 1.8v so might be some signal conditioning on the driver boards.


----------



## jackbauer (Jan 12, 2008)

The design files for the V1 board are now released on Github :
https://github.com/damienmaguire/Tesla-Drive-Unit

I expect to have the prototypes back from the pcb builder by next weekend. Completely untested design. For education and development purposes only.


----------



## Tomdb (Jan 28, 2013)

Cant wait to see how far this goes. Been secretly eyeing tesla parts.

Unfortunately little second hand tesla parts in the UK.


----------



## jackbauer (Jan 12, 2008)

While waiting for the full builds decided to throw on the cpu and the minimum components to make it run just to see if it would program. And it does! We got a heartbeat


----------



## Tomdb (Jan 28, 2013)

Got it flashed? 
Might look at doing a smd board too once I get a hold of suitable drivetrain, or just copy your wonderful design.


----------



## jhuebner (Apr 30, 2010)

Great! So good power and clock supply.

Just a side note on derived work: be aware that the base work is under the GPL, so make sure all you contributions are freely available and carry the names of the original author(s) like Damien has done on the Tesla board.


----------



## Tony Bogs (Apr 12, 2014)

jhuebner said:


> Great! So good power and clock supply.


Absolutely. And you have made it so easy to reassign I/O to PC14 and PC15 in SW. Great! Makes it possible to free up a SPI port.

It sure still does the trick, but I haven't used a ULN2003 since the eighties.


----------



## jackbauer (Jan 12, 2008)

Tony Bogs said:


> It sure still does the trick, but I haven't used a ULN2003 since the eighties.


I'll try and squeeze in a 6821 PIA 

In other news got the full power supply and RS232 converter populated and running. Bad news is Elon put a 47nF cap across the two lines in the Ampseal connector I had designated for Rs232 so will need to reassign these pins on the next rev.


----------



## Tony Bogs (Apr 12, 2014)

Great news. Motor spinning tomorrow?  



jackbauer said:


> I'll try and squeeze in a 6821 PIA


Nice, but I never used that one. Still got a few 40 pin DIL Zilog Z80 parts somewhere in the attic though.


----------



## jackbauer (Jan 12, 2008)

Good news is I got the board fully built and it didn't blow up. Then I can't get the current sensors to work. Now , I've been messing about with electronics for over 30 years and never have I mistaken a digital signal for an analog signal. I mean , they are sorta different right? Well , Elon completely kicked my ass today. The current sensor signal looked analog. It behaved analog , it smelled analog , it even tasted analog. But it's digital.........

So our current sensors are digital. Now I gotta figure out what sort of digital..........


----------



## kennybobby (Aug 10, 2012)

So you didn't peel open your tesla inverter very far? Photo of current sensor here:

http://www.diyelectriccar.com/forums/showpost.php?p=614610&postcount=14

also i think Jack has a picture from the other side here:

http://d38b2t7ko8da9u.cloudfront.ne...t/uploads/2017/04/IMG_0406-768x512.jpg?x57894


----------



## nitrousnrg (Feb 25, 2016)

Just guessing... I'd say its a delta sigma modulator output. I was pretty sure it was digital, imagine my desmay when I heard you say you had an analog sensor.

http://www.ti.com/product/AMC1203

IMO going digital is the only way if you have 1200 amps flowing that close. I really wanted to use the amc1203 in my build but properly decoding a digital delta sigma is no easy task, so I went with the differential signal route.

I tried asking isabellenhuette since its the sensor manufacturer, but didn't succeed.

You can probably run a buffer and rc low pass filter and get an analog voltage. The issue is the filter order, its really hard to get the optimum response time without a well tuned digital filter.
TI microcontrollers come with a hardware peripheral to decode the delta sigma, otherwise is very very cpu intensive.
Stm32 also have a similar peripheral, bit its only found in a family that has differential adc inputs. I think it was stm32f3xx

At least thats what I remember, I could be wrong. I'm keen to see how you figure this out. I want to use that digital protocol on my stm32f4 inverter. Its far better than going analog.


----------



## jackbauer (Jan 12, 2008)

Couldn't read anything from that photo so popped out one of the busbars. Not a hard job. 

IC1 = ADW7001
IC2 = UM5000W
IC3 = AD8639
IC4 = AWS

Now just gotta figure this stuff out ....


----------



## dcb (Dec 5, 2009)

isolated 5v
isolated 16 bit adc (+-250mv)
op amp
???

from what I understand it is important for it to be fast!

the 7001 (the most interesting bit) comes back as a 7401, guessing it has an external oscillator, dunno. fft the 1s returned for frequency?

http://www.analog.com/en/products/a...ad7401a.html?doc=AD7001A.pdf#product-overview

edit, ugh, they use a fpga in their example. 10mhz clock stream. page 15...
http://www.analog.com/media/en/technical-documentation/data-sheets/AD7400.pdf


----------



## jackbauer (Jan 12, 2008)

So yeah the UM5000W is an ADUM5000w iso dc dc converter , The AD8639 is an op amp and the "AWS" is a TI TPS6040 charge pump inverter. Can't get anything definite yet on the ADW7001Z...


----------



## jackbauer (Jan 12, 2008)

Ok just saw the link for the AD7401A. Thanks DCB. The clock speed is 18MHz from the Tesla logic board.


----------



## jackbauer (Jan 12, 2008)

nitrousnrg said:


> Just guessing... I'd say its a delta sigma modulator output. .


I think you hit the nail on the head. Now , given Johannes's inverter doesn't need highly accurate current measurements (it's just used for overload shutdown) I think We can just feed it a clock source and analog filter the output. Looking at the datasheet for the AD7401 it looks like a glorified pwm output anyway


----------



## nitrousnrg (Feb 25, 2016)

18mhz... maybe with the spi peripheral. Sclk + miso.

That would need a chip select so both sensors can be directed to the same miso pin.
And a buffer to transmit the clock from the stm to the sensor.

The sinc3 filter is hard on the cpu, keep that in mind.


----------



## nitrousnrg (Feb 25, 2016)

Sure, clock + analog filter would get you the analog signal. Just keep in mind the signal response wont be stellar.


----------



## kennybobby (Aug 10, 2012)

Don't see any reference designators--are you using the same convention as on Jack R's board? 

IC3: AD8639, 8-pin op amp

IC2: 16-pin 2.5kV isolated dc-dc converter, AD uM5000W

IC1: 16-pin marked as ADW7001, = AD7401A isolated sigma-delta modulator 

IC4: 5-pin marked as AWS= TI TPS6040 voltage inverter (although marking doesn't match TI)


----------



## jhuebner (Apr 30, 2010)

I checked the pins that have been freed up but none of them qualifies as a MHz clock source.

So basically amplifying the STMs 8MHz clock and low pass filtering the output would do the job? What sort of cutoff frequency would you need to get a smooth signal? The scope shows 3.7MHz. The cutoff frequency of the current design is around 60kHz.


----------



## jackbauer (Jan 12, 2008)

Elon threw me a bone. Seems the converter is not so fussy about it's clocking frequency. Let's see how low we can go


----------



## Tony Bogs (Apr 12, 2014)

Seems that a simple first order filter will not be sufficient. 
Scope image shows about 12.8 kHz out @ 10 MHz in. 

The PWM ripple in the phase current from the inverter will be lost in conversion when an analog filter is used. 

Considerable group/phase delays have to be taken into account when a higher order analog filter is used. 

For instance: is the quad LM2901 comparator (overcurrent) still useful?

Clock source: a crystal oscillator in a can is very cheap and available off-the-shelf in a great number of frequencies. For instance QX8 series by www.qaltek.com.


----------



## jackbauer (Jan 12, 2008)

That was at 31kHz input. At 1MHz clock I am getting around 400Khz data rate.


----------



## nitrousnrg (Feb 25, 2016)

The proper way would be a very small fpga with the sinc3 filter, its a few lines of hdl code, there examples out there about that. Then send the data to the mcu via spi using dma, so instead of reading an adc register it reads a ram address, like a variable. Everything at the max speed you can feel comfortable with.

Having said that, if you want to avoid the sigital signal path, you can use an oscillator, they come in different frequrncies. An oscilator outputs a digital signal, a crystal outputs a whimpy sine if you excite it. You need an oscillator.

The spi clk pin should work, its a high speed peripheral, running at something like cpu clk/2. There is also the MCO pin that is very configurable. I dont remember if it outputs a sine or square clock signal, but its the highest frequency pin. These will be 3.3v signals, buffer it to 5v.

The higher the mhz the easier is the analog filtering. You already need an opamp yo buffer the signal, maybe a 2nd order analog filter would be okay.
By now I'm thinking in 2 external little boards with a so8 opamp (2 opamps), the crystal, and connectors for signal in/signal out.

I couldnt find a delta sigma dac suitable for this.


----------



## jackbauer (Jan 12, 2008)

So at 1MHz clock the existing opamp and filter reproduce quite a clean signal that responds to dc current tests on the bus. I poked about and found an arduino nano. A few lines of assembler have it pumping out 1.01MHz on pin 9. I had left a header on the pcb with ground , 5v , clock1 and clock 2 so it connects up easilly. This will do for testing. Rev 2 pcb will have a nice clock generator and some extra filtering options.


----------



## Tony Bogs (Apr 12, 2014)

jackbauer said:


> That was at 31kHz input. At 1MHz clock I am getting around 400Khz data rate.


That makes more sense.

If it is an AD7401A, correct me if I'm wrong, the minimum clock frequency (spec) is 5 MHz. Max 20 MHz.

So 16 MHz in, 6.4 Mhz out. 6.4 Mhz is two decades above the 60 kHz cut-off frequency of the filter in the current design. App. -40dB @ 6.4 MHz.
74mVpp PWM ripple remaining @ 6.4MHz might be a bit on the high side. 

Well, it seems that it can be done with a second order filter for the LM2901 and an additional filter for the STM32 ADC, but it is not going to be easy.


----------



## kennybobby (Aug 10, 2012)

Just trying to understand the tesla current sensing op amp, does this look right JB? Please correct and fill in resistor values if it would help...


----------



## jackbauer (Jan 12, 2008)

We be motoring Elon loves 17.6KHz ...


----------



## Tony Bogs (Apr 12, 2014)

Awesome fully integrated 400kHz MCP602 filter.  2.25V/usec output slew rate! 
Can it be matched by a FPGA? I don't think so. 

17.6 kHz. It gets better and better every time. Sure it isn't JP?


----------



## nitrousnrg (Feb 25, 2016)

kennybobby said:


> Just trying to understand the tesla current sensing op amp, does this look right JB? Please correct and fill in resistor values if it would help...


Also interested about this. How much gain does this opamp provide?


----------



## jackbauer (Jan 12, 2008)

So I made a silly mistake. Bashing my head off the wall last night with a weird problem : I could run the test motor just fine at 17v bus voltage. At 18V the inverter would drop out instantly on startup. With a fresh head this morning I did some probing about and found this nice little 50ns pulse on the output of the 74HC30. The fault lines from the igbt driver boards are naturally picking up noise from the high speed switching and brains didn't think to put a filter on them before running them into a high speed logic gate

Anyway , another mod for rev 2 of the pcb. To keep the show on the road I fitted a filter to the output of the 74HC30 and all is well but obviously filtering at the inputs is the way to go.

time to spin the tesla motor soon ....


----------



## jackbauer (Jan 12, 2008)

https://www.youtube.com/watch?v=uP1cCAnAOKg


----------



## kennybobby (Aug 10, 2012)

Great video, thanks for sharing. With all your pcb activities i think you could use a parts storage bin or two...

cheers to ya!


----------



## jackbauer (Jan 12, 2008)

https://www.youtube.com/watch?v=L6-2VzMmTSA


----------



## jackbauer (Jan 12, 2008)

Just found the perfect solution to the clock generator for the current sensors :

http://www.linear.com/product/LTC1799


----------



## jhuebner (Apr 30, 2010)

Or a fixed frequency oscillator if you want to cut the BOM cost a bit
https://www.digikey.de/product-detail/de/sitime/SIT2001BI-S2-33E-12.000000G/1473-1339-1-ND/5824448


----------



## jackbauer (Jan 12, 2008)

Ok , here is a first run at the V2 board schematic. Modifications made over the V1 :



Used the excellent filter designed by Tony Boggs for the Sigma Delta current sensors. Only addition is a simple potential divider on the output to bring the range within 0-3.2V
LTC1799 clock generator with a pot to enable setting of clock frequency for testing and provision for a fixed resistor. Still struggling with the equation for the output frequency as they mix up the units in the datasheet.
simple R-C filters fitted to the fault lines from the IGBT drivers before entering the Nand gate to prevent false overcurrent shutdown conditions observed on the prototype.
74HCT573 buffer used in transparent latch mode between the STM PWM outputs and the drivers to boost the driver signals to the 0-5V levels.
74HCT4052 dual 4:1 multiplexer and pullups for monitoring all the temp sensors. Each sensor is selected via two digital lines from the STM
To Do : Reassign ampseal pins for RS232 lines.


----------



## nitrousnrg (Feb 25, 2016)

2 questions
is 1mA enough to drive 2 long lines at 20mhz? Its weaker than an stm32 gpio. You have 2 free lines in the buffer you use for the pwm, you could use it.

Is the thing you plug in the jtag port capable of charging/discharging a 10uF NRST cap? Its no minor load.


----------



## jackbauer (Jan 12, 2008)

Very good point on the clock driver output. I had missed that. I'll change it to use the spare lines on the 74HCT573. Had no problems programming the board so far on jtag.


----------



## nitrousnrg (Feb 25, 2016)

I see overcurrent protection logic. Its difficult to read but connecting that logic to the PWM buffer EN could create a hardware current fault protection that overrides the microcontroller in case of a firmware bug. This doesn't latch though.

btw, do you know the deadtime for that gate driver? I'd guess 1us.


----------



## jackbauer (Jan 12, 2008)

Got a little something delivered today Front drive unit from a P85D.I am greatly humbled by the fact this was donated by a viewer who traveled quite a long distance. Time for more reverse engineering .......


----------



## nitrousnrg (Feb 25, 2016)

Thats cool. PLEASE show us the IGBTs and gate drivers, no one did so far.


----------



## nucleus (May 18, 2012)

*Re: Tesla Front Drive Unit*

Damien, is the unit physically smaller than the RWD unit?


----------



## jackbauer (Jan 12, 2008)

I will of course detail the full inverter and all designs will be open source from day one. Yes it is physically smaller. Updates and video on the way.


----------



## jackbauer (Jan 12, 2008)

https://www.youtube.com/watch?v=QVcyTKiMlWU


----------



## jackbauer (Jan 12, 2008)

Using RS232 on the Tesla inverter ampseal is looking like a non starter. Those guys use more 47nF caps then I use 100nF So I'd say we'll revert to using an ftdi to load the software and parameters on the bench and then CAN for everything else in the car.


----------



## nitrousnrg (Feb 25, 2016)

I'll give that delta sigma filter circuit a try. I kind of need the filters drawn in a particular way to be able to understand them, maybe it helps someone else.


----------



## jackbauer (Jan 12, 2008)

It helps me. Thanks a lot.


----------



## jackbauer (Jan 12, 2008)

Almost there with the V2 board for the large drive unit. Adding test points and double checking.


----------



## nitrousnrg (Feb 25, 2016)

Maybe you don't care much about the current sensing, but a digital buffer just before the delta sigma filter should make a difference if you use the current signal in the future.
This board will receive a quite distorted and rounded (or overshooted?) digital signal, if you put a buffer before the opamp block the signal would be restored to a pristine condition.


----------



## jackbauer (Jan 12, 2008)

Hmmm...so something small like a 74LVC1G07 perhaps? That said the signal looked good on the scope when I checked.


----------



## nitrousnrg (Feb 25, 2016)

It should be a push pull instead of open drine, rise times are much sharper. Also schmidt triggered.
Originally I chose http://www.ti.com/lit/ds/symlink/sn74lvc2g17.pdf
But I need to check again if it has rail to rail output.


----------



## jackbauer (Jan 12, 2008)

I don't think rail to rail would matter here as it is driving a filter anway. Will add this to the design.


----------



## nitrousnrg (Feb 25, 2016)

Non rail to rail would mean a '1' output of 4.4v for example, instead of 5v. If the signal is all '1's it will be integrated by the filter to 4.4v instead of my expected 5v.

If an output high can't reach 5v by 0.2v, so its 4.8v, you have a full scale error of 8%. If this sensor has a range of +/-1200 Amps, your're missing the mark by almost 100A, so keep that in mind when you calibrate it.

Anyway, it seems like rail-to-rail is an opamp thing, doesn't seem to exist in the digital buffer world. And a 20mhz square wave doesn't seem right for an opamp, so I'm keeping my sn74lvc2g17 and trying to keep output current low so Voh gets close to vcc.


----------



## jackbauer (Jan 12, 2008)

Following suggestions and a few ideas of my own I think the REV2 is done. Added a buffer on the inputs from the current sensors as suggested by nitrousnrg.

Looking through the pins on the Tesla ampseal socket they all have bypass caps of some sort except the CAN pins 4 and 5. So added a 2 way jumper to the board to allow those pins be used for CAN or RS232. Simple fix. This freed up two pins. Used one as a ground for the brake pot and the other as a cruise control input. Will check the board out over the weekend for errors, order and post the design files. 

Now , where did I leave that front drive unit ......


----------



## Tomdb (Jan 28, 2013)

Nice work Damien, you are a true open source contributer.

Now get us those porn shots of the front motor.


----------



## Tony Bogs (Apr 12, 2014)

Definitely! Front drive unit!
Thanks for sharing, Damien, and happy tracking and motoring.


----------



## jackbauer (Jan 12, 2008)

So , first look at the front drive unit. Inverter removed and on the bench. Video will be up over the weekend. Few things to note straight away :



Much more integrated and logic board is larger
Looks like LEM style analog current sensors
One motor temp sensor
One heatsink temp sensor
Uses a different type of JST connector for offboard wiring
Encoder looks the same but is mounted inside the inverter casing
Current sensor leadout wires are directly soldered to the logic pcb
20 pin non ampseal connector for signals.


Stay tuned ...........


----------



## coleasterling (Feb 29, 2012)

That front drive unit is a lot smaller than I expected. Do you have an approximate weight for it?


----------



## dcb (Dec 5, 2009)

very nice Damien. just a random thought, wonder if they completely switched to FOC on the front for better regen or something, or just cutting costs or ??. The operating assumption being they had the fancy current sensors on the rear for DTC or something similiar.


----------



## jackbauer (Jan 12, 2008)

It weights around 90kg. Here is a first video showing inverter removal and start of reverse engineering work :

https://www.youtube.com/watch?v=xD788hSxjJ8


----------



## jackbauer (Jan 12, 2008)

First bit of work done on identifying the connectors :

6 way jst for encoder and temp sensor : S06B-AIT2-1AK


2 way jst for temp and hvil : S02BA-AIT2-1AK


The main 20 pin connector is a Molex MX150 but as usual it's a tour de force to identify the right one. I hate connectors.


----------



## nitrousnrg (Feb 25, 2016)

What does it mean hvil?

I guess you will need to see the gate driver board to figure out what is each signal.
When you do, I think you will find the architecture very similar to what they depicted in this tesla patent:
https://www.google.com/patents/US20160157374
Ugh, the images seem broken right now. I can find a copy if you want. The power stage would be a stackup of copper laminates with a pcb on top with the gate drivers.

I bet its something of the likes of this particular post of this particular thread of mine. Blue are dc link caps, with to247's attached to liquid cooled heatsinks.

https://endless-sphere.com/forums/viewtopic.php?f=30&t=84930&start=25#p1250639
I'd expect a single large pcb instead of 3.

You should be able to make this motor spin with your current board, I mean, just making a adaptor harness.. Um, are we sure its ACIM and its not a BLDC? They switched to BLDC in the model 3...


----------



## jackbauer (Jan 12, 2008)

It's an ACIM :

https://www.youtube.com/watch?v=CT8Z3bGMYDA


----------



## kennybobby (Aug 10, 2012)

nitrousnrg said:


> They switched to BLDC in the model 3...


Where did you get this information--and wonder why they did this if true? 

Maybe regen will be easier but there will be no coasting in Neutral.

OT:
Nice video JB, thanks for sharing your progress.


----------



## nitrousnrg (Feb 25, 2016)

kennybobby said:


> Where did you get this information--and wonder why they did this if true?.


EPA:
https://electrek.files.wordpress.com/2017/08/screen-shot-2017-08-07-at-11-00-27-am.png?w=929&h=312


----------



## dcb (Dec 5, 2009)

well, it also says "hybrid"...

edit: and most hybrids are part reluctance motor as well, not just pm... not really PMAC, technically speaking.


----------



## nitrousnrg (Feb 25, 2016)

Sure, it could be wrong


----------



## jackbauer (Jan 12, 2008)

Ok , this 20 pin connector on the Front drive unit has me driven crazy. Best guess so far is it is part of the Molex MX150 range but I'm at a loss to find it. Seems to be in 3 parts : Housing , pin header and retainer clip. Any ideas?


----------



## jackbauer (Jan 12, 2008)

V2 files for the Large drive unit board released.


https://github.com/damienmaguire/Tesla-Drive-Unit



Untested , for educational use only. If you blow up your house , cat or car with this design I accept no responsibility. Major upgrades over the V1 :
Three stage active filter to recover current sensor analog values from Sigma Delta encoding (Thanks Tony!).
Variable frequency clock generator for Sigma Delta converters.
Buffer on IGBT drive lines.
All temp sensors read via a dual 4:1 multiplexer.
Cruise control input.
Jumper selectable CAN or RS232 communication.


----------



## electro wrks (Mar 5, 2012)

dcb said:


> well, it also says "hybrid"...
> 
> edit: and most hybrids are part reluctance motor as well, not just pm... not really PMAC, technically speaking.


Maybe it's this design: https://sme-group.com/synchronous-reluctance-motor/

Looks like Net Gain is marketing these in the US. http://www.go-ev.com/20170808_files/PR20170808.html


----------



## brian_ (Feb 7, 2017)

nitrousnrg said:


> They switched to BLDC in the model 3...





nitrousnrg said:


> EPA:
> https://electrek.files.wordpress.com/2017/08/screen-shot-2017-08-07-at-11-00-27-am.png?w=929&h=312


The only information about the motor in that document fragment is:


> Motor/Generator Type 1: AC 3-PHASE PERMENENT MAGNET
> Rated Motor/Generator Power: 192


Whatever people want to call a "brushless DC" (or BLDC) motor, it is normally distinct from a 3-phase synchronous PM motor. This is certainly a change from the induction motors of the Model S (and presumably Model X). For this model, Tesla has gone to the same motor type as used by all other major EV and hybrid manufacturers.

As the Electrek article (presumably the source of the image) says,


> Other interesting information from the filing includes the confirmation that Model 3 is using a 3 phase permanent magnet electric motors, which is a departure from Model S and Model X’s induction motor.


There are no units provided for any values; presumably there are standard units for each field of this form. It appears to be 192 kilowatts; that would match with both published articles that I've read (Electrek and Engadget) listing the motor at 258 horsepower. Although irrelevant to the current topic of a Telsa induction motor controller, I think it's interesting that when Model 3's start hitting the salvage yards, they will be a source of the highest-power PMAC motor available as salvage yet in any significant number.

Note the typo in what should be "permanent".



dcb said:


> well, it also says "hybrid"...
> 
> edit: and most hybrids are part reluctance motor as well, not just pm... not really PMAC, technically speaking.


This EPA form is simply for hybrid vehicles, not just battery-electric or "pure" EVs. I don't see anything on this form suggesting that the motor is in any way a hybrid design. It's just a normal 3-phase synchronous motor, at least primarily using permanent magnets in the rotor.


----------



## dcb (Dec 5, 2009)

yah I don't want to pollute this thread with too much speculation though, damien is on to some real cool, real world stuff here!


----------



## Kevin Sharpe (Jul 4, 2011)

jackbauer said:


> Best guess so far is it is part of the Molex MX150 range but I'm at a loss to find it. Seems to be in 3 parts : Housing , pin header and retainer clip. Any ideas?


As I'm sure you're aware Tesla list the mating connector for the 'small' motors as Molex 33472-2002 (see here) and Mouser list the "Associated Product" as Molex 75757-1401 (see here).

I note from the 75757-1401 data sheet that it has a pin length of 11.20mm but other lengths are also available (see here). Can you measure the pin length of the header to confirm whether it's a 11.20mm part?

I've been unable to find the housing and retaining clip and have asked Molex for a part number. If the parts are only supplied to Tesla then my suggestion is to reuse the two parts from the inverter boards that are being replaced. Looking at your photo's I guess the end user could do this for themselves easily


----------



## jackbauer (Jan 12, 2008)

That's excellent info. Pin length measure at 16.3mm.


----------



## Kevin Sharpe (Jul 4, 2011)

jackbauer said:


> That's excellent info. Pin length measure at 16.3mm.


Molex 75757-5101 (here) should work and is readily available from Mouser without MOQ (here)


----------



## jackbauer (Jan 12, 2008)

Well done Kevin. The shroud and mounting clip can just be transferred from the original Tesla board.


----------



## jackbauer (Jan 12, 2008)

Folks , I have about 4 or 5 bare boards from the V1 logic board for the large drive unit left over. If anyone is interested you can have one for postage cost. Might be useful for experiments.


----------



## jackbauer (Jan 12, 2008)

https://www.youtube.com/watch?v=cYwwDls5yaw


----------



## nitrousnrg (Feb 25, 2016)

Lets hope its plug and play this time.

I don't know if the firmware supports bootloading for firmware updates, but in case it doesn't, adding a simple switch or jumper to BOOT0 would allow a future user to be able to update the firmware without a jtag/swd programmer.
These microcontrollers come with a bootloader stored in ROM, if during power on pin BOOT0=3.3v the bootloader will start listening on several UARTs, that way the user can update the firmware with simpler tools.

Its adding bootloading capabilities with only 1 smd button.

My button SW1 is located next to the 5 pin swd connector
https://raw.githubusercontent.com/paltatech/VESC-controller/master/doc/images/pinout_drawing.png
Its a feature I rarely use as a developer, but its nice from a user perspective.

Also note in the image how I try to connect my decoupling caps to the inner layers with at least 2 vias and forcing the current go through the cap before reaching the power planes
Something like this
http://www.atmel.com/images/Atmel-1619-EMC-Design-Considerations_ApplicationNote_AVR040.pdf (page 12)
resumed to this
https://i.stack.imgur.com/rRCDN.png

Its not that it will explode if you don't follow EMC guidelines, and I understand the rush to get it done, its just that it looks better to the trained eyes, and your ADC readings will become noticeably more accurate


----------



## jackbauer (Jan 12, 2008)

Thanks nitrousnrg. Good advice. Once I get it running the motor in a stable fashion I'll do a housekeeping run around the board.

Software updates and parameter changes are done over serial and soon CAN bus so JTAG is only used once for the first program. In a production environment this could be done at board test stage.


----------



## jackbauer (Jan 12, 2008)

Good progress on the front drive unit today. Got the igbts firing Video later in the week.


----------



## jackbauer (Jan 12, 2008)

Got a tip on youtube last night about this :

http://www.mouser.ie/ProductDetail/...I9neUTtPr78B30zSMGbeqDNoHiThotWndphcgKwKlyg==

http://www.st.com/content/ccc/resou...tent/translations/en.STM32L4_System_DFSDM.pdf

Seems ST have a range of mcus with built in Sigma Delta hardware. Could be a good upgrade over the analog filter option in the future.


----------



## nitrousnrg (Feb 25, 2016)

Beware when you ask the firmware guy to migrate from the simpler stm32f1 family to the more advanced f4. The guy may throw a brick at you.

My controller uses an f407, and I don't dare to ask for an upgrade to the f412. In my case it seems easier to add an fpga.

Thanks for the pic!


----------



## jhuebner (Apr 30, 2010)

The firmware guy just hopes that the analog filter will work 

If libopencm3 supports the F4 family it might not even be that hard, but I'd prefer not to have to do it.


----------



## nitrousnrg (Feb 25, 2016)

jhuebner said:


> If libopencm3 supports the F4 family it might not even be that hard, but I'd prefer not to have to do it.


The arm core and compiling will work right away, I've been using it for a long time. The thing you are not going to like are the changes in the peripheral and libraries, for example the clock architecture and pwm peripherals. In a more advanced stm32 with the ultimate pwm peripheral and GHz timers it took me 10 straight hours to change a silly pwm waveform because of the sheer amount of config structures to define a waveform.

So yeah, fingers crossed for the analog filter


----------



## jackbauer (Jan 12, 2008)

So here is a first look at a pinout for the interconnect header from logic to driver board in the front drive unit. power , grounds pwm , temp sensors and dc bus measurement worked out. Struggling a little with the igbt fault lines. Video soon.


----------



## jackbauer (Jan 12, 2008)

Although not strictly related to the circuit designs , In this video I discuss plans to put the front drive unit to good use 
https://www.youtube.com/watch?v=WtWWxgCOaTQ


----------



## foxr (Apr 16, 2015)

Hello Jack and everyone. I'm HIGHLY interested in putting a tesla drive unit into a different car however here is the situation.
I have a 140 I.Q. but severe ADHD and no electric motor/control understanding, plenty of mechanical(cars) understanding and have built my own racecar several years ago. Where can I start to invest all of my unemployment time and eventually turn this into a working car? I mean I thought it was simple at first, I just need to build some battery boxes, get a controller, weld in some mounts, source the used parts from a crash and be done but when I read this post for example...I don't understand what you are even talking about like analog filter, I feel like an idiot! I currently own a Spark EV, but putting a electric drive into my tired BMW z4(e85) 150k miles, would be the goal.


----------



## jackbauer (Jan 12, 2008)

At the end of the day , you don't need to know how the circuit works to run the motor and put it in your car. I hope to have it down to a straight swap for the original Tesla logic board.

V2 bare pcbs arrived today


----------



## jackbauer (Jan 12, 2008)

First run of the IGBT drivers in the front drive unit inverter :
https://www.youtube.com/watch?v=kE0FdpRqxNg


----------



## jackbauer (Jan 12, 2008)

V2 bare boards for the Large rear drive unit have arrived. Now just got to go build one. For anyone interested in tagging along I'm going to put up a sale in the classifieds section for the spare bare pcbs.


----------



## jackbauer (Jan 12, 2008)

Good news , bad news time on the V2 build. Good news is the LTC1799 is up and running and making a nice clock signal for the current sensors. Bad news is I managed to forget to order the 74LVC2G17GW buffer chips so no spinning motors this weekend ..........unless I just bridge it out and see if the current sensor can drive the filter directly ....hmmmm

...oh and I'm getting better at hand soldering the STM parts


----------



## foxr (Apr 16, 2015)

Looking good Jack!
So going with the "knowing nothing about the circuit"
How much money, roughly would it be to buy the necessary parts to run a tesla motor in my custom car?
Would you be able to sell me these parts with simple enough where to plug what?


----------



## jackbauer (Jan 12, 2008)

The grand plan is :

1)Design and test board on bench
2)Put drive unit in car and test
3)Sell boards
4)Retire somewhere sunny


----------



## foxr (Apr 16, 2015)

I'm in Orlando, you're welcome to come on over but not sure you wish to shake hands with Irma or Jose! lol


----------



## jackbauer (Jan 12, 2008)

Fairly major milestone achieved today. The V2 board for the Large drive unit pritty much works out of the box. I hand built one in order to run some tests and it's exceed my expectations.

The filter for the Sigma-Delta current sensors works perfectly even though I had to substitute a few resistor and cap values with what I had to hand. Overcurrent detection and shutdown working perfectly with the output from the filter. 

I'm only clocking the sensors at 4.6MHz so plenty more accuracy available if required. Just change one 0805 resistor value.

Desat and UVLO signals from the Tesla IGBT drivers working bang on and no false triggering.

RS232 working with no drop outs even when running high voltage and current.

Super smooth take off with the A-B encoder usage.

Ran today at low voltage and high voltage (365v) with no problems. Video on the way


----------



## nitrousnrg (Feb 25, 2016)

Cool.
Hoy much phase current can you draw on the bench? The inverter is pretty insensitive to the bus voltage, what pushes the limits is the current. At 1000+ Amps you will see the strongest EMI, and you will need to use the original deadtime to keep switching losses at a manageable level. Soon enough you will need a complete model S to finish testing


----------



## jackbauer (Jan 12, 2008)

Here is the video :
https://www.youtube.com/watch?v=swmaLyUEmO4

I got around 140A per phase today with light testing. Need to get this thing in the Panzer


----------



## jhuebner (Apr 30, 2010)

Nice  And I'm glad we don't need a new processor.


----------



## foxr (Apr 16, 2015)

So who all here is putting or already has a tesla drivetrain in another car? What car is it? Trying to get ideas for my future project as I'm currently unemployed!


----------



## Kevin Sharpe (Jul 4, 2011)

foxr said:


> So who all here is putting or already has a tesla drivetrain in another car? What car is it?


I'm using the 'small' rear Tesla motor in my 1967 VW split;

http://www.diyelectriccar.com/forums/showpost.php?p=887289&postcount=44

I'm aware of three 'motorsport' projects in the UK who are planning to use the 'large' rear Tesla motor


----------



## brian_ (Feb 7, 2017)

foxr said:


> So who all here is putting or already has a tesla drivetrain in another car? What car is it?


It's not mine, but I noticed these (in addition to Kevin's van):
2014 Lotus Evora - Tesla DU, Time Attack Road Car
Tesla Powered Cobra Race Car


----------



## jackbauer (Jan 12, 2008)

Just need to work out the temperature sensor calibration and we should be good to go for in car testing.


----------



## jackbauer (Jan 12, 2008)

Little bit of eye candy. V2 board fitted to the inverter. The 74LVC2G17GW buffers arrived today and fitted perfectly. Tiny chip but does square up the Sigma Delta signal quite nicely.


----------



## riba2233 (Apr 29, 2015)

This is awesome!


----------



## foxr (Apr 16, 2015)

So this thing plugs right into the tesla inverter?! Wow that is awesome.


----------



## jackbauer (Jan 12, 2008)

Yes it replaces the oem Tesla logic board and enables full control of the inverter. Fully open source project funded by myself and donations.


----------



## jackbauer (Jan 12, 2008)

Latest findings on the interconnector between the logic and igbt drive board in the front drive unit inverter. Only unknowns left are the dc bus discharge control and igbt fault signals. I think the +5v signals (3) mixed in with the drive signals are the faults. More testing this weekend and hopefully start laying out the pcb outline.


----------



## Kevin Sharpe (Jul 4, 2011)

I discussed putting one of the 'large' Tesla motors and Damien's open source controller in this yesterday


----------



## foxr (Apr 16, 2015)

I really want to put one in my bmw z4 cause those tesla spyders cost way too much!


----------



## Tomdb (Jan 28, 2013)

An R8 would be the perfect platform to package:

Small front motor
large rear motor
Plenty of batteries

Damien, did you investigate what it would cost to get a batch of boards professionally assembled?


----------



## jackbauer (Jan 12, 2008)

No price on builds as yet but will be doing so shortly. Nothing very expensive on the board. The costly bit will be developing a board test box to verify all the functions if I do decide to sell them.


----------



## jackbauer (Jan 12, 2008)

Hit another good milestone today. Got the inverter back on the rear drive unit and did a few runs. Not until I was editing the video did I realise I was running the motor in reverse

https://youtu.be/3ch3A4J3nIY


----------



## kennybobby (Aug 10, 2012)

Good thing you found it now and not when "backing" it out the garage for the first time...


----------



## Tomdb (Jan 28, 2013)

Is it in Johannes software as easy as change a bit right?


----------



## jackbauer (Jan 12, 2008)

Tomdb said:


> Is it in Johannes software as easy as change a bit right?


Do you mean the direction? Yes just pull one line or the other high.


----------



## Tomdb (Jan 28, 2013)

Is there not a different speed or throttle in reverse?
Thats why there would need to be a bit that can switch direction for example.

In another DIY controller im working with you can easily switch the direction which is considered "forward", because it has the possibility to limit reverse.


----------



## jhuebner (Apr 30, 2010)

No reverse speed limit is implemented yet. But yes it would be trivial to add a parameter that reverses direction.


----------



## jackbauer (Jan 12, 2008)

jhuebner said:


> No reverse speed limit is implemented yet. But yes it would be trivial to add a parameter that reverses direction.


Might be an idea to do that as Reverse is now Forward


----------



## jackbauer (Jan 12, 2008)

I know this is probably a super long shot but does anyone have any information on the temperature sensors used in the large rear tesla drive unit? I have measured room temperature resistance and observed the resistance drops with increasing temperature but that's it. My plan is to start running coolant through the motor / inverter and plot a few points of resistance versus temperature. Any help much appreciated


----------



## jackbauer (Jan 12, 2008)

Quick update :
https://www.youtube.com/watch?v=ZvwzuQksKo8


----------



## jackbauer (Jan 12, 2008)

Started getting to grips with the front drive unit board today for a few hours. Current sensors are plain vanilla analog and output +/- 2mV/Amp and sit on 2.5v at zero current. Was a tour de force to get the pcb off. Had to use the hot air station to melt the solder on the current sensors. Anyway , got it without damaging the sensors and started getting the pcb outline and locations in progress.

I'm getting together quite a collection of "scrap" Tesla logic boards


----------



## nitrousnrg (Feb 25, 2016)

Nice.

Can the board outlines of the logic boards get exported to dxf so it can be imported into any CAD? Maybe with a gerber file the outline can be re-drawn again.


----------



## jackbauer (Jan 12, 2008)

Yep I'll do a dxf as soon as I get everything lined up and confirmed.


----------



## jhuebner (Apr 30, 2010)

How could the removal be made more plug&play?


----------



## Kevin Sharpe (Jul 4, 2011)

jackbauer said:


> Was a tour de force to get the pcb off. Had to use the hot air station to melt the solder on the current sensors. Anyway , got it without damaging the sensors


In future do you think it might be possible to send you the whole assembly for upgrading to the new open source PCB? I can imagine many end users would rather buy a tested assembly than attack their drive with a soldering iron


----------



## jackbauer (Jan 12, 2008)

Yes would be possible or bring the board to an electronics repair shop who would have the kit to remove it safely.Testing these boards is another story. A test jig that simulates the I/O would be required.


----------



## jackbauer (Jan 12, 2008)

Struggling to find a source for the 2 way jst connector for temp and hvil on the front drive unit : S02BA-AIT2-1AK. Non stocked at mouser. Any ideas? Hvil can be deleted but would need to connect the temp sensor for the case. I suppose worst case can cut it off and use a standard 2 pin molex but would be nice to have the right connector.


----------



## onegreenev (May 18, 2012)

jackbauer said:


> Struggling to find a source for the 2 way jst connector for temp and hvil on the front drive unit : S02BA-AIT2-1AK. Non stocked at mouser. Any ideas? Hvil can be deleted but would need to connect the temp sensor for the case. I suppose worst case can cut it off and use a standard 2 pin molex but would be nice to have the right connector.


My board arrived today. Dang, that was quick. Now to get the parts on. This will be an interesting test of my skills.


----------



## jhuebner (Apr 30, 2010)

jackbauer said:


> Yes would be possible or bring the board to an electronics repair shop who would have the kit to remove it safely.Testing these boards is another story. A test jig that simulates the I/O would be required.


If it's mostly 5V IO 1 or 2 Analog Discoveries could be scripted to do the job.


----------



## bones (Dec 29, 2008)

I am so excited to have discovered this thread and the work you guys are doing. I have an EV I converted 6 years ago and still drive everyday and I love. However, the car was old when I converted it, now it is 6 years older. EV technology has progressed considerably and the cost of quality parts continues to come down. I am considering doing another conversion, and I thought about using Tesla parts. The work EVTV, Michael Elias, and Jason Hughes are doing shows that these parts can be re-used. The work Damian is doing here, with the help of all you others on the thread, will really make the re-use of Tesla drive units accessible to many more people.

Damian, I have been following your youtube channel off and on for years and I only discovered you started this Tesla related work last week. It took some time but I got through all your Tesla related videos and this entire thread. 

I wanted to leave this note of encouragement to everyone involved and I look forward to purchasing my own controller board for the Tesla drive units soon. 

One question I have about re-using the drive units is about traction control. EVTV has the Quaife ATB in the rear units, but nothing available for the front drive units. Is this ATB a performance device or is it really required for safety? I don't plan on building a race car but I do want a safe car.

Keep it up guys - looks great. 

Michel Bondy


----------



## jackbauer (Jan 12, 2008)

Good point. Also a thought on the current sensors : While it would be nice to reuse the Tesla sensors , I could just add a bit on to the pcb and fit a pair of LEM HTFS800p direct board mount. The the end user can just cut off the Tesla sensors , unscrew the tesla board and fit the open source board complete with lem sensors in its place.


----------



## Kevin Sharpe (Jul 4, 2011)

jackbauer said:


> The the end user can just cut off the Tesla sensors , unscrew the tesla board and fit the open source board complete with lem sensors in its place.


I really like this idea


----------



## Kevin Sharpe (Jul 4, 2011)

We purchased our second 'small' rear motor today for another VW project... 3,975 Euro's including driveshafts, power cables, and delivery


----------



## jackbauer (Jan 12, 2008)

On the subject of small motors , I got the pcb footprint sorted today. I've uploaded a dxf over on github for anyone interested. Schematic in progress.


----------



## Tomdb (Jan 28, 2013)

This might have been answered but:

Anyone have a pictures of the inside of a small rear motor vs a front drive unit?
Would it be possible to have a board that would fit both?

I would suspect the front drive unit to contain less inputs than the rear, however it has no need for any different power stage so there might be a chance


----------



## Kevin Sharpe (Jul 4, 2011)

Tomdb said:


> Would it be possible to have a board that would fit both?


Both 'small' motors use the same inverter casting (1035198-00-E) and therefore I think we can assume a single PCB will fit both. I'll verify this in a couple of weeks once the dxf is complete 



Tomdb said:


> I would suspect the front drive unit to contain less inputs than the rear, however it has no need for any different power stage so there might be a chance


You are correct the front motor uses CAN for control and has fewer I/O signals... the connector is the same on both drives however. See here for more;

http://www.diyelectriccar.com/forums/showpost.php?p=894529&postcount=143


----------



## Tomdb (Jan 28, 2013)

Why dont you pop the cover on one of your motors and use Damian's PCB outline printed one to one.

Or even just take a picture to check it there are no anomalies.


----------



## Kevin Sharpe (Jul 4, 2011)

Tomdb said:


> Why dont you pop the cover on one of your motors and use Damian's PCB outline printed one to one.


I will... in two weeks when I expect to have the free time... one of the issues of owning a water mill is the river comes first


----------



## jackbauer (Jan 12, 2008)

So working on the front drive unit logic board. Right now , I have most of the functions of the 24 way interface connector from the logic to the driver board worked out but there are a few I'm not sure about. Have a look at the attached pinout and tell me what I'm missing


----------



## Tony Bogs (Apr 12, 2014)

jackbauer said:


> I'm only clocking the sensors at 4.6MHz so plenty more accuracy available if required.


That requires digital. Analog doesn't work that way. Love to see your implementation. 
Are you going to use the new STM controller? No libopencm3 support so far when I looked.


----------



## jackbauer (Jan 12, 2008)

Alexa , auto place my components please


----------



## jackbauer (Jan 12, 2008)

Very tight on board space with this one


----------



## jackbauer (Jan 12, 2008)

Soooo.....when do I get a Model X drive unit ?


----------



## Tomdb (Jan 28, 2013)

Do you believe there are any differences?

I would think the models and X share batteries and drivetrains, plus all other HV components.


----------



## jackbauer (Jan 12, 2008)

Tomdb said:


> Do you believe there are any differences?
> 
> I would think the models and X share batteries and drivetrains, plus all other HV components.


Ah crap....ok, so when do I get a model 3 drive unit?


----------



## Tomdb (Jan 28, 2013)

So fat the rumors are that a model 3 uses a BLDC motor instead of induction.

So the use of the Huebner kit will be harder.


----------



## Tony Bogs (Apr 12, 2014)

There are going to be a lot more of those drive units available from recycle yards.
And 250kW BLDC (or was it hp) doesn't sound bad at all. I think I'll wait a little bit longer.
Probably also cheaper. Almost €4000 for a used drivetrain. No way I'm going to pay that much.
If someone decides to give it to me for free as a way of saying "thank you", then I might reconsider. 

No, just kidding. Waiting for model III.


----------



## Kevin Sharpe (Jul 4, 2011)

Tony Bogs said:


> Almost €4000 for a used drivetrain. No way I'm going to pay that much


While I appreciate you don't want to pay that much it's actually a bargain when you consider that a HPEVS solution is a similar price for just the motor, still needs a transmission/clutch/driveshafts (more $$$), and delivers less than half the power 

I agree that in the long term the Model 3 motor will be cheaper but I don't want to wait another 2+ years. I also predict that the current Tesla motors will drop in price, I'm currently working on a group buy discount scheme using several European car breakers


----------



## brian_ (Feb 7, 2017)

Kevin Sharpe said:


> I agree that in the long term the Model 3 motor will be cheaper but I don't want to wait another 2+ years.


I assume that the Model 3 motor will also require at least a major revision - or perhaps a complete fresh start - on this DIY controller work. The Model 3 uses a PM AC motor, so even if they use the same physical inverter package, the sensors will be different, and the software will be at least somewhat different.


----------



## brian_ (Feb 7, 2017)

Tomdb said:


> So fat the rumors are that a model 3 uses a BLDC motor instead of induction.


Permanent magnet AC synchronous - of course it's brushless, but there's nothing "DC" about this motor.



Tony Bogs said:


> ...
> And 250kW BLDC (or was it hp)...


The documents filed with the EPA say 258 hp, or 192 kW, but Tesla doesn't seem to endorse that value. It must be roughly correct.

Tesla Motors has been selling this thing for a long time, is happy to take your deposit, and claims to have actually produced some a couple months ago (although they haven't delivered them to real customers), but publishes only minimal specifications - no power is listed.

So for now, the real Tesla motors that people can work with are still only the induction motors for the Model S and Model X. And, I suppose, if you want to work with something for which there is no reasonable supply, you can try a Tesla Roadster or a Mercedes B-Class.


----------



## Tony Bogs (Apr 12, 2014)

Kevin Sharpe said:


> I'm currently working on a group buy discount scheme using several European car breakers


Well, then I certainly have to wait for the increase in numbers. And who knows, maybe Tesla does go belly up when vertical integration and a lot of thumb sized cells prove to be bad ideas for the mass market in the end. 
Then the prices really drop. 

And BTW, the transition is going to continue anyway.
There is no real need to go DIY anymore.


----------



## Kevin Sharpe (Jul 4, 2011)

Tony Bogs said:


> There is no real need to go DIY anymore.


I don't think it was ever about 'need'... I think it is all about 'desire'... probably why I'm aware of 7 conversions that are planning to use the Tesla drivetrain and open source controller


----------



## Kevin Sharpe (Jul 4, 2011)

brian_ said:


> I suppose, if you want to work with something for which there is no reasonable supply, you can try a Tesla Roadster or a Mercedes B-Class.


The Mercedes B-Class uses the same drivetrain as the Tesla Model S/X and several people have rescued them from wrecks. You get some good views of the drivetrain in this video from 5:15 onwards


----------



## CKidder (Dec 12, 2009)

brian_ said:


> I assume that the Model 3 motor will also require at least a major revision - or perhaps a complete fresh start - on this DIY controller work. The Model 3 uses a PM AC motor, so even if they use the same physical inverter package, the sensors will be different, and the software will be at least somewhat different.


Yes, for PMAC/BLDC you'd have a resolver instead of the low count encoder that the induction motor uses. That requires either a resolver to encoder module or a resolver chip on the controller board. The software is a bit different but that's not a huge deal. Plenty of codes exists to interface with PMAC motors. They're actually easier to run than induction motors when you are using FOC code. Induction motors require complicated position estimation and compensation whereas for a PMAC motor you just grab the motor position from the resolver and use that directly. 

I'm not Damien (obviously) but I'd think he could pretty easily drop a resolver chip onto the current design and pretty much be ready to go if the Model 3 uses a board size roughly similar to the Model S board. I don't know if the STM32 chip has any direct support for resolvers or not. I assume it would since it is meant for motor control. One can always use a resolver to encoder chip and then maybe there won't be any changes on the control board itself - just a change in the number of pulses per revolution as you need pretty fine feedback with resolvers and PMAC motors.

At any rate, I haven't said it yet so - Thank you Damien for your work on this project! This is neat stuff.


----------



## jackbauer (Jan 12, 2008)

Thanks Colin  I'm really enjoying it. So I completed the layout of the small front motor logic board today. Going to wait a week or so before ordering boards as it's not a question of if I have made mistakes just how many Not sure if the logic boards are the same in the small front and rear motors as yet.

Regards the PM motors , I did a lot of testing and work last year using a Lexus hybrid gearbox and an AD2S1210 resolver to digital converter.
https://www.youtube.com/watch?v=Bd1OEhbOZNE

The current firmware accepts ABZ and DIR signals from this chip so in theory could run the model 3 motor. I hope to get my hands on a BMW I3 drive unit soon so if that is PM then we'll find out!

Schematics and some support files are up on the github. I won't release the pcb files until I at least make sure I'm not shorting out the 12v supply


----------



## jhuebner (Apr 30, 2010)

CKidder said:


> Yes, for PMAC/BLDC you'd have a resolver instead of the low count encoder that the induction motor uses. That requires either a resolver to encoder module or a resolver chip on the controller board. The software is a bit different but that's not a huge deal. Plenty of codes exists to interface with PMAC motors. They're actually easier to run than induction motors when you are using FOC code.


The STM32F103 doesn't have a resolver interface on board, so we'd have to use a converter chip. Good news is that the very pins that accept the ABZ encoder signal can also be mapped to the SPI peripheral. And that allows us to get the current position directly without waiting for the index (Z) pulse.

Even when not using FOC code running PMAC motors is pretty straight forward like you say. After all we are just looking at an induction motor without slip and an absolute rotor field position.

There's so much space left on that board, why don't you include a little Linux computer that will do some random things  No just kidding. Impressed again by your work.


----------



## jackbauer (Jan 12, 2008)

jhuebner said:


> There's so much space left on that board, why don't you include a little Linux computer that will do some random things


I could add some flashing lights :
https://www.youtube.com/watch?v=M1WemnsB98o

On a more serious note I received a late night communication from an anonymous source with information on the temperature / resistance curves of the large drive unit temp sensors


----------



## Kevin Sharpe (Jul 4, 2011)

jackbauer said:


> I could add some flashing lights


Do you have any spare pins on the external logic connector? If you do what about some buffered I/O that we can program in future? For example, one useful feature on GEVCU is the brake light signal which turns on during regen. Another suggestion is signals we can program to control 'analog' instruments, rev counter, speedo, etc.

I appreciate we can control all this functionality via CAN. However, for a simple vehicle conversion (like the VW's that are being converted) it might be useful to have the option of doing this old school 

One final comment, can you include a pdf copy of the schematic when you make a release to GitHub? I don't have my schematic editor on this computer and couldn't check the I/O for myself... my fault not yours


----------



## jackbauer (Jan 12, 2008)

So the inverter is setup in such a way that you don't need any serial or can connections for it to work. Just a few basic signals. On the github for the large drive unit is a file called AMPSEAL_PINOUT_NEW_V2.ods
This has the pin assignments. I'll upload pdf versions of the schematics over the weekend.


----------



## jhuebner (Apr 30, 2010)

If you consider another redesign you could route some more signals (like said brake light signal or PWM) over the ULN2003 and bring them out on some generic connector.


----------



## jackbauer (Jan 12, 2008)

Checks are going well on the small du logic board. Found a few silly mistakes. Plan to release this weekend and order a batch of boards


----------



## jackbauer (Jan 12, 2008)

Things got a bit exciting today. It seems you really can pump 5kw into a 3kw electric cooker element as long as it is properly heatsinked. I used a Tesla large drive unit to "dissipate" the heat and got some nice readings on the temperature vs resistance values for the heatsink and motor case sensors. Spreadsheet is up on the github :
https://github.com/damienmaguire/Tesla-Drive-Unit

Can someone plot me some nice graphs? 

Video on the way of course.


----------



## kennybobby (Aug 10, 2012)

And you didn't melt a hole in the plastic bucket...?


----------



## jackbauer (Jan 12, 2008)

kennybobby said:


> And you didn't melt a hole in the plastic bucket...?


Strangely no.

The video : https://www.youtube.com/watch?v=7yZPLS5YbSg


----------



## jackbauer (Jan 12, 2008)

So when using the ABZ encoder mode , the encoder channels must be in phase with the motor direction. When I put the large drive unit back together I had to swap the encoder channels in the ampseal plug. No big deal as it is external. Now , in the small drive units this can't be done so i have added a 6 way pin header on the V1 pcb to allow the encoder channels to be swapped until we get the phasing right. It can be deleted on a future revs of the board. Schematics updated on github.


----------



## jackbauer (Jan 12, 2008)

After yesterday's mad session of warming the inverter I'm pleased to announce that we have working temperature sensors in the large drive unit. Big big thanks to Johannes for coding them into a custom firmware build. None of this would be possible without his help and support.


----------



## CKidder (Dec 12, 2009)

jackbauer said:


> After yesterday's mad session of warming the inverter I'm pleased to announce that we have working temperature sensors in the large drive unit. Big big thanks to Johannes for coding them into a custom firmware build. None of this would be possible without his help and support.


Just how custom has the firmware been so far? What I suppose I'm asking is: if I downloaded the tumanako source and compiled it myself would it operate on these boards or not?


----------



## jackbauer (Jan 12, 2008)

Colin , it will run but you will run into a problem with thermal limiting and the BMS pin. The inverter will cease pwm generation when heatsink temperature exceeds what it sees as 100C. You could spoof that with a resistor. The BMS input pin has been retasked as an output and used as one of the control lines to the mux. If left as an input it will flip / flop between high and low and drive you mad with regen and drive power limits (don't ask me how I know!). You can get around that by setting the low limit at 100%.

The updated binary is up on my github and Johannes may decide to release the source. That's his baby

Forgot to mention the reason for the discrepancy in the heatsink and motor temp values in the pic above is I should be using 147k series resistors on the heatsink sensors but only had 150k available today.


----------



## jhuebner (Apr 30, 2010)

CKidder said:


> Just how custom has the firmware been so far? What I suppose I'm asking is: if I downloaded the tumanako source and compiled it myself would it operate on these boards or not?


It's mildly custom, just changed the IO and temp sensor reading. I'd say 98% of code stays untouched. I haven't committed it yet since I'm still experimenting with single channel encoder mode which is what all kit customers are using.
Once committed compiling for Tesla is as easy as "HWCONFIG=HWCONFIG_TESLA make"



jackbauer said:


> So when using the ABZ encoder mode , the encoder channels must be in phase with the motor direction. When I put the large drive unit back together I had to swap the encoder channels in the ampseal plug.


Just observed that when I put my test rig back together and had obviously swapped a phase. Thinking of adding a phaseswap parameter.


----------



## jackbauer (Jan 12, 2008)

Design files for the small drive unit open source logic board version 1 now released on github : https://github.com/damienmaguire/Tesla-Front-Drive-Unit

PCB order going in today.


----------



## Tomdb (Jan 28, 2013)

You know it is vacation in china right  until the 8th

Or you not ordering boards from china?


----------



## jackbauer (Jan 12, 2008)

Tomdb said:


> You know it is vacation in china right  until the 8th
> 
> Or you not ordering boards from china?


Yeah bit of a pain but gives me a chance to work on the charger


----------



## EVElvis (Jun 20, 2009)

Any use? Cannot seem to attach the excel file tho.


----------



## jackbauer (Jan 12, 2008)

Great thanks


----------



## bones (Dec 29, 2008)

If you use a circuit like this:
Clipboard01.jpg

you can get a linear response (Vout vs temperature). For the heat sink:
Clipboard03.jpg

and for the case:
Clipboard04.jpg

This way the voltage can easily be converted into a temperature in deg C with these equations:
TempHeatSink = 24.192*VHeatSink - 5.4335
TempCase = 17.719*VCase + 1.1177

These equations assumes Vcc = 5V and R2=15k for the heat sink and Vcc=5V and R2=3k. The parameters in the previous equaitons were calculated from the best fit line through data Damian's tests provided.

I hope this helps.


----------



## jackbauer (Jan 12, 2008)

It's official. The small drive units both front and rear share the same logic board


----------



## jackbauer (Jan 12, 2008)

Looks like the small drive unit bare pcbs will be landing on thursday or friday. Busy weekend ahead


----------



## mbondy (Oct 17, 2017)

The resistance of the temperature sensors vs temperature is non-linear but when you put it in a circuit like this one, the voltage Vout is linear with temperature.









From the test data Damian provided I got the following graphs with the equation of best fit line super imposed. I hope this can be useful.

















Keep up the great work Damian and company!


----------



## jackbauer (Jan 12, 2008)

Special delivery


----------



## jackbauer (Jan 12, 2008)

Perfect fit  The small drive unit pcb lines up perfectly with the mounting holes , current sensors and power stage connector.


----------



## ECOENERGI1 (Oct 19, 2017)

oh that looks beautiful


----------



## aeroscott (Jan 5, 2008)

Thanks for all your tireless work. Love your new YouTube channel.
Would I be able possible to reprogram your board to use the Tesla inverter to be a welder,plasma cutter etc.
This would be a plugin to the ev for portable welding power. Would it be possible to run the inverter as a 60 cycle 3 phase ups. I remember someone saying ups run at a much higher switching speed then industrial or EV inverter's.


----------



## jackbauer (Jan 12, 2008)

I would say not as you would need some kind of inductance or transformer and some kind of feedback depending on the welding process you want to run.

So due to workload (open sourcing the entire Model S is a bit time consuming!) I'm going to get two small drive unit PCBs professionally built next week so watch this space

An observation : One of my sub hobbies is old 8 bit computers. Most of these used a CPU and a ULA (Uncommitted logic array). Every Tesla logic board I have seen so far has a microcontroller and a CPLD......


----------



## electro wrks (Mar 5, 2012)

aeroscott said:


> Thanks for all your tireless work. Love your new YouTube channel.
> Would I be able possible to reprogram your board to use the Tesla inverter to be a welder,plasma cutter etc.
> This would be a plugin to the ev for portable welding power. Would it be possible to run the inverter as a 60 cycle 3 phase ups. I remember someone saying ups run at a much higher switching speed then industrial or EV inverter's.



Typical welders put out 18-30V, constant voltage DC for MIG(wire welding). ~20-400V (except AC for aluminum TIG), constant current DC for stick, TIG, and plasma cutting(+ high frequency, high voltage, small current starting arcs). Except for the 400VDC OC(I forgot how high it was!) for the plasma cutter, nothing seems very close to the Tesla battery or inverter outputs. 

Good idea though. I thought I saw Tesla was going to include a single phase outputs on their upcoming work/commercial vehicle models. Great for job sites, power outages, natural disasters. Energy ports like these could be sized to run high power equipment like welders. High voltage battery input UPS's might be safely tied into the Tesla battery to serve the same purpose. Although, 250-280V UPS batteries are the highest I've seen. This is in a 4kW UPS.


----------



## jackbauer (Jan 12, 2008)

Getting to work building the "PCB test jig" 

Prototype small drive unit boards built and due tomorrow.


----------



## CKidder (Dec 12, 2009)

I must confess, I took your open source design and had some built. That's the power of open source! The new boards look nice and shiny - really nice work Damien! I have a Segger J-Link so I thought I'd go ahead and try that out. It can work but two points:

1. The 20 pin JTAG connector is upside down. The notch should be on the outside of the board, not toward the inside. I had to file off the tab from a 20 pin cable in order to connect it the proper direction. Connected as shown on the PCB causes it to read 0.0v and no comm will work at all.

2. It doesn't seem to support actual JTAG. I had to switch to SWD to make it work. I don't know why JTAG doesn't work - it appears all the proper pins are hooked up. I suppose I don't care as long as SWD works on the 20 pin connector and it sure seems to. Maybe the chip isn't configured by default to allow JTAG. I might look into this but SWD is perfectly acceptable so I don't know if I really care enough.

So, anyway, I'm going to get setup to help test things out. I'll let you know if I run into anything else. Luckily, these things are pretty minor and easy to work around.


----------



## aeroscott (Jan 5, 2008)

electro wrks said:


> Typical welders put out 18-30V, constant voltage DC for MIG(wire welding). ~20-400V (except AC for aluminum TIG), constant current DC for stick, TIG, and plasma cutting(+ high frequency, high voltage, small current starting arcs). Except for the 400VDC OC(I forgot how high it was!) for the plasma cutter, nothing seems very close to the Tesla battery or inverter outputs.
> 
> Good idea though. I thought I saw Tesla was going to include a single phase outputs on their upcoming work/commercial vehicle models. Great for job sites, power outages, natural disasters. Energy ports like these could be sized to run high power equipment like welders. High voltage battery input UPS's might be safely tied into the Tesla battery to serve the same purpose. Although, 250-280V UPS batteries are the highest I've seen. This is in a 4kW UPS.


The inverter out puts of autos start out at low voltage and low hz.as rpm is increased volts/hz. is too. So the auto unit goes threw the stick, tig (tig ac is the same voltage as tig DC)and mig voltage and ends up in the plasma area at high rpm(my plasma is 280 volts open circuit) .Higher voltage plasmas are better preforming but reserved automated cutting (safety).
Tig ac for aluminum is single phase which should not be a problem .The high frequency overlay might be a problem (which is used for arc stability)
The mig runs on constant voltage (programing) and the constant current 
of tig stick and plasma would be programing also.
I must be missing something in the inductance, capacitors, switching speed, etc.


----------



## jackbauer (Jan 12, 2008)

Thanks Colin. I didn't think anyone would be crazy enough to actually build one of my crazy designs 

Is it the large drive unit board you are using? I use the Olimex JTAG tool for initial programming : https://www.olimex.com/Products/ARM/JTAG/ARM-USB-OCD/
with a script Johannes wrote and it seems to work fine. That said I have never tried to actually use JTAG for debug just loading the initial program and bootloader.


----------



## CKidder (Dec 12, 2009)

jackbauer said:


> Thanks Colin. I didn't think anyone would be crazy enough to actually build one of my crazy designs
> 
> Is it the large drive unit board you are using? I use the Olimex JTAG tool for initial programming : https://www.olimex.com/Products/ARM/JTAG/ARM-USB-OCD/
> with a script Johannes wrote and it seems to work fine. That said I have never tried to actually use JTAG for debug just loading the initial program and bootloader.


Yeah, call me a crazy guy. I'm going to eventually get to trying it on a large drive unit too. I knew you used the olimex dongle but I had a J-Link so I wanted to try to use what I already have. I can compile the firmware myself now and I'm pretty sure I know how to flash it. It seems like issuing "flash write_image <ImageName> 0x8000000" to openocd will cause it to flash the firmware binary. But, it seems like there might be more to it than that. You mentioned a bootloader and I think I saw something about it in Johannes' stuff too but do I really need to flash two things?


----------



## jhuebner (Apr 30, 2010)

CKidder said:


> but do I really need to flash two things?


Yes, the first 4k in flash are reserved to the bootloader. It has to be there as it issues the jump to the actual firmware.

My flash command is slightly different:
flash write_image erase unlock stm32_loader.hex
flash write_image erase unlock stm32_sine.hex

So it uses the hex file as that has the target address already in it.
I use the same adapter as Damien.


----------



## CKidder (Dec 12, 2009)

jhuebner said:


> Yes, the first 4k in flash are reserved to the bootloader. It has to be there as it issues the jump to the actual firmware.
> 
> My flash command is slightly different:
> flash write_image erase unlock stm32_loader.hex
> ...


Ok, thank you. Yes, if you use .hex files then the file itself has the proper offset in there so you wouldn't have to specify it like I had to do. But, Damien has .bin files in the repo so I was trying to use that. In that case you don't have the offset already in there so I had to go look it up. I'll give it a try with the hex files.


----------



## aeroscott (Jan 5, 2008)

jackbauer said:


> Getting to work building the "PCB test jig"
> 
> Prototype small drive unit boards built and due tomorrow.


I hope to see some detail on the Tesla drive install . I was referring to the attachment video


----------



## jhuebner (Apr 30, 2010)

CKidder said:


> Ok, thank you. Yes, if you use .hex files then the file itself has the proper offset in there so you wouldn't have to specify it like I had to do. But, Damien has .bin files in the repo so I was trying to use that. In that case you don't have the offset already in there so I had to go look it up. I'll give it a try with the hex files.


Yes for the small drive unit you can use the HWCONFIG_REV2 hex file from the zip file.

The only Tesla special is the use of a multiplexer for that hoard of temp sensors in the rear drive unit

The bootloader is the same for all hardware variants.


----------



## jackbauer (Jan 12, 2008)

Sorry guys I should have had the HEX files up on Github. Will sort that asap. Got the prototypes of the small drive unit boards delivered today. They power up and program fine so onto the testing

I included a screenshot of the output from openocd if it helps Colin?


----------



## jackbauer (Jan 12, 2008)

So first tests looking good. Have established serial comms with the logic board, uploaded the latest firmware and loving the new interface. Thanks Johannes


----------



## jackbauer (Jan 12, 2008)

Front drive units spins for the first time today with the V1 logic board. Will be doing more testing over the next few days including closed loop and high voltage runs. This board will run both front and rear small motors.


----------



## jackbauer (Jan 12, 2008)

https://www.youtube.com/watch?v=GghZrW6enWM


----------



## jackbauer (Jan 12, 2008)

Front drive unit runs perfectly in closed loop mode. Good thing I fitted the encoder polarity jumpers as of course it was reversed


----------



## jhuebner (Apr 30, 2010)

Well I suppose the fancy new quadrature encoder support requires a software jumper


----------



## jackbauer (Jan 12, 2008)

Yes it does  Looks like Tesla use much the same type of temperature sensors in the small drive units so no need for my crazy hot water pumping scheme this time!


----------



## jackbauer (Jan 12, 2008)

https://www.youtube.com/watch?v=ch8xqi7CZU8


----------



## jhuebner (Apr 30, 2010)

I suppose no mux this time? Are you using the regular REV2 software then?
I can include the Tesla sensors in the respective enum.


----------



## jackbauer (Jan 12, 2008)

Yes it has the mux. 3 heatsink and 3 motor sensors. I'm using the Tesla rev but need to update the load resistors.


----------



## jhuebner (Apr 30, 2010)

I see. So exact same combination of sensors?


----------



## jackbauer (Jan 12, 2008)

I think one of the motor sensors is different. Will know soon once I get the resistors sorted.


----------



## jackbauer (Jan 12, 2008)

Well, I screwed up. Managed to wreck one of the current sensors on a small rear motor board during removal. Now we get to see if Elon will play nice with a few LEM versions


----------



## Tomdb (Jan 28, 2013)

Nothing a bit of silicone cant fix. 

Dont think Elon will care, just as long as you feed him enough amps.


----------



## jackbauer (Jan 12, 2008)

Put the front drive unit back together and gave it a full test at both low and high voltage today. Pleased to say it runs great Now on to car testing for this guy.

https://www.youtube.com/watch?v=2-aEDcVX4BE


----------



## jackbauer (Jan 12, 2008)

Small rear drive unit works perfectly with the front drive unit logic board


----------



## jackbauer (Jan 12, 2008)

Folks, has anyone came across a Tesla drive unit with a 14 pin ampseal connector as in the picture? A guy from China contacted me trying to get the unit up and running. Mine was a 20 pin so no idea what's going on here


----------



## pm_dawn (Sep 14, 2009)

I think that the unit that Eldis did his work on had 14 pin.
That came from a Mercedes B-class.
So maybe it's from there......

Regards
/Per


----------



## Kevin Sharpe (Jul 4, 2011)

pm_dawn said:


> I think that the unit that Eldis did his work on had 14 pin.
> That came from a Mercedes B-class.
> So maybe it's from there......


Correct... you can see it clearly on the following video at 6:47


----------



## jackbauer (Jan 12, 2008)

So one thing that most open source projects lack is good documentation. Recently I have been contacted by a few people who have raced miles ahead of me and built boards and put them in drive units and put them in cars and now want to drive! Such madness Anyway I have started a document to try and pull it all together. Very much a work in progress but have a look and let me know what you think :
https://github.com/damienmaguire/Tesla-Drive-Unit/blob/master/LDU_Qstart01.odt


----------



## Kevin Sharpe (Jul 4, 2011)

jackbauer said:


> I have started a document to try and pull it all together. Very much a work in progress but have a look and let me know what you think


That's exciting, thanks!

FYI, some problems opening the document... hopefully just temporary


----------



## jackbauer (Jan 12, 2008)

Probably needs to be downloaded and opened in an editor. Here is a pdf version :
https://github.com/damienmaguire/Tesla-Drive-Unit/blob/master/LDU_Qstart01.pdf


----------



## Kevin Sharpe (Jul 4, 2011)

jackbauer said:


> Here is a pdf version


That works... nice document


----------



## jackbauer (Jan 12, 2008)

Some experiments with single wire programming the SMT32 using STLink. Did get the led flashing on one occasion. Most times it loads fine but no led even though the core is running. I'm guessing I'm loading to the wrong start location address but don't know enough as yet.


----------



## jackbauer (Jan 12, 2008)

Success!!! I can now program the STM32 using a cheap STlink dongle and free windoze STlink software.
https://www.ebay.co.uk/itm/ST-Link-...067780?hash=item3d059b4884:g:TE0AAOSwAYtWGQqG

http://www.st.com/en/development-tools/st-link-v2.html

Install the software and connect the stlink dongle to the jtag header (this will work on both Tesla and olimex boards) with 4 leads. +3v3 , GND, SWCLK and SWDAT.

Click binary file and load stm32_loader.hex Program this with the "Skip Erase Flash" box unticked. Now load stm32_sine_HWCONFIGTESLA.hex with the "Skip Erase Flash" box ticked. The LED should start flashing after the program has finished loading and away you go


----------



## jackbauer (Jan 12, 2008)

Took a step closer today. No smoke or flames yet.
https://www.youtube.com/watch?v=YUNk_PIdp8E


----------



## itchyback (May 28, 2014)

I'm so jealous of the amount of time you have to work in this!!

Excuse me while i start scheming ways i can quit my job and and accelerate my childrens growth so theyre self sufficient and dont need me to feed, cloth, drive them...


----------



## jackbauer (Jan 12, 2008)

So one thing that has been bugging me lately has been the setup of the web interface by end users of the inverter. Either the Tesla variant or the standard product. It requires a good working knowledge of Linux which the vast majority of people don't have. I had thought about developing a cross platform standalone program but that is expensive, time consuming and still presents problems with OS versions, hardware, user ability etc.

One idea I had a while ago was to setup a Raspberry pi and use it as an access point to connect to the inverter from any device over wifi. Simply connect to the access point and type an ip address into a web browser and that's it. Platform neutral. Use it with Linux, Windoze, Mac,android, iphone, Commodore 64 etc. Hit a few problems and left it but having a chat with Johannes on Monday sort of brought it back into my mind. Even better, The Pi Zero W is now available, cheap and has built in wifi. So just add a RS232 converter for the Tesla boards or wire straight to the STM32 Uart on the standard inverter main board and done.

Got it running on a pi3 on the bench this morning. Can now access the inverter from phone and laptops. Next moves are to get it running on a pi Zero W and create an SD card image that anyone can just load up , connect the power and serial and interact with the inverter over wifi. Stay tuned


----------



## arber333 (Dec 13, 2010)

jackbauer said:


> So one thing that has been bugging me lately has been the setup of the web interface by end users of the inverter. Either the Tesla variant or the standard product. It requires a good working knowledge of Linux which the vast majority of people don't have. I had thought about developing a cross platform standalone program but that is expensive, time consuming and still presents problems with OS versions, hardware, user ability etc.
> 
> One idea I had a while ago was to setup a Raspberry pi and use it as an access point to connect to the inverter from any device over wifi. Simply connect to the access point and type an ip address into a web browser and that's it. Platform neutral. Use it with Linux, Windoze, Mac,android, iphone, Commodore 64 etc. Hit a few problems and left it but having a chat with Johannes on Monday sort of brought it back into my mind. Even better, The Pi Zero W is now available, cheap and has built in wifi. So just add a RS232 converter for the Tesla boards or wire straight to the STM32 Uart on the standard inverter main board and done.
> 
> Got it running on a pi3 on the bench this morning. Can now access the inverter from phone and laptops. Next moves are to get it running on a pi Zero W and create an SD card image that anyone can just load up , connect the power and serial and interact with the inverter over wifi. Stay tuned


Good idea! 
I also have RS232 BMS that transmitts cell values in real time.
And i use EMW charger that actually sends all its data to RS232 and in turn expects instruction through RS232 as well.

All this could be linked inside RaspPI and sent online (GPRS or LTE) to some SQL database. There one could have access to all information of the car.
Some tables could be edited and some just red...

I just dont have enough of me to learn programming and implement this. Maybe i should clone myself....

A


----------



## jackbauer (Jan 12, 2008)

Running on the Pi's onboard uart. Direct connection to the STM32 Uart. So this will work on the Tesla with an RS232 driver or directly on the standard inverter main board.


----------



## jackbauer (Jan 12, 2008)

And here is a video of controlling the car and plotting data over wifi from multiple devices : https://youtu.be/25HzGP2PnOE


----------



## jhuebner (Apr 30, 2010)

Awesome!
I guess we want to add some predefined, unique WPA2 key so not everyone can remote control your car


----------



## jackbauer (Jan 12, 2008)

Picked up some more prototype boards today


----------



## jackbauer (Jan 12, 2008)

Got the Pi Zero W. it's tiny! Pictured with an ftdi adapter for scale.


----------



## jackbauer (Jan 12, 2008)

Wireless access to the inverter up and running on a Pi Zero W  I'll be making the image file for the sd card available shortly.


----------



## jackbauer (Jan 12, 2008)

Gen 2 prototype ready for testing.


----------



## jackbauer (Jan 12, 2008)

So today was first roll in the Panzer. Went well with one problem so far. The ULN2003 driver is not able to cope with the closing surge on the Kilovac EV200 contactor. Reading up on the datasheet it seem the kilovac draws about a 4 amp surge. Even with 2 channels of the ULN paralleled it was way under speced. So first mod on the V3 board will be to use a serious driver for the main contactor. I think the NCV8401A will do the job nicely

In the mean time anyone using the current gen boards should use a relay to drive the main contactor. More testing on the way


----------



## jackbauer (Jan 12, 2008)

After the success of the first test drive I have been swamped with support questions. In order to help people I have done some large format wiring diagrams. These are just hand drawn for now but are being sent to an illustrator for professional drawing (I couldn't draw a gun). Also up on the github. Feedback welcome. I'm asking people with support questions to now please ask on this thread as it will benefit everyone.


----------



## Tomdb (Jan 28, 2013)

Please make sure the HV fuse is in front of the contactor and precharge relay, so on the battery side. 

Otherwise these are very helpful circuits.


----------



## jackbauer (Jan 12, 2008)

Thanks Tom


----------



## jackbauer (Jan 12, 2008)

Here is a nice big A3 poster size wiring diagram for the large drive unit. Perfect Christmas gift

https://github.com/damienmaguire/Tesla-Drive-Unit/blob/master/LDU_Wiring_diagram_A3.pdf


----------



## jackbauer (Jan 12, 2008)

For those out there struggling with the web interface for the inverter (myself included at times!) here is a simple solution. Get yourself a Raspberry Pi Zero W and pop this image on a 16gig micro SD card.
https://www.dropbox.com/s/nj4xrppf1lgmr4n/inverterpizw.img.gz?dl=0

Then connect the inverter to the Pi Serial port. If using the Tesla board you will need an RS232 driver like the one pictured. Very easy to get on ebay. If using the standard inverter logic boards from Johannes, just connect straight up as both the Pi and STM32 are 3.3v UART levels.

Once the Pi boots it creates a wireless access point called "Inverter". Connect to this with any device (phone,laptop,tablet,Commodore 64). Passphrase is "inverter123". Point a browser to 192.168.42.1 and the web interface should pop up.

Full tutorial and writeup on the way.


----------



## arber333 (Dec 13, 2010)

jackbauer said:


> For those out there struggling with the web interface for the inverter (myself included at times!) here is a simple solution. Get yourself a Raspberry Pi Zero W and pop this image on a 16gig micro SD card.
> https://www.dropbox.com/s/nj4xrppf1lgmr4n/inverterpizw.img.gz?dl=0
> 
> Then connect the inverter to the Pi Serial port. If using the Tesla board you will need an RS232 driver like the one pictured. Very easy to get on ebay. If using the standard inverter logic boards from Johannes, just connect straight up as both the Pi and STM32 are 3.3v UART levels.
> ...


Can you include a simple procedure on how to change access point name and or IP for our Pi, so when we have an EV gathering there wouldnt be connection problems . 
I will probably build a charger with rev. 1 PCB. It would be good to have option to set charging current over phone.


----------



## jackbauer (Jan 12, 2008)

To change the access point id just edit 
/etc/hostapd/hostapd.conf

sudo nano /etc/hostapd/hostapd.conf

in this file you can change ssid and passphrase easily.


----------



## jackbauer (Jan 12, 2008)

Quickstart guide for the wifi adapter.


----------



## jackbauer (Jan 12, 2008)

Connection diagrams for the small drive unit. Both front and rear. Pro versions on the way soon.


----------



## dima (Dec 1, 2015)

I find that RS232 module is redundant, just connect TX/RX directly to RaspberryPi (ports 8/10). Then access your serial with /dev/ttyAMA0 instead of usual /dev/ttyUSB0.


----------



## jackbauer (Jan 12, 2008)

dima said:


> I find that RS232 module is redundant, just connect TX/RX directly to RaspberryPi (ports 8/10). Then access your serial with /dev/ttyAMA0 instead of usual /dev/ttyUSB0.


Yes but you need RS232 for the Tesla boards


----------



## jackbauer (Jan 12, 2008)

I have setup a Github repo for the WiFi adapter :
https://github.com/damienmaguire/Inverter-WiFi

Any contributions or modifications can go in there to keep things tidy.


----------



## ZoePionierin (Sep 27, 2017)

Hello Damien,

I like to convert my 1982 VW Bus Camper to an EV. Intentionally I planned to use a Bosch motor, inverter and VCU, which is also used in the German Streetscooter by DHL. But Bosch refuesed to support my project in any way. Now I have the opurtunity to purchase a salvage Model S 75 D. 

Now I'm looking for solutions to make the motor run my Bus. I followed your project for a while now (@zoepionierin on Twitter). Is it possible to buy an out of the box controler for my bus from you? Maybe I can also provide you with parts from the salvage Model S, that I don't need for my Bus.

Looking forward to hear from you! 

Here a some pictures from the restauration of the bus


----------



## jackbauer (Jan 12, 2008)

ZoePionierin, PM sent.


----------



## jackbauer (Jan 12, 2008)

Released V3 design files for the Large Drive Unit logic board over on Github :
https://github.com/damienmaguire/Tesla-Drive-Unit

Just one change over the V2 board. ULN2003 replaced by NCV8401ADT for driving precharge relay and main contactor following in car testing.


Over the past few weeks I have noticed quite a few new board designs popping up on social media and other forums. Sadly none open source or contributing here on thread or Github. Likewise with the gen 2 charger board. Makes it difficult to stay motivated at times. Gotta protect that IP I suppose. Who knows, Elon might buy them out for $1b.


----------



## jhuebner (Apr 30, 2010)

Oh yes, 23mOhm should do it. Very nice.

People tend to confuse Open Source with free. It is against the GPL to derive your own design from a GPL project and not open it under the GPL. I would certainly tell people on respective forums about that infringement. 

Equally annoying are people asking for support who have never bought a kit or contributed to the project otherwise. I tell them I charge 70€ per hour for support.

But anyway, I want at least the software to remain Open Source because OS such a powerful idea. I think motor control is too important to be hidden away and mystified behind patent shields.


----------



## jackbauer (Jan 12, 2008)

Thanks Johannes. All my work will remain open source. It's such a small market I just don't see the point. I would have to charge so much for support it would be crazy.

Anyway, uploaded V2 design files for the small drive unit logic board. Same change as the LDU. Beefed up the relay drivers.
https://github.com/damienmaguire/Tesla-Front-Drive-Unit


----------



## Kevin Sharpe (Jul 4, 2011)

Unfortunately, the world is full of free loaders who don't wish to contribute 

I really appreciate all your efforts and will continue to support you wherever I can... keep up the good works


----------



## CKidder (Dec 12, 2009)

jhuebner said:


> Oh yes, 23mOhm should do it. Very nice.
> 
> People tend to confuse Open Source with free. It is against the GPL to derive your own design from a GPL project and not open it under the GPL. I would certainly tell people on respective forums about that infringement.
> 
> ...


Yeah, we're all (Damien, Johannes, and me) in an exclusive club. A whole lot of people download our stuff and don't contribute back. That's normal and I think we're probably all fine with that. If you give stuff away for free you can't exactly be shocked when people take you up on that. It feels a little different when people take what you did and totally create their own copy and don't even give you the time of day. And, yeah, it's annoying when people make their own version or take your files, make one, and then want support. Believe me, I know that happens a lot. 

FWIW, I release all of my stuff under the MIT license just to make it easier on everyone. Under that license anyone can take the files and do whatever they want short of saying they built it themselves. All you have to do is tell people you used the MIT licensed project and who wrote it and you're good. You can even use it in commercial designs (and I know that people are doing just that). I do this because I'm not about to go around suing everyone and it spreads the information as far and wide as possible.

But, anyway, thank you Damien and Johannes for all that you both do. I know I rely on your work and I appreciate all the time and energy you've put into it.


----------



## jackbauer (Jan 12, 2008)

Thanks Kevin always appreciate the support

You hit the nail on the head Colin. I've no problem with people using the designs but just reference the original work and/or feedback into the project. I'll have a look at using the MIT license in the future. I use a lot of your stuff like Savvycan and most recently the Tesla BMS. Keep up the good work


----------



## jackbauer (Jan 12, 2008)

Sneak preview of the upcoming digital dash for the inverter. Hope you like.


----------



## lottos (Jun 22, 2008)

jackbauer said:


> Over the past few weeks I have noticed quite a few new board designs popping up on social media and other forums. Sadly none open source or contributing here on thread or Github. Likewise with the gen 2 charger board. Makes it difficult to stay motivated at times. Gotta protect that IP I suppose. Who knows, Elon might buy them out for $1b.


Don't feel disheartened Damien. There are plenty of people, like me, who are really awestruck by what you have achieved and in my case, wish I had the skills to undertake what you have accomplished. Take a moment, take a deep breath and enjoy the moment and be proud.


----------



## Duncan (Dec 8, 2008)

I'm with Lottos on this
I look in awe at what you are doing - someday I MAY feel confident enough to try and use some of your stuff


----------



## Arlo (Dec 27, 2009)

lottos said:


> Don't feel disheartened Damien. There are plenty of people, like me, who are really awestruck by what you have achieved and in my case, wish I had the skills to undertake what you have accomplished. Take a moment, take a deep breath and enjoy the moment and be proud.


I have shared everything I have done open source up to this point. 

My controller (with someone else locked code) has so far made 303hp at the wheels and helped me get into the mid 12s in the 1/4 with a FWD car.

Not everyone sees the value in this but at the end of the day there is no reason to patent something. Show people your work and people will see how good you are and might hire you for other things. I have had great luck this way. Its not like I can't out do my self in the future for something else new and improved. People can copy all I have shared but by the time they do when I am working on and running will be much more advanced and working that much better. 

"Patents are like loto tickets to a law suit"-Elon Musk


-Arlin


----------



## jackbauer (Jan 12, 2008)

Thanks for the kind words guys I appreciate all the support.

Arlo, I have some of your boards here. Sometime when I get a leaf motor i'll have to get around to building them


----------



## Arlo (Dec 27, 2009)

jackbauer said:


> Thanks for the kind words guys I appreciate all the support.
> 
> Arlo, I have some of your boards here. Sometime when I get a leaf motor i'll have to get around to building them


You don't need a leaf motor.

That setup will run any permanent magnet 3 phase motor.

I am excited you have them. I just added some protection to help with reliability at higher power. I will update the design on the forums soon. I put a for sale thread together on ES and will add one here as well.

Also working on a 1000hp controller should be running with in a month! 

Keep up the great work Jack! 

-Arlin


----------



## jackbauer (Jan 12, 2008)

So I have had quite a few contacts from people who are interested in getting the Mercedes Benz version of the Tesla large drive unit running. Big difference seems to be Benz version uses a 14 pin ampseal connector rather than the Tesla 23 pin. I asked one guy to send me the connector.

Just compared it to the standard Tesla pinout. Seems the same except Benz don't use the analog brake or throttle signals. Must be all done over CAN. So, the short version is we can do it but will need a new rev of the logic board to re assign the pins. Or of course people can use the V3 board and make up an external connector. So, anyone on here want a Benz version?


----------



## jackbauer (Jan 12, 2008)

Here is a short video made by a guy in China who built a large drive unit board from github and got it running with a little help from me :

https://www.youtube.com/watch?v=hqEMcGDHkTw

Gotta love opensource


----------



## jackbauer (Jan 12, 2008)

So just to let you all know I am working on a variant of the V3 large drive unit logic board for running the Mercedes/Tesla drive units using the existing 14 pin connector. If this is ok with everyone and you want me to do this then please give me no sign.

https://www.youtube.com/watch?v=6f91T6fW0GI


----------



## lottos (Jun 22, 2008)

jackbauer said:


> So just to let you all know I am working on a variant of the V3 large drive unit logic board for running the Mercedes/Tesla drive units using the existing 14 pin connector. If this is ok with everyone and you want me to do this then please give me no sign.
> 
> https://www.youtube.com/watch?v=6f91T6fW0GI


----------



## mario364 (Jul 23, 2015)

jackbauer said:


> So just to let you all know I am working on a variant of the V3 large drive unit logic board for running the Mercedes/Tesla drive units using the existing 14 pin connector. If this is ok with everyone and you want me to do this then please give me no sign.
> 
> https://www.youtube.com/watch?v=6f91T6fW0GI


----------



## jackbauer (Jan 12, 2008)

Thy will be done.


----------



## feb8 (Jan 31, 2009)

NO, what they said.


----------



## jackbauer (Jan 12, 2008)

So I have had a few enquiries on how to setup the small drive unit logic board and I had to do one for a customer today so made a video : https://youtu.be/VVSRzmP-fRw


----------



## Kevin Sharpe (Jul 4, 2011)

Exciting times ahead


----------



## jackbauer (Jan 12, 2008)

I got into electric vehicle conversion as a direct result of the wonderful open source DC controller project by Paul Holmes. At the time I had little money but lots of time and was able to build, learn and feedback into the project. This made me a big fan of open source. When I needed a way to run an AC motor for the first time open source in the shape of the Heubner inverter afforded me the same opportunity. In this spirit of this, when I decided to design a logic board to run the Tesla drive unit I believed it only fair to feed back into the community. I felt it very unfair that people who wished to use these parts were effectively locked out by nothing other than simple money. Or lack thereof. If we really want to make a difference as a movement then we cannot be made up of the "haves" and exclude the "have nots". After all, who wouldn't want a Model S or a Model 3 if they were $1,000 on Craigslist.

It's recently come to my attention that quite a few people have made their own boards. This is wonderful and exactly what I want for those who can't afford to buy a tested board with support from me. I'm not cheap at 1,500 Euros even though this is less than half the price of the nearest alternative. However, it would seem that some people have decided to rewrite history by removing all trace of the copyright notice, identification and the names of Johannes and myself from the boards they are building (and in some cases selling). This behaviour while I suppose sadly predictable is making me seriously consider whether to open source any further projects or indeed to further support the existing batch. I'm not looking to make a fortune or rip people off or sail off into the sunset. Just keep the lights on and my feet warm while cranking out circuit designs 

By all means use my designs. Build them. Modify them. Hell, sell them in batches of 1000 if you like. I don't want any cut,margin or royalty. But don't delete the names of the people who made it possible.

https://github.com/damienmaguire


----------



## Kevin Sharpe (Jul 4, 2011)

jackbauer said:


> But don't delete the names of the people who made it possible.


What a bunch of little shits


----------



## CKidder (Dec 12, 2009)

jackbauer said:


> It's recently come to my attention that quite a few people have made their own boards. This is wonderful and exactly what I want for those who can't afford to buy a tested board with support from me. I'm not cheap at 1,500 Euros even though this is less than half the price of the nearest alternative. However, it would seem that some people have decided to rewrite history by removing all trace of the copyright notice, identification and the names of Johannes and myself from the boards they are building (and in some cases selling). This behaviour while I suppose sadly predictable is making me seriously consider whether to open source any further projects or indeed to further support the existing batch. I'm not looking to make a fortune or rip people off or sail off into the sunset. Just keep the lights on and my feet warm while cranking out circuit designs
> 
> By all means use my designs. Build them. Modify them. Hell, sell them in batches of 1000 if you like. I don't want any cut,margin or royalty. But don't delete the names of the people who made it possible.
> 
> https://github.com/damienmaguire


Yeah, that's certainly discouraging in the extreme. I don't know why people have such a hard time of just keeping attribution where it's due. It doesn't cost them anything to just leave the credit with who built it. You aren't looking to get a cut, just due credit that you made it. I for one am very thankful for the designs you've done and I'm not afraid to tell other people about them and who made them. I guess you've got to do what you've got to do. Maybe the concept of open source can be somewhat limited. That is, you could give the designs only to some people and not publish them on the web. Or, you can just plain not publish them and sell the boards either bare or populated. It's a shame that there are so many scumbags out there.


----------



## ECOENERGI1 (Oct 19, 2017)

There are people out there- If you can call them that!!! always spoil it for everyone by abusing a good thing

If not for this forum, videos, products and all the open source info from CKidder, Johannes, Damien, Kevin C and so many others. This subject would be for a few engineers and thats it. So thank you 

thats my 2 cents


----------



## jackbauer (Jan 12, 2008)

Thanks guys. Really appreciate the support.


----------



## Duncan (Dec 8, 2008)

Hi 
I don't think you will have lost anything

If they are sufficiently unethical to leave your name off the boards then they are not to be trusted with the rest of the assembly!

I suspect that in the long term you will be glad that your name is not on their work!

Keep up the good work !

I may win the Lotto and be able to use Tesla bits rather than old forklift bits in my next project


----------



## jackbauer (Jan 12, 2008)

Nothing wrong with forklift motors. I've been running one for 4 years


----------



## jackbauer (Jan 12, 2008)

First look at the V2 small drive unit logic board. This one actually made by a Patreon supporter in China. Note the Copyright notice. If you are offered a board for sale without this notice please post here and let us know.


----------



## jackbauer (Jan 12, 2008)

Based on the events of the last week or so I decided to make a video explaining the situation : https://www.youtube.com/watch?v=_6QlrL7nkHQ


----------



## dima (Dec 1, 2015)

> How do you rip off open-source?


You can't. If people sell "knockoffs" there is no reputation there! Like you say what if they change capacitor voltages and cheap out?

That's the advantage of open source. 

1) It changes faster than "knockoffs" can keep-up.
2) Those who buy - the support is non-existent and eventually they need to get involved back into open-source community.
3) It may actually backfire and bring more popularity to legitimate source.
4) 1000 minds can't be wrong (some kind of Linux quote)

It is ALL about people who made it. I think it is silly to be upset about it (it happens to big corporations), keep it open-source!


----------



## jackbauer (Jan 12, 2008)

V3 boards for the large drive unit just in. Featuring the high power drivers for the precharge relay and main contactor.


----------



## jackbauer (Jan 12, 2008)

A little eye candy


----------



## Kevin Sharpe (Jul 4, 2011)

This is impressive 

"Tesla large drive unit second spin"


----------



## jackbauer (Jan 12, 2008)

Anyone looking for boards etc for this and other projects please see here :
http://www.diyelectriccar.com/forums/showthread.php?p=973825#post973825


----------



## jackbauer (Jan 12, 2008)

With some help from Johannes I got the ESP8266 WiFi module working on the bench with a Tesla board.

Johannes's interface works great and the ESP has a much shorther boot time than the Raspberry Pi. The Dima interface errors out with "unexpected token in json string".

Just need to make this into a product with a 12v psu and rs232 transciever.


----------



## jackbauer (Jan 12, 2008)

Spun up a simple little board to mount the ESP8266 module and provide power and RS232. Screw terminals for connecting should make life easy


----------



## jackbauer (Jan 12, 2008)

And the prototype works great


----------



## dima (Dec 1, 2015)

Time for some "alpha" firmware testing  https://github.com/poofik/Huebner-Inverter/releases/download/1.0/Huebner.Inverter.ESP8266.zip


----------



## arber333 (Dec 13, 2010)

dima said:


> Time for some "alpha" firmware testing  https://github.com/poofik/Huebner-Inverter/releases/download/1.0/Huebner.Inverter.ESP8266.zip


I tried to install your formware to a brand new ESP and i got this in Arduino:

Sketch uses 333088 bytes (66%) of program storage space. Maximum is 499696 bytes.
Global variables use 36100 bytes (44%) of dynamic memory, leaving 45820 bytes for local variables. Maximum is 81920 bytes.
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_open failed

Any suggestions?


----------



## dima (Dec 1, 2015)

You need to solder GPIO-0 to 0 in Olimex esp8266 otherwise UART is not enabled. Then after flashing solder it back to 1.


----------



## arber333 (Dec 13, 2010)

dima said:


> You need to solder GPIO-0 to 0 in Olimex esp8266 otherwise UART is not enabled. Then after flashing solder it back to 1.


I have it set to UART.
I tried to load schetch directly trough USB loader. As you see it compiles and loads but there is a problem with sync in the end. I even get green LED flashing when uploading code. Are there any switches to be set? I do use 5V supply on my USB loader... 
How do you flash then, because i tried to follow your procedure but a bunch of files were missing .bat so i gather you use linux then? 
Do you use another arduino as a ftdi?

tnx

A


----------



## jackbauer (Jan 12, 2008)

I also could'nt get it working. Dima, can we send you a few ESP modules for programming?


----------



## dima (Dec 1, 2015)

Ah you guys ....I guess you are in a "developer mode". Yes Windows flashing (.bat) is not ready yet.


Also 3.3V ONLY no 5 V according to Olimex Manual https://www.olimex.com/Products/IoT/_resources/ESP8266EX-how-to-update-firmware.pdf

You need your Arduino setup properly, will add this to readme.

[Arduino Developer Setup]

1) Arduino/File -> Preferences -> Additional Boards Manager URLs: http://arduino.esp8266.com/stable/package_esp8266com_index.json
2) Tools -> Boards -> Board Manager -> esp8266 -> Install
3) Tools -> Boards -> Generic ESP8266 Module


----------



## arber333 (Dec 13, 2010)

Well shoot! I tried like you show in pic but i get the same result. Red LED is on and green LED for UART is blinking untill arduino says it is out of sync. 
I did resolder my USB TTL communicator from 5V to 3.3V. It is working. 
I even tried with second board which is unused untill now... same result.

So... can i try the other way? I have a AVR programmer here i can just connect it to standard pins and flash memory. Can i use your flash file directly or do i have to apply some switches?

tnx

A


----------



## jhuebner (Apr 30, 2010)

I actually set board to "Olimex MOD-WIFI..."


----------



## dima (Dec 1, 2015)

jhuebner said:


> I actually set board to "Olimex MOD-WIFI..."


Ahhh... I know why, I must have flashed a generic bootloader onto Olimex board during "experiment"  Lesson learned yes use "Olimex MOD-WIFI" not "Generic"





arber333 said:


> So... can i try the other way? I have a AVR programmer here i can just connect it to standard pins and flash memory.


Yes this is what sketch.sh is for. No Arduino needed.


```
sudo esptool.py --port /dev/cu.usbserial --baud 115200 write_flash 0x000000 flash-sketch.bin
```


----------



## arber333 (Dec 13, 2010)

dima said:


> Ahhh... I know why, I must have flashed a generic bootloader onto Olimex board during "experiment"  Lesson learned yes use "Olimex MOD-WIFI" not "Generic"
> 
> Yes this is what sketch.sh is for. No Arduino needed.
> 
> ...


OK... i will try with Arduino one more time. Read you later.

Tried to set board Olimex MOD-WIFI but no joy. Same problem with sync. I will try to reinstall ardunio in case it is my comp.


----------



## dima (Dec 1, 2015)

I wonder if you have no bootloader. I got mine from olimex.com ....and I think it already had one. .... or maybe I flashed it during the "experiment" don't actually know  Try to follow this manual to load one in https://www.olimex.com/Products/IoT/_resources/ESP8266EX-how-to-update-firmware.pdf


----------



## ECOENERGI1 (Oct 19, 2017)

Make sure the ground of the TTL and 3.3v source are common


----------



## jackbauer (Jan 12, 2008)

Sneak preview of the first real testing of the Tesla drive unit with a V2 board


----------



## Kevin Sharpe (Jul 4, 2011)

jackbauer said:


> Sneak preview of the first real testing of the Tesla drive unit with a V2 board


Congratulations to you, Johannes, and everyone else who has contributed knowledge, parts, or money... what a milestone!

P.S. open source projects can never work ya know


----------



## ECOENERGI1 (Oct 19, 2017)

Wow! that is amazing, looking forward to a video....


----------



## jackbauer (Jan 12, 2008)

Video : https://www.youtube.com/watch?v=Ke4ba0F804o


----------



## jhuebner (Apr 30, 2010)

Kevin Sharpe said:


> P.S. open source projects can never work ya know


P.P.S. you can't do serious power with slip control


----------



## Tomdb (Jan 28, 2013)

Id would love to see some logs of what the controller is doing while its floored. 

Best would be dyno it or race a tesla. Just because you can.


----------



## jackbauer (Jan 12, 2008)

Dyno session coming soon


----------



## arber333 (Dec 13, 2010)

Hi D

Is it possible for you to update the RaspPi zeroW sd image? I am using your WiFi version a lot. 
In Johannes newest interface i see a lot of functions that i would like to have. Can you load new web interface on your image maybe? Please.

tnx

A


----------



## jhuebner (Apr 30, 2010)

Hi A 

the interface on the esp8266 can not be used with apache yet.
Will need to make some small changes.


----------



## arber333 (Dec 13, 2010)

jhuebner said:


> Hi A
> 
> the interface on the esp8266 can not be used with apache yet.
> Will need to make some small changes.


Well i will not be picky. Your ESP8266 now works perfectly and when the time comes i will just buy another one from you, since you made really good impression with this one .

I had idea we could develop RaspPi W with support for 3G module and web logging. 
Instead worrying about your car being charged somewhere, you could just go to the web page and check log of charging to see data and time of charging. You could even finish charging, reduce power or restart remotely. Wouldnt that be nice .


----------



## jackbauer (Jan 12, 2008)

So, some news. On the 18th June I'm taking the Panzer to a track day at Mondello Park. 

https://www.mondellopark.ie/


The organisers of the event are providing me with 3 phase power for charging so if this doesn't blow the drive unit nothing will


My plan is to use it as tuning session to dial in the parameters for different driving styles and requirements and of course post these on Github for people to use.



there will be lots of video and maybe even a live stream or two


----------



## Kevin Sharpe (Jul 4, 2011)

Great to see another motor turning with the open source controller 

https://twitter.com/zeroevuk/status/1001522531105419265


----------



## jackbauer (Jan 12, 2008)

In case anyone was getting bored :
https://youtu.be/DB1QAfRCu9k


----------



## Kevin Sharpe (Jul 4, 2011)

Congratulations to Chris, Damien, and Johannes... watching the R32 Skyline today with the open source controllers was deeply impressive (and a little scary when we got showered in rocks ).

Here are my videos;

http://www.diyelectriccar.com/forums/showpost.php?p=1005410&postcount=93


----------



## pm_dawn (Sep 14, 2009)

I'm jumping on this train.....

Have ordered partly built boards from Damien.

Motor and battery already in the garage.

Putting all the stuff in a mummy van.
A Citroën C8......
Crazy I know, but I need 6 seats for the family.

Motor mounts has been fabricated and all the ICE stuff has been removed from the car.

Going into bench test phase now.
Inverter 
Charger
BMS
Front junctionbox
DC/DC

I'm trying to study all the finds in this forum.....

Best REgards
/Per Eklund


----------



## Kevin Sharpe (Jul 4, 2011)

pm_dawn said:


> Putting all the stuff in a mummy van.
> A Citroën C8......
> Crazy I know, but I need 6 seats for the family.


Very cool... any chance you could start a build thread?


----------



## jackbauer (Jan 12, 2008)

Hit 300kw traction power and 125kw regen today


----------



## pm_dawn (Sep 14, 2009)

Kevin Sharpe said:


> Very cool... any chance you could start a build thread?


Hi Kevin !

Yes I will as soon As I can sit down and have the time to shuffle some pictures and so on.

Need to upload a lot of videos to YT also.

Regards
/Per


----------



## jhuebner (Apr 30, 2010)

In case anyone was wondering if there is sufficient supply of Tesla parts: took this picture east of Oslo yesterday. I guess around 100 slightly damaged Model S there


----------



## itchyback (May 28, 2014)

jhuebner said:


> In case anyone was wondering if there is sufficient supply of Tesla parts: took this picture east of Oslo yesterday. I guess around 100 slightly damaged Model S there


Tesla Parts are like hens teeth in Australia. I'm very jealous.
What is the going rate for a motor and complete battery in the US?


----------



## SpeedRacer93 (Apr 22, 2018)

jackbauer said:


> Hit 300kw traction power and 125kw regen today


You are going to have to change your signature line....1000 Amps is good!!!!


"Now, Cole, when you shift the gear and that little needle on the ammeter goes into the red and reads 1000 Amps, that's bad."


----------



## Coulomb (Apr 22, 2009)

jhuebner said:


> I guess around 100 slightly damaged Model S there


I hope they have someone cycling them all through chargers, or at least have the cars in a state where the battery packs don't degrade while they wait possibly for months.


----------



## ra_XOr (Aug 7, 2018)

itchyback said:


> jhuebner said:
> 
> 
> > In case anyone was wondering if there is sufficient supply of Tesla parts: took this picture east of Oslo yesterday. I guess around 100 slightly damaged Model S there
> ...


Not anymore I think.. today 2 Tesla X wreckage just sold for 16k AUD 😞.. a complete X with all the goodies... Hope to get my hand over drive unit soon..


----------



## jackbauer (Jan 12, 2008)

Glad to see this thread has resurfaced


----------



## ra_XOr (Aug 7, 2018)

jackbauer said:


> Glad to see this thread has resurfaced


Your dedication and efforts are outstanding.. I joint recently the EV conversion world and kept leaning from you all.. I hope to join the pack of owning one. Thanks!


----------



## jackbauer (Jan 12, 2008)

Yeah. That slip control stuff is no good for making power


----------



## jackbauer (Jan 12, 2008)

In case anyone missed it here is the Panzer running on the dyno. Not bad for open source 
https://www.youtube.com/watch?v=2bLPXOGVxLI


----------



## pm_dawn (Sep 14, 2009)

Hi All !

I have been trying to get my Tesla-LDU to work now for a while.
But I'm not getting to a good spin.
Johannes and I worked on the board for a good 8h when he visited me in the late summer.
But we ended up frying most of the active parts on the 5v rail.
I have replaced all the 5v active parts.

And the board seems to work pretty ok when I power it up on the bench with nothing connected.

I had some problems to get the Current sensor clock generation to work properly until I removed the R3 pot. The frequency was changing all over the place.

But now I have a pretty steady ~3.2 MHz going out.
I can see that I get that alsoout from the IC10 buffer.

I can get commands to work.
I can read values and so on.
But as soon as I try to give command start 2 I get OVERCURRENT LIMIT.

I have tried it connected to the Drive unit also.
Same thing happens.

But I did notice that after I give the command reset two of the drive board lights a diod.

If I thry to measure the voltage I can see that I have some low values on the Nand inputs. I get low values on the C, D and E inputs on the IC3.

Can anyone give me some suggestions on where to start.

Or should I just give up and buy a fully built and tested board?

Any suggestions are welcome.

And BTW I have been in contact with Damien and gotten some sugestions.
But I rather not disturb him more, I can see that he has work up to his hairline....
And yes I know I'm a cheap mf trying to build this myself.
But it is also an exercise in learing and understanding.
And of course soldering....

Regards
/Per


----------



## arber333 (Dec 13, 2010)

pm_dawn said:


> Hi All !
> 
> I have been trying to get my Tesla-LDU to work now for a while.
> But I'm not getting to a good spin.
> ...



I had the same problem first time i connected rev. 2 board to Ampera inverter. It would show ok with Mprot and FWD and other ports active, but when i would connect start port it would trip OC event. Weird. 

Well it turned out my resistor divider for Ampera current sensors was wrong and sensor calibration was out of limit. When i sorted this out everything worked. Did you check current sensor outputs? I mean just before Olimex chip. They should give somewhere 1.65V each.

Oh and yes you absolutely have to connect sensors otherwise OC would just trip.



A


----------



## pm_dawn (Sep 14, 2009)

Hi Arber!

I'm on the Tesla hardware from Damien, so I have no Olimex board.
But I get the general Idea of what you are saying.

I also think that there is something wrong with the in or out of the current sensors. And I might have some other soldering or component fault.

I have been thinking about getting new caps for all the ceramics and change them to soft termination. I have had one of the caps start to smoke.
It might be that there is a cap that is half bad and that keeps messing with me.

I need to do more measuring, and be more organised, writing values down.

I'll get back with more info after this nights session.

Regards
/Per


----------



## jackbauer (Jan 12, 2008)

A low on input C of IC3 indicates and overcurrent fault or a fault in the overcurrent detection circuit. D and E inputs are fault inputs from two of the igbt driver boards. My advice would be to scrap that board and go again. Pop me an email with your address and I'll throw one in the post. No charge


----------



## pm_dawn (Sep 14, 2009)

Hi Damien !

I will send you an email.
Thanks for your never ending patience with stupid people like me.....

It kind of reminds me of IT-Crowd.


----------



## jackbauer (Jan 12, 2008)

I would ask anyone interested in this project to please watch this video :


https://youtu.be/n8WgM3TOPsM


----------



## pm_dawn (Sep 14, 2009)

Hi !

I have now a fully built board from Damien.
But I have not been able to get first spin yet.

Can someone with the LDU please chime in here an give me some pointer in what direction to look for the solution.

I have not yet connected the throttle and the enconder.

I was under the impression that first spin of the moter was going to be possible without those two parts in the sallad.

I have the Raspberry pi setup and talking And I have loaded the low volatge settings from Damiens Github. But I get not reaction when going to start 2.

Any suggestions on what to test and double check?

Best regards
/Per Eklund


----------



## arber333 (Dec 13, 2010)

pm_dawn said:


> Hi !
> 
> I have now a fully built board from Damien.
> But I have not been able to get first spin yet.
> ...



Yes yes... i dont have Tesla drive, but the principle is the same.

1. First you have to setup inverter according to battery. So if you have some puny little 50V battery like me you have to raise boost setting so that start voltage will overcome stator resistance.
2. Now you setup throttle so that this setting is higher from what inverter sees on startup. If inverter sees 55pt and your setup low value is 40pt it wont start.
3. Lower fweak parameter to cca 50Hz for first start. This makes motor turn quicker. 

Also check reported values like OClimit and status of protection pins. Maybe you forgot to connect some pin to 12V.

Try this then.


----------



## jhuebner (Apr 30, 2010)

And maybe the original guide is of some use: http://johanneshuebner.com/quickcms/index.html?en_schematics-and-instructions,9.html


----------



## pm_dawn (Sep 14, 2009)

Big thanks Arber!

I will have another go on it !!

@Johannes:

I have tried that also.
Been trying to follow it as much as possible, but I cannot get it to spin.
Don't even get a whine from the controller......

Either i'm doing it totally wrong (most probably), or there is something fishy with my drive......



Regards
/Per


----------



## jackbauer (Jan 12, 2008)

Do you have forward or reverse pulled to +12v? is the inverter reporting manual run mode?


----------



## jackbauer (Jan 12, 2008)

I'm very pleased to announce that we are very nearly there with a solution for the small drive unit. Special thanks to Johannes


----------



## Kevin Sharpe (Jul 4, 2011)

we've had a busy week


----------



## jackbauer (Jan 12, 2008)

For those interested, here is the IGBT used in the small drive unit inverter :
https://www.infineon.com/dgdl/Infin...N.pdf?fileId=5546d462533600a4015355ba8107152d


A total of 6 in parallel are used per switch.


----------



## jackbauer (Jan 12, 2008)

Sadly I can't make any video for a few days as I've lost my voice Anyway, here are few interesting discoveries :


Root cause of the drive unit inverter failures discovered and fixed.
NOT caused by overcurrent through the igbts but rather the combination of using 8.8kHz switching frequency through a very low inductance stator and the sudden release of the main contactor on an overcurrent detection. The small drive unit inverter works perfectly at 17.6khz switching frequency and setting tripmode to prechon ensures the pre charge resistor can provide a path back to the battery during release of the main contactor. This was tested to the Nth degree on my recent trip to Romania



Working on a fix for a hardware bug that is limiting power. The tesla current sensors span +/- 1250A over a range of 0-5v with 2.5v representing 0A. Seems Tesla use the EXACT SAME hardware overcurrent detection circuit on their logic board as designed by Johannes. They set trip points at .1V and 4.9V giving a total span of 1150A. (1A=2mV). The component choice in the opamp circuit on the open source board causes a hardware overcurrent event at +850A regardless of settings above this value thus limiting power. It was this trip coupled with the above issues relating to main contactor control and switching frequency that lead to inverter deaths.



Identified the hall effect current sensor used in the small drive units as the MLX91209. So at least now if I wreck one they only cost 3 Euros to replace


----------



## jhuebner (Apr 30, 2010)

jackbauer said:


> Identified the hall effect current sensor used in the small drive units as the MLX91209. So at least now if I wreck one they only cost 3 Euros to replace


So it's that small 4-sip chip that sits inside the toroid? Would that ease the board swap?


----------



## jackbauer (Jan 12, 2008)

jhuebner said:


> So it's that small 4-sip chip that sits inside the toroid? Would that ease the board swap?



Exactly. I have a few on order from Mouser for testing.


----------



## Tomdb (Jan 28, 2013)

How did you end up at this chip?


----------



## Kevin Sharpe (Jul 4, 2011)

Damien, you're doing it wrong, Tesla open source will never work 

(new video from Zero EV on twitter here)


----------



## jhuebner (Apr 30, 2010)

Tomdb said:


> How did you end up at this chip?


Probably completely nondestructive using X-ray 


Kevin Sharpe said:


> Damien, you're doing it wrong, Tesla open source will never work
> 
> (new video from Zero EV on twitter here)


 And lets stress it again: slip control will never yield good performance 


Just watched a Björn Nyland video last night, the P100D ludicrous+ sends 180kW to front and 341kW to rear motor. Here's the benchmark


----------



## Tony Bogs (Apr 12, 2014)

Head up, Damien. There's nothing that a bundle of cash and a lot of elbow grease can't solve. Ask Elon.


----------



## jackbauer (Jan 12, 2008)

jhuebner said:


> Probably completely nondestructive using X-ray
> 
> And lets stress it again: slip control will never yield good performance
> 
> ...



Elon gave me a call. He figured seeing as how they had ripped of Johannes's overcurrent limit circuit he would tell me what current sensor they use. Very interesting figures on the motor power and sort of ties in with my findings on the small inverters.


----------



## Kevin Sharpe (Jul 4, 2011)

jhuebner said:


> 180kW to front


Sorry to be pedantic but I think that's 190kW


----------



## jackbauer (Jan 12, 2008)

For anyone having trouble sleeping I'll be live on youtube at 8pm Irish time tonight discussing recent fun in the sun with the Small drive unit opensource logic board. Guaranteed to put you asleep.


----------



## Kevin Sharpe (Jul 4, 2011)

jhuebner said:


> And lets stress it again: slip control will never yield good performance


Yeh, it’s rubbish, what were Zero EV thinking


----------



## jackbauer (Jan 12, 2008)

Grab some popcorn. I think this may be my longest yet : https://youtu.be/ZHYgeNrn4_s


----------



## jackbauer (Jan 12, 2008)

I'm really struggling with posting important information on this forum when waking up to it being spammed. Can someone confirm the Tesla part number for the "Butt plug"?


Anyway, regarding the MLX91209 current sensor used in the small drive unit, seems they come in 3 variants : 50mV/mT , 15mV/mT and 7.3mV/mT wonder which one Elon used? I'm guessing this will be like the Simpsons : God, if you want me to go ahead and find out for myself and then share it with the community, please give me no sign.


----------



## Duncan (Dec 8, 2008)

I zapped the spam as soon as I saw it - but overall we really don't get that much these days


----------



## Kevin Sharpe (Jul 4, 2011)

jackbauer said:


> I'm guessing this will be like the Simpsons : God, if you want me to go ahead and find out for myself and then share it with the community, please give me no sign.


I doubt the "Team A" types will have an epiphany and start sharing useful information with the community


----------



## jackbauer (Jan 12, 2008)

Dammit God you were supposed to give me no sign


----------



## Kevin Sharpe (Jul 4, 2011)

Duncan said:


> I zapped the spam as soon as I saw it - but overall we really don't get that much these days


sure


----------



## jackbauer (Jan 12, 2008)

A few more pictures of the power stage. Next part will be tricky. Getting inside to the IGBTs.


----------



## Duncan (Dec 8, 2008)

Kevin Sharpe said:


> sure


Two spam dumps in the last month? - not very much
And again I zapped those


----------



## jackbauer (Jan 12, 2008)

So it would seem Tesla use the Melexis MLX91209LVA-CAA002-SP 7.3mV/mT hall effect current sensor on the small drive unit logic boards. No special programming at all. Out of the box using the Tesla ferrite ring they give the same 2mV/A response.


So much for my idea of using a lower mV/mT sensor to increase drive unit power. Elon beat me too it


----------



## jackbauer (Jan 12, 2008)

Design files for V4 small drive unit logic board released on Github :
https://github.com/damienmaguire/Tesla-Front-Drive-Unit


----------



## jackbauer (Jan 12, 2008)

Here is a look inside a small drive unit inverter power stage. Teardown video on the way


----------



## jackbauer (Jan 12, 2008)

A long and boring video detailing the modifications and testing on the small drive unit logic board :
https://youtu.be/mhGwcPWCbsA


----------



## Kevin Sharpe (Jul 4, 2011)

Huge price reduction on Tesla boards 






https://youtu.be/m8iR7rPoZTQ


----------



## MattsAwesomeStuff (Aug 10, 2017)

> Huge price reduction on Tesla boards


When people hear this they normally roll their eyes are think "How much? 10%? 15%? Big deal."

Damien dropped the prices of his boards down to 1/3 of their former prices.

Not dropped them by 1/3. Dropped them *to* 1/3. 67% discount.

The tradeoff is that he's not going to commit to troubleshooting each customer one-on-one, traveling, etc. He's going to make the customer service part of the equation more public, so that if he answers a question once, everyone gets to see it. That way he's not caught in a neverending service loop where he's repeating himself.

And, the DIY community being what it is, since it's public, anyone who wants can chip in and help him out with customer's questions.

He doesn't say, but I presume he might be open to anyone who's particular desperate hiring him as a consultant, and they'd probably still save money that way versus it being baked into the cost.

I think it's a great solution.


----------



## x.l.r.8 (Oct 20, 2018)

I just ordered all the parts to build 2 boards and the cost was not far off buying one at the new price. That's a crazy reduction. I guess I may need a spare for the next project, but at that price I cant think of a good reason to build my own.


----------

