BMW Z3

This project got a little real when I had a few glasses of wine and happened across a nicely priced BMW Z3 - exactly what I had been looking for, for this project. The rational half of my brain wanted me to prove I could get an electric drivetrain working first. The irrational part said "screw it let's do it".

And so in two weeks (it is being transported from Cornwall) a 1999 BMW Z3 will arrive on my doorstep. Here are its original specs:

  • Engine: 1895cc 8-valve inline 4
  • Transmission: Manual
  • Engine Power: 114 bhp
  • Acceleration (0-62mph): 10.4s
  • Top Speed: 122 mph
  • Urban Mpg: 24.6
  • Extra Urban Mpg: 47.9
  • Fuel Consumption: 35.8
  • Insurance Group: 29E
  • CO2 Emissions: 189 g/km
  • Euro Emissions: Euro 3

It has no MOT, but I believe it runs fine, has good wheels and tyres, and has no rips in the roof. Given the price I paid (£600) though, it's clearly not a perfect car. Here are the things that need rectifying:

  • There is some rust on one of the rear quarters
    BMW Z3 rust on rear quarter
  • Driver's side mirror needs replacing
  • The electric hood lift isn't working, though this is suspected to be an electrical rather than mechanical issue

Once we get our hands on it I suspect we will find that is only the beginning. But that just makes it more fun, right?

The reality of a £600 Z3

So, the car arrived at the start of June and it's pretty much as expected. Here's the full rundown:

Bodywork: The body is, frankly, a bit of a mess. This isn't too much of an issue as most of it will be replaced. There is rust on both sills, both rear quarters and the offside front wing. Both bumpers are dented and cracked in places. And there are various parking dings. The only ones of these that really matter are in the doors, and they only need a skim of filler when it comes time to repaint. Bigger issue is the sills. These will likely need replacing along with some work to treat and protect the box section underneath. The driver's side mirror is indeed, as advertised, completely borked and held together with duct tape. I looked at second hand ones but they were twice the price of a new casing, and since we're going to be repainting the whole thing, I went ahead and ordered one of those. The other issue is water ingress in the boot- it was puddled in the recesses to the rear of both wheel arches. Again this should be fixed by the new bodywork but I might to investigate/clear/create some drainage holes before then.

Hood: I'm really pleased with the hood. Though the back window is a little milky, the rest of it looks in really good shape. Per the original communication with the seller, the electric hood didn't work when it arrived. But this proved to be a relatively easy fix. When we removed the boot trim to access the hydraulic motor that drives the hood we found first of all that one of the three rubber bushes on which it is mounted had been replaced by a wad of surgical gloves. This was even more bizarre when we found the actual rubber bush in perfectly good condition just under the motor. We restored the bush to its rightful position and in doing so found that the earth leads for the motor were very loose. Once we had tightened it all up, everything worked beautifully. Now if only all the other jobs could be that simple...

Interior: As you may expect for a cloth interior with 174,000 miles on it, the seats and door cards are a little tired. That said, the foam is in surprisingly good shape. Definite potential to have them retrimmed, as second hand interiors are generally going for more than we paid for the car and even then, they're not always in great shape. Only down-side spec-wise is that we don't have the heated seats, but I think the wiring is there so these could always be added as part of the retrim. Both seatbelt guides are broken and the driver's side electric height adjustment is broken, so that will need sorting. It clicks when the button is pushed but there's no movement. The bigger problem is the passenger side central locking which has failed. I have the door card off and this is next on my mist to investigate.

Engine: The car starts, runs and drives fine, though the engine warning light is on and it won't idle. Given that we're removing the engine this isn't too much of an issue but a quick scan of the forums suggests a vacuum leak. If it's a quick fix I might just do it before I pull it out and sell it.

Transmission: I only drove the car from the transporter onto the driveway (with a slight detour because some berk had blocked my driveway) so didn't get beyond second gear, but the shifts felt fairly tight for the miles. I've not checked the history to see if the gearbox has had any work done but if not then it has been looked after. The bellhousing enters the engine bay rather higher than I expected, which may disrupt my planned layout - there might not be space for the BMW 330e battery box that I was hoping to use unmodified.

Electrics: Everything seems to work as expected, apart from the issues noted above. There's a decent JVC stereo installed but it needs a new aerial. When I removed the door card to look at the central locking I noticed a gap in one of the speaker mounts. It doesn't look like the door card had been removed before so I'm guessing this is to do with the car's spec. Maybe space for an upgrade down the line.


70kw Meidensha MotorMitsubishi Outlander PHEV Electric Motor

Here are the specs from the original ad:

  • 70 kW EV Motor
  • AC Motor
  • Input voltage 400V
  • Type 3 Phase synchronous perm magnet brushless
  • Resolver: SIN COS resolver
  • RPM 14000rpm max

The motor comes from a Mitsubishi Outlander PHEV (plug-in hybrid electric vehicle). It's the higher power one of the motors from that vehicle (think the others are 60kw) so I'm guessing it's the rear one? But I may be wrong about that.Based on this video from ZeroEV, I actually think what I have is one of a pair of motors the motor from the front drive unit. This is confirmed looking at the shape and configuration of the motors from the Outlander PHEV site. My current belief (though this is still up for debate) is that this motor has maximum output of 60kw with a rated output of 25kw and 137Nm of torque. Its big brother, the rear motor has 70kw, at least on the latest edition of the PHEV. I originally thought this was one of a pair of motors connected to a gearbox at the front but the other, very similar looking, unit is actually a generator (though likely can also be used as a motor).

Why did I choose this motor? Because I was watching it on eBay and the clever people at Second-Life Batteries who were selling it sent me a special offer at a moment of weakness. They only knocked £25 off the price (in the end it was £445 including shipping), but that was enough for me (with my daughter's encouragement) to push the button on this project.

Is it the right motor for the job? I honestly don't know enough to answer that yet. On the plus side, it's relatively small (roughly 450x300x250mm at its widest points - including the full length of the shaft (snigger)) and light (about 27kg). It's also powerful enough in theory. I saw a rough figure over on the DIY Electric Car forums suggesting that you need 35kw per 1000kg of car. The donor car I'm targetting is fractionally over 1000kg and will likely remain around that with the relatively small battery pack I'm planning to include, once we've shed the combustion engine and all its ancillaries. So in theory this motor has plenty of power.

Negatives? I'm worried that some of those KW come as a result of its relatively high speed. I don't really want to be driving a combustion engine gearbox at 14,000rpm or I might find myself with gears in my lap. We shall see. Also, no-one has yet made an adaptor for the splined shaft on these motors to allow them to be bolted onto the flywheel from a combustion engine. If I'm going to mate this motor up to the gearbox from my donor car (as is my plan), then I'll need to design that and get it fabricated, along with an adaptor plate to bolt the two together.

Finally, on the negatives, I see some much smarter people than me over on the OpenInverter forums saying that these motors have a lot of 'quirks'. Controlling it could be a challenge and I am going to be rather reliant on others overcoming these challenges to make this work.

[PS: Now that I (think) I know what I have, I'm a little concerned about the power output. It could be a little puny in both horsepower and torque. We shall see.]

Low Voltage Connectors

The Outlander motor has two multi-pin connectors on it, one with eight pins and one with six. Fortunately, Second Life Batteries also supplied me with the plugs for these connectors, and they still had some cut off wires from where they were installed. Four wires coming from the 6-pin connector and seven from the 8-pin connector.

A little googling brought me to a Russian online service manual for the PHEV, which contained heaps of useful information. To save you the ads for Russian brides, and because I think it is wrong in places, I've tried to aggregate that information and improve on it here.

6-Pin Connector

Outlander PHEV 6-pin motor connector

Written on this connector I found the numbers "12303". A little googling revealed that is used to connect the throttle pedal on Toyotas and Subarus. The first search results that came up all led me to the US for replacement parts at exorbitant cost. But a trip over to AliExpress turned up some bargains. In the end I bought two (just in case) for just £1.70 each including the pins and the cable shrouds that seal then junctions.

The six connections here are to three temperature thermistors buried in the body of the motor. One measures the U-phase coil temperature, one the W-phase coil temperature and one the general oil temperature via a separate thermistor. Here are the pins for measuring each of those:

  • Pin 11 (sticking with the numbering on the service manual): GTH1 - temperature in the U-phase coil (+ve)
  • Pin 12: GTH2 - temperature in the W-phase coil (+ve)
  • Pin 13: TH0 - oil temperature thermistor (+ve)
  • Pin 14: GTG1 - temperature in the U-phase coil (-ve)
  • Pin 15: GTG2 - temperature in the W-phase coil (-ve)
  • Pin 16: TG0 - oil temperature thermistor (-ve)

All pretty straightforward, right? Here are the resistance ranges you should expect across those temperature sensors (connect your multimeter to the -ve and +ve pins for each sensor).

  • At -20°, you have my sympathies, and you should see 400-600kΩ
  • At 0°, you should see 140-200kΩ
  • At 20°, you should see 55-70kΩ
  • At 40°, you should see 23-30kΩ

My 6-pin connector was only wired for the phase coil temperature sensors, though I may add in the extra wires if I can find out what connector this is. I got it hooked up to my multimeter and sure enough, I saw exactly the above. My home automation system tells me it is 21.4° in my office and I read 65kΩ and 65.2kΩ across the two coil thermistors. So far, so good.

8-Pin Connector

Outlander PHEV 6-pin motor connector

Here's where things get a little more complicated - at least for me, as this was new territory. The 8-pin connector is for the resolver. This is an analogue position sensor that is typically used in AC electric motors because it is accurate and robust. I won't go into the theory here - you can read about that over on WikiPedia. Suffice to say that there are three coils in your resolver. One is an input and the other two are outputs, and the position of the motor is calculated by comparing them.

All this means that we need to find six pins to connect up our resolver. Here again the service manual is our friend.

  • Pin 1: R1 (sticking with the naming from the manual again) - the first connection for the exciter coil
  • Pin 2: S1 - the first connector for output coil 1 (perhaps we should rename this S1-1? looks like this is a standard naming convention so will stick with it)
  • Pin 3: S2 - the first connector for output coil 2 (S2-1)
  • Pin 4: R2 - the second connection for the exciter coil
  • Pin 5: S3 - the second connection for output coil 1 (S1-2)
  • Pin 6: S4 - the second connection for output coil 2 (S2-2)
  • Pin 7: GGND - earth connection to the ECU

Again the manual helpfully supplies some resistance values for checking the condition of the resolver coils.

  • Between R1 and R2, you should see 29-38Ω
  • Between S1 and S3, you should see 70-92Ω
  • Between S2 and S4, you should see 60-83Ω

Checking mine I saw 37.3Ω on the exciter coil, 86.1Ω on the first coil, and 78.4Ω on the second. All good. (Phew).

BTW 8-pin connector is marked as 12520. As far as I can tell this is listed in the Toyota parts catalogue as 90980-12520. This will set you back $20 and $60 shipping from the US, but AliExpress comes to the rescue again. I bought a couple at £3 each including pins and shrouds, with just a couple of pounds paid for shipping.

The inverter wants SIN and COS outputs from the resolver. The output of S1 and S3 gives you SIN, and S2-S4 give you COS.

Orientation and Cooling

It wasn't immediately obvious to me which way the motor should be oriented, so back to the service manual I went. This diagram was very helpful (forgive my atrocious drawing skills over the top of it).

Outlander PHEV motor orientation

Once you realise which way the motor goes, it becomes pretty obvious: there's a lifting eye for craning it in and out at the top, and the oil pipes are fixed at the top and bottom. With that determined, I turned my attention to the cooling. This diagram is also helpful:

Outlander PHEV motor cooling

It was while looking at this diagram and the full version of the last one that I realised why I couldn't match my motor to lots of the pictures very easily. What this shows is TWO motors (or a motor and a 'generator') mounted side by side into a gearbox. Hence the split inputs into the cooling system (9) and the pipe (14) that connects the cooling output of one motor to the input in another. Most of the diagrams in the service manual show everything as part of this larger assembly.

The good news is that the oil cooler here is pretty small. I count seven rows, so a nine or ten row cooler should give plenty of headroom, even if we're working the motor hard. We will need an electric oil pump (not cheap - hoping for an eBay bargain), and some pipes to hook it all up. The outside diameter (o/d) of the barbs on the motor is 10.4mm according to my cheap calipers. I'm guessing this means 10mm internal diameter (i/d) for the pipes for a snug fit. Plus some spring or jubilee clips to keep it all tight. There's no reservoir. As these instructions show, you just top the level up straight into the filler plug...which is on the other motor to mine. So I'll need to rig some sort of filler neck with a t-connection and a non-return valve spliced in above the entry point in the top of the motor casing. At least I have the drain plug and the fill level plug.

Fluid-wise, it looks like the specification is for CVT fluid - "MITSUBISHI MOTORS GENUINE CVTF-J4". You can find a few CVT fluids that claim to meet this spec at around £7/litre.

High Voltage Connections

From what I now know is approximately the top of the motor emerge three EMV/EMC cable glands, fitted by Second Life Batteries as part of the motor's refurbishment (they also gave it the paint job). Removing a thin plate from just below the glands reveals three screw terminals with M6 threaded holes to bolt your three phase wires onto the copper bus bars below.

Outlander PHEV motor HV connections

Mounting the Motor

I couldn't find any diagrams of the mounting points for the motor. At least, not ones with measurements. So set about making a simple CAD model of the motor face in order to map out the bolt pattern.

Without a 3D scanner (a hole in my toolkit I would very much like to fill), my only option was to try to measure the rather uneven surface with calipers and a ruler and transfer those measurements to Fusion360. I then 3D printed a simple template with a hole for the single dowel and plugs for the two M8 threaded holes and four 11mm holes. After about ten iterations of the 3D printed model, I finally had a model that fitted accurately - at least to within a few fractions of a millimetre (note - this is not the one in the picture below).

Outlander PHEV motor mounting template

I have a little more testing to do but then I will share my template with others looking to use this motor. When the car arrives and we have removed the gearbox, I will map the motor mounting holes against the ones on the gearbox and design up a full adaptor plate.

Connecting and spinning the motor

Now that I have my motor hooked up to a working inverter I can reveal a little more about it. The motor has five pole pairs and the same on the resolver. This is important for configuring the OpenInverter software. If you are going down this route, you will need to use the FOC firmware rather than the sine firmware.

Back to navigation


Toyota Prius Gen3 Inverter

Toyota Prius Gen 3 Inverter

If you're going to drive an AC motor from DC batteries, you're going to need an inverter. Fortunately with hybrids and EVs having been around a while now, there are lots of inverters around from wrecked cars. This one from a third generation Toyota Prius cost me £150£135 (long story) including shipping from a breaker on eBay, after a little bit of haggling.

Why this inverter? The amazing boffins over at OpenInverter have been designing replacement control boards for these inverters for years now, so that you can use the expensive power electronics inside (what you need when you're dealing with hundreds of volts and amps), in your own project. The Gen3 inverter seems to offer the possibility of lots of different motors, and appears to also be incredibly robust.

Not only this, but with future software updates it may be able to acts as an inverter, a DC-to-DC converter (giving me the 12v I need for all the usual car electrics, via the original battery), AND a charger, allowing me to charge my battery pack from the mains. Watch this space.

Negatives? No-one that I have seen has yet mated this inverter to the motor above, so that is going to be a novel challenge. Plus, the inverter I bought seems to have a bent coolant pipe that will need careful straightening out.

Stripping down the inverter

If, like me, you are recycling an inverter, then it's likely to arrive from the breaker's yard pretty dirty and in my case, with a bent coolant pipe. You're going to want to clean it (if you're aiming for a nice tidy build) and of course you're going to want to open it up to fit your new OpenInverter board. This is one of those places where I've not found any guides.[Damien has now posted two build videos for the Gen 3 prius board here: and here: . This page has been updated based on what I've learned from these videos.]

Don't get me wrong, there are lots of disassembly videos of the various inverters. But none show how to deal with the sealant gunk that was holding mine together. So here is a disassembly guide for the Prius Gen3 inverter that may have some practical lessons for other inverters.

  • Put the inverter with the sump stamped steel cover down. The sump is the thin metal plate formed to catch and hold coolant [it's not a sump, just the cover for the DC-DC converter]. In my case it was black, while the rest of the inverter was raw aluminium colour.
  • Undo the bolts around the L-shaped plate on the top. My inverter still had all the connectors attached and to remove them, you need to remove this plate. These are all 10mm hex heads (M6 bolts I think) on the Gen3 Prius inverter. beginning Prius Gen3 inverter disassembly
  • Once you have removed the plate, look for any bolts holding in connectors below. These too are 10mm hex heads (M6 bolts) on the Prius Gen 3 inverter. These are shorter and cleaner so make sure you keep them separate. Prius Gen3 inverter disassembly
  • When the bolts are out, wiggle out any any connectors that are attached around the top of the inverter. See the pictures in this thread for an understanding of which connector goes where. I'll probably add my own diagram in here at some point.
  • Next, remove the next layer of bolts positioned about a quarter of the way down the inverter body. Stick them in a pot.
  • There were two plastic covers on my inverter that had to be levered out with a screwdriver for the next step. They are brittle plastic and they are glued in so it feels pretty destructive. But you can't proceed to the next step without removing them. Fortunately both of mine survived with their clips intact and could be reattached. See the photo below to identify where they are.
  • Lever out the plastic and undo the bolts behind. You are keeping all these bolts separate and labelled, right?
  • Now you can crack the case. This bit is nerve-wracking. Cast aluminium cracks pretty easily so you don't want to be hammering on it if you can avoid it. But even with the bolts undone, the two cast sections would not separate for me. I had to insert something into the crack between them to separate them. Here's how I did it: A few years ago my favourite kitchen knife fell and snapped. I couldn't bring myself to get rid of it so I kept it. Glad I did now. I worked my way around the case, gently hammering the sharp edge of this tiny knife into the crack where the black sealant was oozing out. Slowly but surely, the two parts of the case started to separate. Prius Gen3 inverter disassembly tool
  • Work your way around the case slowly until it comes apart. Try not to put any pressure on thin parts of the casing. Eventually it will separate. In my case the silicon sealant had to be cut in a few places to get it to finally release. Lift away the top part and put it to one side.
  • Inside you will see two logic boards, one on top of the other. The one you will be replacing is the top one so go around undoing all of the connections on it, making sure to find the unlocking tabs on each. They can be a little fiddly but they will come. Then undo the screws holding this board in and remove it. Prius Gen3 inverter logic board
  • With a bit of luck your new OpenInverter board will drop straight in...

Battery Terminals

Once the new control board is fitted, the inverter will no longer use the original battery terminals. Instead it connects to two terminals inside one of those plastic covers I prised off. These connectors are recessed so I bought a couple of threaded brass standoffs and some matching threaded bar to bring them out of the case. As you can see, they still need insulating and probably some conductive paste. And I may want to get some with a smaller outer diameter as this looks a little close to the case for comfort. EVBMW now sells a full kit for this that will probably do a better job than my effort, but it should be good enough for testing.

IMPORTANT! Per this video, the suggested connection location for the high voltage battery to the inverter has now changed.

Prius Gen3 inverter battery terminal standoffs

Tweaking the DC-DC Converter

EVBMW Prius Gen3 inverter logic board kit

By default the DC-DC converter in the Prius Gen 3 Inverter will shut down at something over 200 volts. I want to run my car at between 300 and 400. So following another EVBMW support video, I need to change some of the resistors on this control board that is found under the black steel plate on the opposite side of the inverter to the primary logic board.

Removal is very much the same: undo the bolts then go around with your old kitchen knife, slowly and carefully cutting through the sealant goop and levering the cover up.

Given my expensive failure with the control board, I'm going to outsource this bit of work too... If you want to do it yourself, watch Damien's video here: https://youtu.be/Nu5_OBOPk4s. The resistors you need to replace are all 120kohm - you will need eight 210kohm surface mount resistors (1%, 0.5W, 0805, Manufacturer part#: ERJP06F2103V Farnell #: 2326773 ). On the top side of the control board these are numbered R629, R627, R625, R623 and on the bottom side, R630, R628, R626, R624.

Plugging the Holes

I've started knocking up little 3D printed parts to cover the holes that will be left in the Prius inverter casing based on the plugs we wont' be using. Konstantin over on the OpenInverter forums has done a nice plate to mount a 35-way Ampseal connector to make it easy to hook everything up. I've just blanked off the old battery connector so far.

This design requires an R26 (34.5mm inner diameter) O-ring to provide a snug fit. You can download the STL file here.

Back to navigation


EVBMW Prius Gen3 Control Board

Buy it online from EVBMW

The amazing Damien Maguire is an electronics engineer in Ireland and part of the very active OpenInverter team who reverse engineer parts of EVs and hybrids and manufacture new control boards for them to allow them to be reused. I bought this control board from Damien mostly populated with parts...

My first disaster...

The Prius Gen 3 controller board from EVBMW comes as a kit that you need to do some soldering on to add various connectors. I've been soldering for about 35 years. But only ever through-hole stuff. Never surface mount and never particularly fine scale. I watched the instruction video from Damien at EVBMW and thought, "How hard can it be?" The answer: £300 hard. In short, I borked my first board. Or rather, the mistakes I made were so bad that by the time I handed it over to someone a bit more talented, it was pretty much unrescuable.

So, a new board is on its way direct to the person who is going to solder it up for me, and I am now practicing my surface mount soldering on old circuit boards. I'm still screwing it up. The lesson? If you are AT ALL unconfident in your ability to complete the soldering required to put this board together, hand it on to someone else and spend some money.

EVBMW Prius Gen3 inverter logic board kit

UPDATE [2020-06-16]: The control board and modified inverter came back this weekend and everything seems to be working. Hit it with 12V and you get a WiFi connection and web interface. Hoorah!

I've also received from Damien a daughter-board that provides the 35-pin AMPSEAL male connector and have designed a new 3D printed part to enclose this. A few designs for this have been floating around the forum but didn't quite fit my needs so I created a two part piece to enclose the daughterboard on the outside of the inverter case. You can download it from here.

EVBMW Prius Gen3 inverter AMPSEAL connector housing

Back to navigation


BMW 1-Series Throttle Pedal

BMW throttle pedal

This cost me £10.49 inc shipping from eBay, which seemed very reasonable. My unit came in good condition with the connector plug attached and some decent length tails on it.

As far as I can tell the pedal has two position sensors that each take an input voltage and return a signal. I'm not sure if it is resistive or digital at the moment so I'm going to try putting it on a multimeter....

I found the pin out information on a forum post on a racing simulator site of all places:

  • Pin 1: GND 1 - Brown/Yellow (apparently brown and green on the E46 pedal)
  • Pin 2: GND 2 - Brown
  • Pin 3: VCC 2 - Yellow/Green
  • Pin 4: SIG 1 - White
  • Pin 5: VCC 1 - Yellow
  • Pin 6: SIG 2 - White (apparently white/green on the E46)

A bit of googling suggests the electronics expect 5V on a modern BMW so I hooked this up to the bench power supply and a multimeter and took some voltage readings (i.e. 5V to VCC 1, Ground and multimeter ground to GND 1, and multimeter to SIG 1, then repeat for SIG 2). My bench power supply is actually an old PC PSU (I do love to recycle) so it isn't adjustable and doesn't give me exactly 5V. Measured at 5.13V while testing. Here are the results:

SIG 1

  • Throttle at rest: 0.73V
  • Throttle at full travel: 4.00V

SIG 2

  • Throttle at rest: 0.36V
  • Throttle at full travel: 2.02V

So, the output of SIG 1 has exactly twice the resolution of SIG 2. Guess there are two for safety reasons? [this website confirms that]. Either way I now know how to get the output of my throttle and feed it to the inverter control board.

Note on the connector: It's a Tyco unit but there are nice cheap clones available on AliExpress again - search for 967616.

Back to navigation


35mm2 Welding Cable

You need some chunky cable to wire your battery to your inverter, and your inverter to your motor. I plumped for 35mm2 welding wire. Some people go up to 50mm2 but that might have been overkill for this project. Welding wire costs about a third of the stuff that is sold specifically for HV EV projects and as far as I can tell, is pretty similar. Certainly capable of carrying what's required without turning into tinder. BUT this is for my project: don't take this as a rule for yours. Do the math, as the Americans would say.

[Update 2020-07-24]I have now ordered my welding wire. I plumped for this stuff from CEF, which seemed to be the best deal. It looks to be supplied by Eland Cables - full spec here.

Back to navigation


Size 20 Orange Conduit

For extra safety and insulation around your high voltage cables it's a good idea to wrap them in a suitable conduit. I've gone for size 20 unsplit CTPA orange conduit from Hilltop Products, which seemed to be well priced.

Back to navigation


High Voltage Terminals

To terminate my high voltage cables between battery and inverter, and between inverter and motor, I will need some matching terminals. I'll be using tinned copper tube terminals with a 6mm eye hole to match up to the motor and inverter connectors (not sure if the battery is the same) and some extra M6 hex head bolts as the motor didn't have any when it arrived.

Back to navigation


Outdoor-rated Shielded Twisted Pair Cable

As well as high voltages, you need to move signals cleanly around your EV. For that I've purchased a reel of 25m of shielded twisted pair (STP) Cat5e cable with an outdoor-rated waterproof sheath and grounding wire. We'll see how that works. I'll likely sheath it further in something to give it extra protection in the engine bay environment and when it has to run down the car to the battery packs in the rear.

UPDATE: THIS IS THE WRONG STUFF FOR THE JOB

Turns out that the this stuff is too thin to be properly crimped into most of the connectors that are typically used in an automotive environment. You really need something of 20AWG/0.75mm2 or above. I've now ordered some 7 core CY Flexible Control cable designed for industrial environments to see how that fares.

Back to navigation


Controller Board Connector

The controller board has a 35-pin Ampseal connector, easily found on eBay and elsewhere. I've ordered one for now though I may end up ordering a second so I can do a tidier job on the final wiring.

UPDATE [2020-06-16]: It turns out AMPSEAL connectors are an absolute pig to crimp without a specialist £350 tool. I managed in the end but only on my second connector. The first one is probably salveageable but my advice is go slow and patiently, and don't try to crimp in wire that's too thin like I did. 0.75mm2 looks to be ideal.

Back to navigation


MOCAL Oil Cooling Diaphragm Pump

Mocal oil pump

The Outlander motor is oil cooled, while the Prius inverter is cooled by traditional engine coolant (water + additive). This means right now we will need two cooling systems, unless we can maybe run oil through the inverter. This feels like a bit of a gamble though with lots of maths required around flow rates, viscosities and thermal transfer. So for now, my plan is to stick with two cooling systems.

With the combustion engine removed and no drive belts to take power from, this will require a couple of additional coolant pumps as well as an additional oil cooler (not sure if the donor car has one of these yet). These can be quite pricey so I started an eBay watch early on and came across a fairly high spec Mocal oil pump going for relatively little. Some fastest-finger-first bidding later and I'd nabbed it for £51 including shipping - about a third of its retail price. Picture to follow when it arrives.

Specs are as follows (from the MOCAL website):

Pump has integral cooling fan, 12 or 24volt motor. Ports are 3/8NPTF and may be rotated in 90° increments to simplify plumbing. The pump body is made of lightweight nylon, care must be taken when tightening tapered adapters not to over tighten and crack housing.
Perfomance: 2 UK gals/10 litres per minute with 7 amps current draw. Temperature constant use up to 130°C, intermittent up to 150°C.
Dimensions: Weight: 1.5kg/ 3.3lbs

I will need to rig up some sort of temperature switch so the pump kicks in not to early and not too late - somewhere around 70°. I could do this with a simple 12v temperature switch but I'll more likely use the coil temperature readings from the motor and have this switched on a relay using logic on a microcontroller somewhere (I will likely need something to act as a vehicle control unit (VCU), replacing the onboard logic for the car).

Back to navigation


VW auxiliary water pump

Since the Prius inverter is water cooled, I'm going to need something to pump water through it. Exactly how much cooling I will need is unclear, but better safe than sorry I figure, so I picked up a cheap auxiliary water pump for a Golf/Jetta from eBay - OE part number 1K0965561J. This was a no-name part but new and looks like it should do the job, plus it was a third of the price of the equivalent Prius part.

Back to navigation


Vehicle Control Unit

The vehicle is going to need some smarts put back in it once the ECU is removed, to manage things like the dash instruments, and act as something of a state machine for different modes - charging, driving, parked etc. I've bought a powerful little microcontroller for this - a Teensy 3.2. But my initial experiments will be with a chip I know better: the ESP866. I have tons of these around the house as sensors and remote controls for sockets. They're cheap but capable and have built-in WiFi, which makes it easier to get data off them.

CANBus Sniffer

ESP8266 connected to MCP2515 CANBus module

The first thing I've done is hook up an ESP8266 to an MCP2515 CANBus interface and found some working code so that I will be able to capture a load of CAN messages off the BMW's bus before we dismantle it. This should help us to spoof these messages down the line in order to do things like ensure the ABS works and turn off any error lights on the dash instruments.

The code sketches I have used can be found here on Github, courtesy of Cory Fowler. The ESP8266 is hooked up to the MCP2515 module as follows:

ESP8266 MCP2515
D2 CS
D4 INT
D5 SCK
D6 SO
D7 SI
5V VCC
GND GND

Note that although the MCP2515 is being supplied with 5V, it seems to return 3v3 logic level signals so doesn't damage the ESP8266. At least, that's what I've read and it seems to be working for me.

Back to navigation



Vehicle Monitor

As well as the actual vehicle smarts, I want to be able to monitor its status and charging through my home automation system, Home Assistant. I could integrate the code for this into a single microcontroller but I would rather keep the critical code separate from something internet connected and inherently best-effort, so I'm going to re-use the ESP8266 from my early VCU experiments as a separate vehicle monitor.

CANBus Sniffer

ESP8266 connected to MCP2515 CANBus module

The first thing I've done is hook up an ESP8266 to an MCP2515 CANBus interface and found some working code so that I will be able to capture a load of CAN messages off the BMW's bus before we dismantle it. This should help us to spoof these messages down the line in order to do things like ensure the ABS works and turn off any error lights on the dash instruments.

The code sketches I have used can be found here on Github, courtesy of Cory Fowler. The ESP8266 is hooked up to the MCP2515 module as follows:

ESP8266 MCP2515
D2 CS
D4 INT
D5 SCK
D6 SO
D7 SI
5V VCC
GND GND

Note that although the MCP2515 is being supplied with 5V, it seems to return 3v3 logic level signals so doesn't damage the ESP8266. At least, that's what I've read and it seems to be working for me.

Back to navigation



Gigavac GV242MAB

Gigavac GV242MAB contactors

You need some chunky switches when you're connecting and disconnecting 300V. Hence, contactors. These units I bought from one of the members of the OpenInverter forum. They are American made Gigavac GV240 units (full datasheet here)rated for 800V and 400A. I expect to be drawing a maximum of about 330V and 200A so these are well within spec.

The last four characters in the product's name tell you a little bit more about its specifications:

  • '2' means that it is side-mounted with a single M8 bolt
  • 'M' means that it has a built-in PWM economiser for the 12/24V coil that drives the switch. What this means is that the contactor can draw a chunky amount of current when it needs it do to the initial switching, but then drop that current right back to hold the switch closed. This extends the life of the coil and reduces power consumption.
  • 'A' means that the driving coil is terminated in flying leads, which should make hooking them up nice and easy.
  • 'B' means that is a single pole, single throw (SPST) relay that is normally open (NO). In other words, there are only two switch terminals to connect and the switch remains open until you apply some current, which is what we want.

Each contactor has two M8 threaded terminals for the high voltage contacts and four wires for the low voltage conections. These are:

  • Red: LV coil positive - apply 12 or 24V here to switch the contactor on
  • Black: LV coil ground - the return for the switching circuit
  • Blue: Auxiliary contact 1 - if I have understood correctly, this allows you to sense the contactor's state using a mechanical connection to the main switch
  • White: Auxiliary contact 2 - the other connector for sensing the contactor's state

Panasonic AEV52012 Relay

Panasonic AEV52012 Relay

For pre-charging the inverter before the main whack of current comes in, I'm using a second hand relay from a Nissan Leaf. I really struggled to find these in the UK, eventually buying one from China on eBay for about £30. Feels like a lot to me and I'm sure there must be better and more local options.


Arcol HS100-100RF Resistor

Arcol HS100-100RF Resistor

This resistor controls the pre-charge phase. Copied this from Fiachra Cooke's HV junction box setup (I think) which has been very useful in helping me put all this together.


Hotpoint Washing Machine Heater Element

Hotpoint Washing Machine Heater Element

This may seem a bit left field but a heater element is apparently a great resistor to use when testing, in order to limit the current flowing through your set up. Fortunately, I hadn't gotten around to scrapping our old washing machine that just had too many faults to repair last year after many years of service. So my daughter and I stripped it down and extracted this element, along with a lot of useful wires and some solenoid valves that may be useful in future projects.


BMW 330e Hybrid Battery Pack

BMW hybrid battery pack

Batteries remain the most expensive part of any EV conversion. For mine I'm initially using a 9KWh battery pack from a BMW 330e. I picked this up for £750 on Facebook marketplace. It would have been nice to use the batteries in their original case but I couldn't quite make this fit with my motor setup so have reboxed them into a case made from an old washing machine.


Mitsubishi Outlander PHEV 2015 Charger

Mitsubishi Outlander Charger

The charging software for the adapted Prius Gen 3 inverter I'm using just isn't there yet. So when I spotted this charger from a Mitsubishi Outlander PHEV for just £180 plus shipping, it seemed like an obvious solution. Others in the forum already have these up and running usint CANBus to control them so there should be some support and experience available for numpties like me. Not even got it out of the packaging yet - hence the pic from the site where I bought it, https://www.evbreakers.com/.

Looking at the OpenInverter forum, hooking this charger up should be pretty straight forward. It has a single 13 pin connector, with its counterpart available from eBay as a 'Sumitomo 6189-1092 13-WAY CONNECTOR KIT Inc Terminals & seals [13-AC001]'. Pinout as follows (details from OpenInverter forum):

  • Pin 1 (Orange) Not used on Outlander
  • Pin 2 Not used on Outlander
  • Pin 3 (Blue) Not used on Outlander
  • Pin 4 DC SW - enables the DC:DC converter, seems to just target 14V when this is high
  • Pin 5 CHIN - serial protocol to EV Remote wifi module
  • Pin 6 (Black) CAN H
  • Pin 7 Sense line for DC to DC converter
  • Pin 8 IGCT main power to charger
  • Pin 9 Proximity signal from charger
  • Pin 10 GND
  • Pin 11 Not used
  • Pin 12 CHOT - serial protocol to EV Remote wifi module
  • Pin 13 CAN L (Red)


Mitsubishi Outlander PHEV 2015 Charge Port and Harness

Mitsubishi Outlander Charge Port

Charge ports are expensive new. Even just the little Type 2 / J1772 port shipped direct from China can be around £60. So second hand is the way to go. For £99 I got this used charge port and wiring harness from a Mitsubishi Outlander PHEV which should plug straight into my Outlander charger, making wiring much simpler.


Type 2 Charging Cable

Type 2 charging cable

The first component of my charging solution (TBD) that I picked up was this second hand charging cable. Paid less than £20 including shipping from memory.


Battery Management System

Teensy 3.2 with CANbus interface

I didn't document this very well when I put it together so of course this is the thing that came back to bite me in the arse. OK, one of the things. Anyway, when I got it all hooked up in the car it didn't work. So I had to take it all apart and try to remember what I had done. It was only two months ago but it might as well have been twenty years for all I could remember. A lot has happened in between!

The battery management system or BMS keeps an eye on your batteries during use and charging, as the name suggests, and handles things like balancing the cells to make sure they all remain in a similar state of charge. For this I'm using the SimpBMS code running on a Teensy 3.2. The maker of SimpBMS does offer dedicated hardware that I might well buy at some point, but for now my needs are limited.

The BMS primary interfaces with a load of secondary units attached to the battery modules themselves over CANBus. And it communicates with the other modules in the car over CANBus as well. This means you need to add to the Teensy a CAN transceiver. I'm using SN65HVD230 module. This connects to the Teensy via the following pins:

TeensyTransceiver
AGNDGND
3v33v3
CAN TX (Pin 3)CTX
CAN RX (Pin 4)CRX

The CAN H and CAN L (CAN high/low) pins on the transceiver then go into your bus connections. In this case, there are three connections to be made here. There is the internal loom that connects to the five battery modules, and two external loom connections.

I decided to keep most of the connector on the internal loom because it had a standard 2.54mm pitch, which meant I could solder up a break-out board for it using standard dupont pins.

More to follow when I get this working again...


BMW PHEV Safety Box

BMW PHEV S-Box

Inside the BMW PHEV battery pack is what they call a 'Safety Box', but which the rest of the community might call a 'High Voltage Junction Box'. It is basically the same as the HVJB I orginally put together for my project but a lot more compact. Made by Lear, it features two contactors, a pre-charge relay and resistor, and a fuse.

Thanks to incredible work being done over on the OpenInverter forum it looks like it might be possible to re-use the s-box, controlling it over CANBus. If I can make this work, it will save a huge amount of space in my project, allowing me to mount the charger and inverter under the bonnet, and free up components to use elsewhere in the project or on future projects. It could also make other people's projects significantly cheaper if they don't need to buy all the HVJB components separately.

The pinout of the S-Box is as follows (see picture up above for pin numbering):

  • 1: CAN H
  • 2: Not connected
  • 3: GND
  • 4: NC
  • 5: TBC
  • 6: NC
  • 7: TBC
  • 8: NC
  • 9: NC
  • 10: CAN L
  • 11: NC
  • 12: 12V (Circuit power)
  • 13: NC
  • 14: 12V (Contactors)
  • 15: NC
  • 16: TBC
  • 17: NC
  • 18: NC

CANBus Interface

The S-Box features a variety of voltage and current sensors that can be accessed through the CANBus interface, and we hope the contactors and pre-charge relay too (work in progress).

IDNotes
0x100Notes
0x110Current related data
0x200Current
0x210DC bus voltage
0x220Battery voltage
0x600Low resolution DC bus and battery voltage
0x100Notes

Modifications

After chatting with people on the forum I decided that it would be a bit too dangerous to rely on controlling the S-Box contactors via CAN Bus since we don't know what code is in there. What if they cut out while the motor is spinning?

So instead, I've followed others' example and modified the wiring inside the S-box to route the wires for the pre-charge relay and contactors out through the spare spaces in the original contactor. This gives me a revised pinout as follows:

  • 1: CAN H
  • 2: Not connected
  • 3: GND
  • 4: NC
  • 5: TBC
  • 6: Negative Contactor 12V
  • 7: TBC
  • 8: Positive Contactor 12V
  • 9: Pre-Charge Relay 12V
  • 10: CAN L
  • 11: NC
  • 12: 12V (Circuit power)
  • 13: NC
  • 14: 12V (Contactors)
  • 15: Negative Contactor GND
  • 16: TBC
  • 17: Positive Contactor GND
  • 18: Pre-Charge Relay GND

For testing I wired the negative contactor and pre-charge relay up to the 'on' position on the ignition switch and added a manual switch to the positive contactor.

BMW PHEV S-Box testing


Mitsubishi Outlander PHEV Rear Inverter

Mitsubishi Outlander PHEV Rear Inverter

The Mitsubishi Outlander PHEV has two inverters, one for the front pair of motor/generators, and one for the rear. I'm hoping that the rear inverter I picked up very cheap (£100) will be able to drive my front motor, as an alternative to the Prius inverter that has been giving me issues.

The Outlander inverters can be directly controlled over CANBus so don't need a new logic board adding in, though obviously you do need a logic board to control pre-charging etc.

High voltage connections

Inside the inverter there are three phase connections for the motor, two main battery terminals, and sued auxiliary outlets/inlets for the air conditioning system and the DC-DC converter/charger. These are pictured below.

Low voltage connections

There are two connectors on the inverter, one grey and one black. Mine were absolutely fried - looks like fire damage, though the inside of the inverter seems fine.

These connections have been documented over on the OpenInverter wiki. I'm copying them for my reference below along with the wire colours and numbers I have used for the tails I put in for testing - ignore the stuff in brackets:

Connector 1 (D211 - Grey)

  • 1: Not connected (NC)
  • 2: Unknown
  • 3: Unknown
  • 4: GND (Black)
  • 5: CANBus Low (Grey)
  • 6: CANBus High (Clear)
  • 7: NC
  • 8: NC
  • 9: Unknown
  • 10: Unknown
  • 11: NC
  • 12: RSDN (connection to ECU, unknown use)
  • 13: IGCT - 12V (Red)
  • 14: NC

Connector 2 (D212 - Black)

  • 1: Not connected (NC)
  • 2: TG2 - Thermistor ground for W-phase coil (Black) - Maps to pin 15 on motor connector (numbered cable 2)
  • 3: TG1 - Thermistor ground for U-phase coil (Black) - Maps to pin 14 on motor connector (numbered cable 3)
  • 4: RGND - Resolver ground (Green) - maps to pin 7 on motor connector 2 (numbered cable green)
  • 5: S4 - Position coil 2 (Yellow) - maps to pin 6 on motor connector 2 (numbered cable 5)
  • 6: S3 - Position coil 1 (Green) - maps to pin 5 on motor connector 2 (numbered cable 6)
  • 7: R1 - Exciter coil (Yellow) - Maps to pin 1 on motor connector 2 (numbered cable 4)
  • 8: NC
  • 9: TH2 - Thermistor +ve for W-phase coil (Red) - Maps to pin 12 on motor connector (numbered cable 5)
  • 10: TH1 - Thermistor +ve for U-phase coil (Red) - Maps to pin 11 on motor connector (numbered cable 6)
  • 11: SLD (white)
  • 12: S2 - Position coil 2 (blue) - maps to pin 3 on motor connector (numbered cable 2)
  • 13: S1 - Position coil 1 (white) - maps to pin 2 in motor connector 2 (numbered cable 3)
  • 14: R2 Exciter coil (blue) - maps to pin 4 on motor connector 2 (numbered cable 1)

CANBus deciphering

As an initial test I hooked the inverter up to 12v and CANBus and ran a sketch on a NodeMCU to capture the outputs (I have some more sophisticated hardware on the way).

This worked first time, much to my delight. So started searching around for some help deciphering the codes. I found an extensive capture over on the myoutlanderphev.com and used that to start to work out what I was seeing.

The first code that came up was ID 289. This contains information about the rear motor/inverter outputs.

Rear motor torque is calculated as "(A*256+B-10000)/10". I take 'A' in this case to be the first bit, and 'B' to be the second. Normally I think the data bytes are in reverse order - 7 to 0. But plugging this in I got some weird results - negative 1000 ish. So I stuck the first two bytes from the left in and sure enough, I got zero, as it should be. So I carried on.

Rear motor RPM is calculated from "C*256+D-20000". This should obviously be zero as well, but wasn't, whichever bytes I put in. Hmmm.

FAQs

For all the fantastic information and help I've found on the forums, I've still struggled to find answers to a lot of questions when first getting started with this project. So I thought it would make sense to document the answers here in case it is useful to others.

How do you choose the right components?

As noted above, my initial parts selection was originally based on a whim. It may prove to have been a mistake but it got me started. When I have a better answer than just hitting "Buy It Now" on something that takes your fancy, I'll put it here.

How much power do you need?

I'm hoping that rule of thumb from the forums above is accurate: 35kw/metric ton is your baseline. Anything above that gets progressively more... exciting. TBC!!

How are you going to connect it all to the donor car?

There are lots of choices here and the one you choose will determine what complications you have down the line. I have chosen to mate my motor up to the existing gearbox on a rear wheel drive car. That means everything from the gearbox back is standard, but I have to make up an adaptor for the flywheel and a plate to match up to the gearbox bellhousing. I coud have chosen instead (and might yet) to use the gearbox from a Lexus GS450H, which contains two electric motors and kicks out an apparent 300 horsepower. In this case, I would instead have to mate the back of this gearbox to the propshaft. Some people take out the clutch and bolt the electric motor straight to the input shaft. Some people do away with the gearbox altogether. It all comes down to your component choice, but every decision changes the complexity of the project down the line.

How are you going to control it?

The obvious choice here seems to be buying a board from EVBMW/OpenInverter but there are lots of other options...