How to MegaSquirt Your BMW E30 325i and Other M20/M30 Applications

Using the crank trigger

Updated 6/1/2018

Check out our out of the box plug & play solution for 87-92 BMW E30 325i, ready to plug into your factory harness!  Typical installation takes around an hour.  Or, for those looking to go a more DIY route, here’s how to make it work:

Application(s): This article covers the 1987 through 1992 E30 chassis BMW 325i with the M20B25 motor. (Note: In 1992, the convertable was an E30 chassis, while all other models had migrated to the E36 chassis and the newer M50 engine.  For everything else, the E30 stopped after 1991.) The same mods and ignition settings apply to other M20B25 cars like the ’89-’90 525, as well as to some M30 and S38 powered cars, including the ’89-93 535, ’91-’93 M5, and ’88-’92 735.  Using this on the earlier 325e eta motor (M20B27) or other early M20, M30, or S38 versions with flywheel speed sensors will require swapping in the crank trigger assembly from the later engines.  It reportedly bolts right up.

Level of control:  Full Standalone EMS– Fuel and Ignition Control

There have been several ways to install MegaSquirt on these engines, but most users favor MS2/Extra.  MS3 adds the possibility of sequential fuel injection, but to make this feature work requires modifying the distributor for a one tooth cam sensor. Note: For a different approach, see our DIYPNP plug in ECU – we have an installation guide for how to use it on the 325.

ECU Modifications

On these engines, you can use any of the current MegaSquirt variants – I, II, or III. We recommend the V3.0 board if building one yourself, or the V3.57 if buying one ready made. Most of the installations currently out there are using MS2/Extra. We’ll include notes on MS3 as well, although using an MS3 to its full capability will require an extra cam sensor added.

Driving the factory coil will require a BIP373 transistor, sold separately.

Using the MS-II PCBv3 or V3.57 ECU

with MS2/Extra 2.0.1 or later code

  • Build the ECU up to trigger from the VR Input. Jumper TachSelect to VRIN and TSEL to VROUT.
  • We will also need a high current driver output. There are several ways to do this – you can use either JS10 or D14 as the spark output. If you are using D14 – this is recommended usually as it can make going distributorless later a bit more easy – you’ll want to take a 330 ohm resistor, solder it to a length of wire, and wrap the resistor with heat shrink. Run this wire from IGBTIN to the top of R26 (for a V3.0 board) or U1 pin 7 (for a V3.57).
  • Solder a BIP373 in the Q16 slot, using a mica insulator.
  • If you have a V3.0 board, jumper IGBTOUT to IGN.
  • There are several options for idle control; see below.

That’s it!



Using the MS-III PCB V3.0 or V3.57 ECU

And the MS3X expansion board

  • Set up the ECU up to trigger from the VR Input. Jumper TachSelect to VRIN and TSEL to VROUT for a V3.0. For a V3.57, set the JP1 jumper on the main board to the 1-2 position, and set J1 to the 3-4 position.
  • Use the MS3X pull up jumper for the cam sensor pull up (JP7).
  • On a V3.0, the easiest way to get idle control is to use the PWM IAC driver on the MS3X board. If you wish to use the main board IAC driver, you’ll need to install a TIP120 mod kit – see the MK-PWMIAC catalog page for details.

There are two ways to control the coil. If using an MSD box, you can use the MS3X tach output to control the coil by connecting the tach output to the MSD white wire. Alternatively, you can use a built in high current coil driver:

  • Connect JS10 to IGBTIN (if there are any wires connected to JS10, remove them.)
  • Solder a BIP373 in the Q16 slot, using a mica insulator.
  • If you have a V3.0 board, jumper IGBTOUT to IGN.

That’s it!


Connect the crankshaft position sensor to pin 24 and a ground pin. Note that many of these sensors need a 10K resistor inline with the wire to pin 24 to avoid having the crank signal break up at high RPM.

Connect the coil negative terminal to pin 36 (unless using the MS3X tach output to drive an MSD box, in which case you will wire the MS3X tach output to the MSD white wire).

Idle Air Control

These engines use a pulse width modulated (PWM) idle air control motor. A V3.57 board (or MS3X) can control this directly with no additional mods. With a V3.0 board, you will need to add our PWM idle control mod kit to control this valve. For an MS2, connect this output to the opening coil and connect the closing coil to ground through a 30 ohm 50 watt resistor. The MS3X can use the MS3X IDLE output for the closing coil.

Other Things the ECU Controls

The stock ECU controls a couple other devices in these cars besides the injectors, ignition, and IAC valve. Here’s what to do about the ones you will need to control.

Fuel pump: This is a standard output on the Megasquirt. Wire the Megasquirt main board pin 37 to the fuel pump relay wire that went to the stock ECU.

Air conditioning: The air conditioning operates separately from the ECU. The ECU does get a 12 volt signal which can be used for idle up input. For an MS3, connect this to the MS3X nitrous output if you wish to use this feature.

Gauges: The tach is sometimes ECU driven – this seems to depend on production year. The MS3 can run the tach through the MS3X tach output (if using this to drive an MSD box, wire the tach to the MSD tach output). For an MS2, connect the tach to pin 25 if you have installed the stepper IAC circuit, and set the tach output to IAC1.

TunerStudio Configuration for MS3 or MS2/Extra

Set the following under Tach Input / Ignition Settings.

  • Spark mode: Toothed Wheel
  • Trigger Angle / Offset: 0
  • Ignition Input Capture: Falling Edge
  • Spark Output: Going High  It is critical to get the Spark Output Inverted setting correct, as setting this wrong can result in damage to the ignition module or coil.
  • Number of coils: Single Coil
  • Spark A output pin: D14 (MS2 with spark output on D14 circuit) or JS10 (MS3)

Dwell settings will depend on the coil used; 2.5 to 3.0 msec is a safe starting point.  A typical rule of thumb is to back off the dwell until you can just barely detect a misfire under lean cruising conditions, then add 0.2 ms of dwell time.

Use these trigger wheel settings.

  • Trigger wheel arrangement: Single Wheel with Missing Teeth
  • Trigger wheel teeth: 60
  • Missing teeth: 2
  • Tooth #1 Angle: 97 (this may need to be adjusted slightly due to production tolerances)
  • Wheel speed: Crank Wheel

If you use someone else’s .msq file we do recommend you check the firmware version the .msq file was built on as you cannot always use a file built on one firmware version with an ECU running a different version or a different ignition setup– it’s best to use the .msq files with the same version of the firmware that the file was built on.  Alternately you can manually copy the settings over from the borrowed file.

Going distributorless?

Yes, you can use these input mods for a crank triggered distributorless ignition, with different hardware mods. Software changes are minimal: set Number of Coils to Wasted Spark in MS2/Extra. You will keep the same ignition input mods, but the output mods will be different The mods needed will depend on the coils you’re using. For example, these mods will work if using BIP373s to drive a coil without built in ignitors.

The MS3X has no need of mods for distributorless ignition. Instead, you can wire the MS3X spark outputs A through C (wasted spark) or A through F (coil on plug) to an ignition module or coils with built in ignitors, like LS1 coils or our IGN-1A race coils. Sequential coil on plug requires a cam sensor, but you can run wasted-COP mode without one.

Hardware mods for distributorless ignition (MS2):

  • Jumper IGBTOUT to IGN to send to IGBT ignition coil driver signal out of pin 36 on the DB37. (not needed on a V3.57)
  • Cut out R57 if fitted (This won’t be there on my units, though.).

Now for constructing the outputs…

  • Get a 330 ohm 1/4w resistor and cut the leads down to about 1/2″ at each end. Maybe a bit less.
  • Tin each end of the resistor with a bit of solder.
  • Cut a 5″ piece of hookup wire (22ga is fine) and strip just a 1/8″ or so. Tin the stripped wire with solder.
  • Melt the tinned wire tip to one end of the tinned 330 ohm resistor tip and let it cool.
  • msnse_led17-d14_thru_vb921005
  • Heatshrink wrap this wire/resistor assembly.
  • msnse_led17-d14_thru_vb921007
  • Use this wire/resistor combo to jumper the ‘top’ (top as in when you facing the silkscreen side of the PCB, with the text so that you can read it normally) lead of R26 to IGBTIN on the opposite side of the PCB. (On a V3.57, this is kind of tricky. It’s easier to use pin 7 on the U1 socket instead.)
  • msnse_led17-d14_thru_vb921011
  • Now, you will be constructing two duplicates of this BIP373 circuit for spark outputs B and C. You can mount the additional BIP373s on a second heat sink stacked on top of the first, attached on top with long screws. Or you can mount the BIP373s to the case.
  • Each BIP373 will need a resistor-on-a-wire assembly, running to its left leg. You will get the BIP373 input signal from the following locations:
OutputInput Location (V3.0)Input Location (V3.57)
Spark ATop of R26U1 pin 7
Spark BTop of R29U1 pin 8
Spark CTop of R27U1 pin 9
  • The center leg of the BIP373 is its spark output. We have found that the IAC traces can carry enough current for normal use, so you can use one IAC trace for each spark output. You may need to add an extra connector with the V3.0 on 12 cylinder applications, or if you are running a stepper IAC.  You can use this pinout if you are not running a stepper IAC or using the stepper IAC outputs for fans / VRIS.
OutputBoard connectionDB37 pin
Spark AIGN36
Spark BIAC2B31
Spark CIAC2A29
  • Connect the right leg of each BIP373 to a ground, such as the proto area ground or SG pins. It’s best if you can find a separate ground for each BIP373.
  • Connect the negative terminals of the coil to the pins specified in the above pinout.

Enable dwell control and adjust as needed to match the coils you are using. Set the dwell at a very low value to start with (we’ve found Ford EDIS coils have especially short dwell times) and increase it slowly. Back it off if the BIP373s become hot to the touch.



Sequential injection

The stock sensors on an E30 do not support sequential injection, but you could modify the distributor to add a 1 tooth cam trigger to add this feature when using MS3. You will need to change the trigger wheel setting to Dual Wheel with Missing Teeth. Note that you may need to add 360 degrees to the Tooth #1 Angle setting if adding a cam sensor.

Suggested parts

On these motors, you can use a MegaSquirt II or III, although the MegaSquirt-II has the edge. We recommend using a GM open element IAT sensor and removing the air flow meter.

ECU options:

Mod kits discussed in this article:

  • MK-BIP373 for spark output – 1 required for stock distributor ignition, 3 required for wasted spark
  • MK-PWMIAC for idle speed control with a V3.0 board (not needed for a V3.57)

Other recommended parts



Feedback welcome

If you have any further information, contributions, or questions about this article, please contact us.