Wednesday, December 21, 2011

Second Baro

I've decided to add a second baro sensor for real-time baro correction.  I'm doing it for three reasons:

1) If I use "default baro" I don't compensate for both changes in the weather and altitude.  It'll change behavior (lean/rich) with high and low pressure weather systems.

2) I've found that if I use "initial MAP reading" I will occasionally get bad sample readings that effect the fueling for the entire drive until the car is restarted.  It will also change mixture slightly as I change elevation.

3) I just feel like it.

$18, shippped, from Mouser

Signal out, ground and power.  Vout, pin #1,  has a small notch in it.

Signal out to JP4. I epoxied it in place to prevent vibration damage.
 It works well.  My Baro correction factor will change from around 99.3 to 100.7 depending on the weather and the +/- 500ft elevation changes in my area.    The calibration of the sensor should be identical to the default sensor, it should give a correction of 100.0 at 100Kpa on the engine MAP sensor.  If it doesn't you can use the baro correction table.

Tuesday, November 22, 2011

Vss/Traction Control

I connected my Vss signal to the Nitrous In line.  Enabled it in the advanced tab and I have an accurate speed signal from the rear wheels.
BMW's have 9-tooth Vss senders in the differential

The Vss signal from the front was more difficult.  I tapped the ABS signal for my right, front wheel where the wiring comes through the fender in the engine bay.  The ABS VR signal has 2 wires; one of the wires is common to ground and can be ignored.  You need to tap the one that is not common to ground.  This signal will not drive the Megasquirt input directly, but needs to be amplified by a high-impedance circuit.  The ABS signal is so weak that too much additional load across the signal will result in an "ABS" warning light.

Fortunately, I already had a solution at hand:

Who knew?  My original Hall-to VR conversion board is excellent as an ABS VR signal conditioner! 
By removing a few biasing resistors I discovered that my VR conversion circuitry is excellent for converting the ABS signal into an amplified square wave.  What makes it work so well is that it has a charge pump that produces negative12 volts, allowing the OpAmp to efficiently detect voltages exactly at ground.  I can turn the wheel by hand very slowly and the circuit works accurately.  The LED lights  alternately flash with each new tooth.  Very handy!

So, I now have a Vss1 signal coming from the differential and Vss2 from right, front wheel.

I enabled traction control using the %slip method but found that I have a NASCAR problem; the traction control works great as long as I'm driving straight or making left-hand turns, but cuts power when I make right-hand turns as the inside wheel slows down.

Traction control sees the front slowing down and thinks the rear is slipping, so it cuts power.

Megasquirt integrates the % slip over time in .01 second increments so that 1% slip for .1 seconds becomes 10% slip.  2% slip for .2 second is 40%....

The instantaneous difference in wheel speed during a turn is only 1.2% so it shouldn't be triggering with the threshold set to 10 or 20%, so I think there is an error in the way that Megasquirt calculates the threshold, it seems to be using the integrated slip value and not instantaneous.

In a straight line, it works great.  I nailed the throttle on a wet, slippery hill and the car maintained traction all the way up.

Update, 12 Dec.  It was a coding error...  I got a code revision based on my feedback and installed it this weekend.  It fixed the cornering issue and traction control now works about how it should.  I got to work early this morning and found a large parking lot glazed from ice fog.  I nailed the throttle and the wheels maintained traction as the engine went "Bwaaap" from spark cut.

Traction control in action.  Timing gets pulled until the wheels stop spinning.

Monday, November 14, 2011


I've been using the USB cable for connecting the laptop, but I wanted to try a Bluetooth connection.  The idea is that a Serial to Bluetooth adapter plugged into the Megasquirt serial port will let you connect almost any Bluetooth wireless device, including my laptop.

Roving Networks WRL-08495.  Around $70
I found that the computer was relatively easy to configure.  Once the Bluetooth pairing was complete I steered Tuner Studio to the new port and it connected.

I practice, I found that using the Bluetooth link was more trouble than it was worth.  In particular, the link took more than a few seconds to establish.  10-20 seconds was typical.  Sometimes 30 seconds.  I couldn't turn the ignition on to change some settings and then start the engine without waiting for the link to re-establish. 

So, it's not what I need for now.  Eventually it will be great when I just want to monitor and log my drives but for now I've gone back to the USB cable. 

Once idea that would help tremendously would be to power the Bluetooth transmitter directly from the car battery, so the link was permanenly established and wouldn't be interuped when the car was started or turned off.

Friday, October 28, 2011

VANOS controlled by Megasquirt

My VANOS up until now has been controlled by standalone circuit which has worked well, but I've always planned on switching it to Megasquirt control.

The first step that is necessary is to upgrade to at least Alpha 11 because it has the VVT features that the current release doesn't have.

Since I already had Nitrous 1 driving my standalone circuit board, I reconfigured it to be my VVT output for Cam 1.

My first issue was that my duty cycle to hold the cam in position was close to 72%, which is twice the 35% I needed with my standalone board.  That was solved by modifying the flyback.

There's an issue with how the expansion board handles flyback.  It uses an active circuit to dump voltage through a transistor to ground.  It doesn't work...   After modifying the flyback path with a jumper to +12 the signal got better.  With Schottky diodes it got even more-better; cleaner and more efficient. 

All the diodes are tied together at their cathodes.  By connecting the cathode (striped end) to +12v where it enters the Megasquirt, the flyback energy has a direct path to dissipate.  Pad S12 is an ideal place to find +12v, I used a through-hole.  There are six diodes, four of them are visible here.. I replaced the original 1N4004 diodes with Schottky diodes, ON Semiconductor MBRS360BT3G.  DigiKey Part # MBRS360BT3GOSCT-ND.  They are $0.65 each.

Not too bad.  I like how the changes in duty cycle come in groups of 3 for changes in position.  Think of catching a faster car on the highway.. you'd have a blast of power to speed up a bunch, then idle to slow back down, then new steady-state throttle to match speed.

You can see the stiction here.  Cam takes more to get it unstuck than to keep it moving and once it stops it likes to stay stopped.

I updated to Alpha 15 a few days ago and have been constantly changing the P-I-D parameters to see where it runs best.  The Alpha 15 release has the additional option of selecting a control interval that is not synched to the cam.  With cam synch interval, the control interval changes with the rpms.  With a timed control interval it stays the same no matter what the engine speed.

Alpha 15 response.  Not that much better, but better.

Tuesday, October 25, 2011


This was very easy.  I connected a wire from Injector Bank 1 to the DISA ground pin.

DISA valve gets closed whenever rpm is below 3800 and there's some load.  It's not open at idle.
The DISA valve is very effective and adds about 10-15 ft-lbs of torque betwen 2500 and 3700 rpms.  In fact, I will be adding 5 more DISA valves to the intake in the future to make it extremely powerful!

Thursday, October 20, 2011

MS3X cam input adjustment

If you read the MS3 hardware manual it says this about setting up the MS3X VR conditioner circuit for Hall inputs:

"Turn both pots (R11 and R32) full anti-clockwise - approx five turns. Then turn the top one (R11) two turns clockwise."

I did exactly that and chased my tail until I finally discovered that my cam input wasn't working.  The problem was that my car ran great.. the oscilloscope showed that it was running full-sequential and the spark plugs and injectors were firing exactly when they were supposed to, except that the engine was only starting about 50% of the time. 

I attributed the starting problems to bad cranking and prime parameters.  If it was running full-sequential, how could it not have a good cam signal?

The answer is that it was polling the cam at start and always seeing a "0".  If the engine happened to be in that position it started and ran fine.  If it was NOT in that position, it didn't start until it fell into that phase.  Once it started it was full-sequential by happenstance.

Here's what I found when I took a closer look at the MS3X VR conditioner circuit:

The VR conditioner circuit.

Input is a 0 to 5v square wave.  After it goes through transistor Q2 it becomes a 1 to 4V square wave.  Arrows show circuit test points.

This is the resulting signal and the threshold at the comparator (OpAmp U7A).  With R11 turned twice clockwise, the threshold isn't sufficient to trigger the output.

R11 turned 3 1/2 turns clockwise.  Threshold is now high enough to trigger and the output becomes correct.  The minimum turns on R11 for the threshold to trip was about 2 3/4.
The bottom line is that you should turn R11 clockwise until you have 2 volts on pin 3 of U7A

U7A pin 3.  R11 sets the threshold voltage on this pin, should be around 2 volts.

Thursday, October 13, 2011

MAT correction

I've been driving back and forth to work running VE Analyzer each way.  I've noticed that my table looks different after driving in the cold morning air compared to the corrections I get driving home in warmer air.  Ideally it would be the same no matter what the temperature is.  I need to work on my MAT correction!

The amount of fuel injected is influenced by the Ideal Gas Law which is proportional to temperature in degrees Kelvin.

So if 50F = 283 Kelvin and 80F= 299 Kelvin then Megasquirt would want to inject 283/299 or about 6 1/2% less gas at the warmer temps.

Problem is, What seems great in theory isn't exactly what's happening in the engine and Megasquirt seems to over correct and run too lean at warmer temps.

There are 3 tools to correct that:

MAT correction table applies a straight % correction based entirely on the temperature.  It adds a little gas back at warm temps were the ideal gas law takes it away.
MAT scaling determines how much of the ideal gas law calculation to use.  In the above example between 50F and and 80F, the full idea gas law correction is 6 1/2 percent.  With scaling set to 70% the correction is reduced to .7x 6.5%= 4.5%. 

MAP/CLT blend attempts to correct for the fact that at lower rpms the air is moving slower and has more time to be heated by the motor.  It ignores load.   In this chart at 1000rpm it is using 3% of the coolant value and 97% of the MAT value.  If CLT is 180F and MAT is 80F it would use a MAT value of 83F (.97x80)+(.03x180)

Monday, October 10, 2011

Working on a reliable start

There's only a few variables that can be changed for starting and a majority of them I've been able to copy from the OEM ECU.  Spark advance and dwell are easy.  Priming pulsewidth is relatively easy.  What's been kicking my arse is the cranking PW.  In order to make some sense of when it starts and when it doesn't start, I've been logging each start with the CLT temp, and cranking pulsewidth and putting it in the "Yes" or "No" category if it starts on the first try.

EDIT:  At the time the graph was discouraging because it made it look like starting was a 50-50 affair.  In retrospect, it really was a 50-50 affair because the cam signal wasn't working.  If the motor was in the right phase it started and ran great, if it was in the wrong phase it just didn't start...  It was 50-50.  When it did start, it ran full-sequential which made me think the cam signal was fine.

It was never a starting problem, it was a comparator threshold voltage problem.

EDIT, Dec 2011.  My remaining starting issue was caused by the fact that my starting circuit transistor was losing biasing under low-battery conditions, mainly when it was cold.  Since I re-build that little circuit it's started 100% of the time on the first crank!

Wednesday, October 5, 2011

Closed-loop idle

This has taken me a while to figure-out, and I still don't understand how Megasquirt does PID for closed-loop idle.  Here's how mine looks at the moment.

Here are some thoughts on the different fields:

Idle Open Duty % and Idle Closed Duty %.  These set the limit for how high and how low the code will let the duty cycle go.  It will never let the IAC valve move past either value.  It also uses the difference between the two values as a scaling function, so 50-20 will scale and respond differently than 20-90, even though your valve may never go beyond 50%.

Closed Loop PID Gains.  "I" has the most effect on steady-state error, "P" effects how quick it responds.  "D" should prevent overshoot.  These don't always work that way.  I also found that setting idle response when the motor is warm will lead to oscillations when the motor is cold.  It needs to be stable for both!

Min Duty for PID%  This is supposed to be the closed position of the valve, but I don't understand the difference between this and Idle Closed Duty %.   I think it will not go below whichever one is higher of the two so what's the point?

RPM with valve open/closed.  This has little to do with RPMs with the valve closed or open; this should just be galled "Gain".  With a smaller difference between the RPMs the Gain will be higher.  The lower number needs be less than your idle by a few hundred, the higher number higher than idle.  That's it.

PID control interval.  The biggest problem I have with tuning the PID is steady-state error.  I think some of that has to do with the choice of control interval.  The conventional wisdom is that "faster is better", but classic control theory says you shouldn't sample more than about 1/10 - 1/20 of the settling time.  The engine doesn't respond that quickly and if it ramps in 2 seconds and settles in 4 that would give a 200ms sampling time, at the very minimum.  I think lower sampling times just increase the error due to rounding and lack of resolution in integer variables.  With sampling below 80ms, I had terrible steady-state error and could never get idle within 100rpms of target without dramatically increasing I which caused instability.

With 300ms sampling time, I find that idle is better overall with no negative effects.  My idle reaches the target, it has slight overshoot and nice response time.  It's very liveable for day-to-day driving.

EDIT: Since this post I have upgraded to Alpha 14 code, which has revised and more functional PID code. 

Monday, October 3, 2011

On static timing, Hall and VR.

I had the static timing set at 324 degrees which is the middle of the 54th tooth after tooth #1.  That worked well and I didn't think it was very far off but I still wanted to verify with a timing light to make it more-better.

A note on timing lights and the M54:  The TDC mark is on the damper which is difficult to see from the top of the engine.  I would remove the engine-driven fan and the radiator shroud to make it easier.  Mark the TDC line on the damper with some yellow paint or anything to make it more visible.  Do the same with the reference mark on the block.  I was able to see the timing marks with the timing light easily by using an inspection mirror held behind the radiator.  Shine the timing light down at the mirror, the light will reflect 90 degrees into the damper.  My mirror had a diameter of about 2 inches.

I used an "old-fashion" timing light that did not have the adjustable advance knob- I just don't trust those.  I used one that only triggered at the spark with advance set to 0 degrees.

Result:  I found that my true TDC was 325.7;  1.7 degrees more retard.

A possible explanation is that I am using a VR sensor which reads the middle of the tooth, but the M54 crank-mounted sensor wheel is designed for a Hall sensor which reads the edge of the tooth.  The distance from the middle to the edge of a tooth is 1.5 degrees so my error makes sense.  I've always thought Hall reads the leading edge, but this would seem to indicate that Hall reads the trailing edge.  Dunno..

324 degrees is the theoretical setting.
My measured VR sensor setting is 325.7

Gurov has a Hall sensor and his measurement is 325 degrees.

On an M50, the tooth wheel is already made for VR so I would think 324 is correct but check with a timing light.

Starting fuel

I spent the weekend with the stock ECU measuring the prime and cranking pulsewidths for different temperatures.  I started with a hot, running  engine and pulled the fuel pump fuse and until it stalled, then pulled all 6 COP plugs to keep it from starting.

I recorded the block temperature and scoped the injector signal for 8 seconds of cranking.  The raw data looks like this:

Raw PW of prime and cranking PW vs temperature.
Of course, the above figures need to be adjusted for the injector dead time at about 10 volts, so subtract 1 second for true pulsewidth.

My thought was that it would be easy to translate this into Megasquirt and I would have a car that starts just like stock.. set the cranking ign to 0 BTDC, prime and crank like OEM and Blammo! I would have an engine that starts like stock. 

The problem is that the OEM ECU doesn't inject a constant cranking PW like Megasquirt does.

Cranking fuel decreases with the cranking time.  Which to use for Megasquirt??
About the best I can hope to do with this is plot the data and look at the general shape of the curves.  Increase of fuel vs temperature is relatively linear down to 85 degrees, at colder temps it starts increasing quickly.  Tuning Megasquirt for start is still a matter of increasing cranking fuel until it consistently starts.

OEM fuel curves for start.  Prime, first injection event and the 5th injection.  This data has 1 second subtracted for injector latency.
My current cranking fuel.  I will certainly tweak it but it's Ok so far.

Thursday, September 29, 2011

Thermistor calibration tables

I removed my MAT sensor and checked the calibration, which improved the indicated air temperature accuracy.  That also made a small difference in the A/F ratios.  I had replaced my M54 MAT with an M50 MAT for the OBD1 conversion but I've forgotten if I did the same with the coolant sensor...

Tuesday, September 27, 2011

VANOS integrated and working

The M54 has dual, variable-VANOS and I got it working nicely with Megasquirt.

Not the way you would think, I don't have it working natively through the Megasquirt (that's still in development) but I have it working through my own VANOS controller. 

Remember, this is a temporary solution until I started using the integrated VANOS control that is now part of the Megasquirt code.

Seattle Circuit VANOS control board

The board operates 90% independentally from the ECU and only needs one signal from the ECU to operate.  It also shares the TPS, Crank and Intake Cam signals.

The VANOS enable signal was originally the On/Off VANOS signal from the 413 ECU.  The 413 triggered the intake cam advance whenever load was above about 20% and the coolant was warm enough.  Advancing the intake cam at colder temperatures causes the engine to stumble and just run poorly.  It needs to be warm.

While the VANOS control board can handle calculating the load factors, it doesn't have the CLT sensor signal.  Easier to rely on the ECU for that.

Configuring the proper trigger in Megasquirt was easy. 

Nitrous 1 configured as the VANOS enable signal

Friday, September 23, 2011

Tachometer output

Added the internal jumper I need to get the tachometer working.

Connect JS11 with SPR4 (pin 6 on DB37)

Turned Tacho on through SPR4 and my tach works great!

more stock ECU measurements

It's quick and easy to get data off the stock ECU. 

Cranking spark very close to TDC.  Dwell at 6.5ms.

This is spark #1 cylinder vs crank position on the stock ECU.  TDC is 324 degrees after tooth #1.  The middle of the tooth is where the trace is going down through zero.  Spark is 3 teeth ahead, or 18 degrees BTDC.

I set idle to 18 degrees BTDC on the Megasquirt and compared the O-scope plot to the stock above.  THEY MATCHED EXACTLY!

This is interesting... injector #1 cylinder vs crank.  Idle fuel is injected 525 degrees BTDC.  It's injected near the bottom of the power stroke and sits on the closed intake valve for about 150 degrees before it opens. 

Wednesday, September 21, 2011

Adjusting VR bias and getting a nice idle

I got the motor idling and starting nicely.  Cranking advance changed to 8 degrees, cranking pulsewidth changed so that I got 8ms, same as what I measured on the stock ECU.  Adjusted idle VE slightly and it was starting and idling very nicely!   ...and it's not even closed loop yet.

Problem is that when I blipped the throttle it would bog and die.  Three or Four times in a row...  I changed the dashboard to show lost synchs and saw that the count was going up right as it was stalling.  I had a VR sensor problem.

This is where I discovered how powerful Megalog Viewer can be.  I logged one of the stalls and got this plot:

The very top line is RPM.  Right as I blip the throttle the RPM dips to zero but then instantly recovers.   Due to noise, I guess, but not sure why I was getting noise from blipping the throttle.  Anyway,  I was getting a lost synch reason 2.  Missing tooth out of sequence.  The reason it was stalling wasn't because of the lost synch, but because going to zero RPMs and back up was triggering After Start Enrichment (ASE) which you can see where the blue line goes up.  The ECU saw the rise from 0 to 750 rpms as a start and increased fuel!

I adjusted the R52 bias screw 3 1/2 turns to the right from full-left and tried again.  Revs nicely now and no synch drops!

O-scope of the VR conditioner with car idling.  The zero-crossing down looks great, but why is the ouput returning to ground at a negative voltage?  Isn't the hysteresis bias on the (+) OpAmp pin??

I took the Megasquirt back in my shop and ran the signal generator through the VR input.  The first thing I noticed is that R52 and R56 don't behave the way I expected.  That is, after turning both 6 turns to the left to ensure that they were on the stops it took around 3-4 turns clockwise on either one of them to get anything to happen.  I adjusted them so I have a good hysteresis margin, but not so much that a 4v peak-to-peak cranking signal would keep the car from starting.   The conditioner trips at about +1 volts and - 1/2 volts, well within the margin of a cranking signal but well above any noise (I hope)

This is only 40Hz and a few volts peak-to-peak.  The actual VR signal is near vertical at the threshold points.
Mystery of the negative voltages solved... this is a scope of an input signal and the output of the first stage of the VR conditioner.  The transistor biases the voltage of the input up by about 1.2 volts.  This is why a negative input voltage was tripping the zero crossing detector.. it was at zero volts by the time it got to the comparator.
I also found that the behavior of the hysteresis pot, R52, is very non-linear.  The first 3 turns did almost nothing to hysteresis.  Turn 4 starting increasing it.  Turn 5 started increasing it quickly.  After turn 6 it started to go off the chart very quickly.
The bottom line

I would take both R52 and R56 and turn them to the left about 10x to get them set to zero.  Leave R56 alone.  Turn R52 5x to the right.

The motor starts and revs with ZERO lost synch counts now.

Tuesday, September 20, 2011

Stock engine measurements

In an effort to make the car run like stock, I need to know what stock looks like.  (plus if I don't document it here I'll loose my scribbles..)

Stock priming pulse 12ms at 110F
Stock injector cranking  PW time for a 170F warm car is 18.0ms***
Stock injector on time at idle for a 170F warm car is 2.1ms

Those values are measured with an O-scope off an injector, so taking the .62ms dead time in account the actual opening times would be 1.5ms and 17.38ms.

***Cranking PW seems to taper-down with the number of cranking injection cycles.  First two are 18, then 15, then 12 and after it's been cranking for a while it's 10ms.  I will need to look at this some more, because even at the same temperature it changes by 2ms from the first measurement to the second.

cranking IAC PWM , all temperatures   50%

cranking ignition advance.                      0 degrees BTDC

idle IAC   PWM      cool, 80F              36%
idle IAC   PWM      warm, 170F          34%

Now I won't loose it.

Siemens DEKA injector latency/dead time

Nick Glantzis from Technique Tuning was nice enough to share the factory ECU injector latency chart for the stock Siemens DEKA injector on the M54b30.   Crunching them results in .620ms at 13.2 volts.  I thought that was very fast for a factory injector.

I believe in "Trust but Verify", so I sent one for lab testing and the results were different.  1.08ms at 13.2 volts, a more typical value.

I will be using these values.  1.08 ms at 13.2 volts

The 3-wire ICV

MS3 has native support for 3-wire ICV's, so no more conversion circuits.  I had my motor started and idling, but the idle was horribly unstable and oscillating like crazy.  I activated the "Test Idle Valve" feature and reduced the PWM all the way down to 0% but it was still idling like it had a massive vacuum leak. 

I physically pinched the ICV hose and the idle fell to acceptable levels.  Then stalled..

I had an ICV control problem, I only had control on the "open ICV" wire so I couldn't get below 50%.

After continuity checks and more trouble shooting, I finally figured-out that I had the port for the second idle wire wrongly configured.  Chris' wiring chart has it running through the VVT pin (why?) but I had the wire configured for the IDLE pin.

Once I got that straightened-out I found that the motor idled nicely at around 40% on the ICV.

It runs!

I plugged the Megasquirt 3 into my car, powered it up and didn't get any smoke.  That's a good start!  All of the sensors indicated normally.  Coolant temp, MAP, etc.   Calibrated the throttle idle and WOT positions.

Removed the fuel pump relay and cranked the car to check rpm and synch.  Nothing...

Checking the crank sensor input to the Megasquirt.  Polarity is correct.. looks good.

I connected some more wires inside the Megasquirt case to check the output of the VR conditioner against the input signal.  The VR conditioner has two pots that adjust the trigger level and the hysteresis.  If the trigger level on R56 is too high it will never trip.
Trigger level and hysteresis.  Picture by

After adjusting R56 to the left I tried again and got a nice scope picture.

Yellow is the sensor input and blue is the VR conditioner ouput.  Looks consistent, no noise.  VR signal is only 5v peak-to-peak but this was while cranking.  I'm using 10x probes.

While cranking to get his picture, the motor kept trying to start even though the fuel pump relay was removed.  It was catching on residual fuel.

I re-installed the fuel pump relay, removed some of the crap from the top of the engine and cranked. 

It started... and fell into a high galloping idle.

Monday, September 19, 2011

Wiring the harness adapter

I finished wiring the harness adapter this weekend.  My goal was to make this plug compatible with my existing harness so I could swap the Megasquirt in and out as I felt like it.  Keeps the project from being an "all or nothing" conversion.

The covers are removed left and right, exposing the fuel injector drivers on the left and the 6 coil drivers on the right. 
Once the circuit card is removed, the injector drivers can be harvested easily by using a heat gun on the back of the board.  Heat the back of the board while gently tugging on the driver.  It will pull out when the solder softens.

Remove 88 pin connector with the heat gun, or carefully clip each lead.  The 88-pin attaches to the rail from the bottom with Torx screws.  Notice that the coil driver rail has an insulating cover.

The coil drivers clip back into place on the rail.  Here I've wired the output to the 88-pin and the grounds are tied together.  I use de-solder wick for the ground.  The power-on circuit is on the left.

The power on circuit (credit to Goat Thumper).  The transistor uses power from Ign to switch the main relay on.  I couldn't find a 2n2222a at Fry's so I used a generic NPN low power transistor.  I measured total current through the coil and transistor at 100mA.  If the transistor has .6v of voltage drop it dissipates .06 Watts, so don't worry about the heat.  The resistor limits current through the base, the diode is flyback from the relay coil.  The capacitor keeps small glitches in IGN power from resetting the ECU.
UPDATE (27 Nov 2011):  I finally solved my remaining starting problems by identifying a fault with my power-on circuit.  The symptom was that in colder weather the motor would never fire on the first attempt, or it wouldn't fire at all.  It was totally sporadic and difficult to identify, but what was happening is that the cold reduced my battery voltage sufficiently so that cranking caused enough of a voltage drop that the transistor no longer had enough current through the resistor to keep it saturated.  IT WAS TURNING OFF THE MEGASQUIRT!   I solved the problem by reducing the resistance on my 7.5kOhm resistor to match my transistor.  If you stick with the 2n2222a as specified you'll be fine.  I need a new battery, too!



Added the wiring for the main connector.  I used the 18" labeled wires from DIYautotune.  Only 1/2 of the labels matched because it was meant for bank injection, but it's still nice having different  wire colors.  I cut 10mm off the bar on the right to route the wires out the same direction that the 88-pin connector wires go.
Wiring for M3X plug added.  I used the stock DB37 solder cup connectors but if I did this again I would use crimp connection DB37 connectors.  Also added cable retention clamp where the bundle exits the case.
Done for now.  When I'm sure that I won't need to re-arrange or add wires I'll add a conduit for the wires.

 Chris didn't screw this up too bad, so I followed his wiring guide.  Since I didn't mount the power-on circuit on the Megaquirt proto area, I didn't use the two connections that I crossed out.  (credit to Chris Seigman.. he has some great info at

A note about grounds- they're not all the same.  Just because your 88-pin plug connection is labeled "ground" doesn't mean it's a ground.  Some are grounded to, well, ground and some are the ground connection for a sensor.  You can't connect a Megasquirt ground to a sensor ground, it needs to connect to the chassis.  Know the difference.  Pins 6, 28, 34, 53 and 87 connect to the chassis.  Of those, pins 6, 28 and 55 are on a larger pin with more capacity.

Bosch coil driver.  These are bullet-proof and you save $48.00 for 6 over purchasing BIP337s.