# Automobile Repair/BMW/3 Series/E30 Megasquirt and Wasted Spark ECU Conversion

NOTE: An updated version of this document can be found here
This is a guide to upgrade the Motronic ECU fitted to BMW's 3-Series (1988 to 1991) using the after market ECU Megasquirt, and a Coil Pack for Wasted Spark. The model used in this guide, is a UK spec 1989 325i. Other models may very, particularly those models that use the pre-88 Jetronic system, which will require additional work.
Background
The Motronic ECU fitted to BMWs in the late 80's whilst reliable, is somewhat outdated now. It relies on an Air Flow Meter for air intake measurement, which is more restrictive to air flow than a more modern MAF sensor. Megasquirt takes this a step further, and uses a MAP Sensor instead, removing the need for any air measurement. Megasquirt also opens the door to using an alternative ignition system, such as Wasted Spark. For the price of a new BMW distributor cap and rotor arm, Wasted spark can be added to the Megasquirt system, boosting performance (a stronger spark) and reliability (no contacts to wear out).
Advantages
* Improved fuel economy
* Lower emissions.
* Improved performance
* Solid state ignition (no dizzy cap/rotor)
* Relatively cheap modification for benefits gained.
* Extendability (platform for future mods - turbo/supercharging etc.).

### Parts Needed

* Megasquirt I or II (I used "Megasquirt-extra I" for this writeup)
* Megasquirt connector & short Wiring loom
* Coil Pack (Vauxhall/Opel Vectra/Omega V6 or Bosch 0221503002)
* Wideband O2 sensor (Innovate LC-1)
* Motronic Plug (or scrap ECU box)
* TPS (Throttle Position Sensor - BMW part 0280120406/13631726591)
* IAT (Intake Air Temperature sensor)
* 3mm vacuum tube & T-piece.
* Hose
* Wire
* Diodes
* Megastim (optional - get it anyway, you can always sell it)

## Megasquirt ECU

Megasquirt can be purchased in kit form or ready built. Either way, you need to order it with two additional spark outputs. See the main Megasquirt site for suppliers and constructional details. For details on wiring the additional coil drivers, see this page

## Wiring the ECU loom

Wiring Megasquirt to the car, can either be done by connecting every component directly (sensors, injectors, coil etc.), or reusing as much of the existing wiring as possible. In this guide, we do the latter, by gutting an old Motronic ECU box, and reusing the connector. Additional wiring will be needed for the coil outputs. The Megasquirt box can be bolted on top of the Motronic case, or if your building MS in kit form, it's possible to put the MS circuit board into the old Motronic box.
| Pin | Connection |
| 1 | Spark output (unused for wasted spark) |
| 3 | Fuel pump relay- use an inline diode. |
| 4 | Idle control #3 (optional) |
| 6 | Tachometer signal |
| 16 | Injector bank 1 (1,3,5) |
| 17 | Injector bank 2 (2,4,6) |
| 18 | Permanent +12 (unused) |
| 22 | Idle control #1 (optional) |
| 23 | Oxy Heater relay - connect fuel pump relay output, with am inline diode. |
| 27 | +12v ignition |
| 28 | O2 Oxygen sensor signal (O2 ground is pin 10) |
| 36 | DME Relay - connect fuel pump relay output, with am inline diode. |
| 44 | Air Temp Sensor |
| 45 | coolant sensor |
| 47,48 | CPS (don't connect screen to ground!) |
| 52,53 | TPS signal |
| 2,14,19,24 | Ground |
DME & O2 Relays
The DME relay, and O2 relay (if used) need to be powered when the Engine/ECU is running. The simplest way to do this is connect the DME & O2 relays to megasquirts fuel pump output. In doing so I found that a strange chattering noise came from the relays when I switched off the ignition. To cure this, I added an inline diode to each of the three relays inputs. Tip: Also connect an LED (with resistor) as an indicator to the fuel pump output - it will help with diagnostics, should you run into difficulties.

## Wiring the Sensors

Throttle Position Sensor (TPS) The standard E30 TPS is of no use, as all this provides is a simple on-off-on state. I found a Bosch TPS (0280120406) which bolted stright on. I made up a new connector, which plugs into the original TPS socket. An e36 m/s 50 series TPS will work, however it will need simple custom bracketry as it does not bolt right up. Remember to set the lower, and upper throttle ranges into Megasquirt, so it knows when your foot is off and full on the peddle.
Air Intake Sensor (IAT)
Push the IAT into the bellows, where the Idle Control Valve used to sit. Use a jubilee clip to hold it in place. Use a multimeter or continuity tester to find the correct pin used on the Air Flow Meter connector, then connect it to the IAT sensor.
Coolant Sensor (CLT) The standard blue temperature sensor already fitted to the engine (Bosch NTC M12) will work. It has different properties to that of the default megasquirt settings, so they will need to be changed. You can use "EasyTherm" software to do this. using the settings in the table below.
| Deg C | Resistance |
| -15 | 12002 |
| 30 | 1707 |
| 100 | 187 |

## Wiring the Coil Pack

The coil pack used, was a Vauxhall Vectra/Omega V6. It has 3 coils with 6 outputs. Spark plugs are fired in pairs, on the ignition and exhaust stroke.
The M20 firing order is 1-5-3-6-2-4. The three Megasquirt outputs are A B & C
It's more convenient to install the coil pack closest to the bulkhead, so you need to reverse the plug leads so that the shortest is at the back, longest at the front.
I found a coil pack plug at a scrapyard, and used shielded 4-core cable from CPC Part:CB08732 to connect directly to Megasquirt.

## Wideband O2 Sensor

Ideally the wideband sensor needs welding into a section of the exhaust pipe that sees exhaust gases from all six cylinders. This may not be practical, without using two sensors. However, you can compromise, by just sensing the gases from 3 cylinders, and assume the other 3 cylinders are the same. This is not ideal, but better than doing without.
There are 3 relays next to the expansion tank (one may be missing). One of these (the missing one!) controls the O2 sensor (if fitted). The connector for this, is under the battery tray, and can be used to power the Wideband sensor. Cut off the connector (or find a suitable plug), and use the green & white wire. The Innovate LC-1 controller requires two separate earthing points. Attach one to the body of the car, and feed the other one through the bulkhead to the Motronic connector along with the output wires. You need to use Output 2 (brown) as this is configured from factory for wideband use.

## Vacuum tube

Use 3mm vacuum tube, with a T-piece between the intake manifold, and the fuel regulator.

## Tachometer

The tachometer requires a square wave signal from the Motronic ECU, so Megasquirt will need to supply that signal instead. Normally you would just use the ECU's coil output, but since we are using Wasted Spark, we need a different signal- one that signals every spark. Thankfully, Megasquirt-extra can provide the signal needed from one of its auxiliary outputs. All you need, is a couple of resistors, and a transistor. See Note: I have read of some people having difficulties getting this working with BMW's tachos. You may need to increase the resistor value that connects to 12V from 1K to anything up to 100K. I used a 10K resistor, and that worked fine.

## Tuning

It's best to start off with a fuel/spark map that is known to work for someone else with the same engine configuration. This is just to get you started, and not as a substitute for doing your own tuning. Before you go out on the road, you should at least make sure the engine will idle unassisted (see setting the idle). Now the fun starts.
With Autotune enabled, drive around to allow megatune to do it's job. The engine may feel rough at times, but the more you drive, the better it will get (assuming the Spark timings are not way-off). Remember to burn the table into the ECU before you switch off the engine, otherwise all will be lost.

## Setting the idle

The butterfly valve on the throttle body is normally fully closed. The idle stop screw needs to be adjusted, so the butterfly valve is slightly open. Getting the right adjustment requires trial and error (and a warmed up engine). You want the idle to be around 700rpm, and the MAP sensor to show the lowest possible value. However, I found that 700rpm idle was too low for cold starts, and set the idle a bit higher. Make sure the timing is set to 16 Degrees when idling (there is a setting that can override the timing to this when there is no throttle).
Be careful when turning the idle screw. Its probably never been moved since manufacture, and is easily broken (I know from experience!). Use penetrating oil first.

## Sources of reference

* MegasquirtnSpark-extra
* E30 Zone
* E30 Tech
* DIYEFI.co.uk (author of this write up)