MegaSpark Manual

Do-It-Yourself Computer Programmable
Ignition Advance Controller

 

Disclaimer: This system is experimental and is not for use in aircraft!


Controller

The controller box is the MegaSquirt EFI Hardware.   The MegaSpark was originally designed & tested on v2.2, but may work on other versions.  The software was designed to yield a fully functioning advance controller with no modifications to the MegaSquirt Hardware (beyond the normal MegaSquirt tach input experimenting).  Some options may require modifications or an additional daughter board.  Please refer to the above link and http://www.msefi.com/ for questions on purchasing and building the MegaSquirt hardware.

** Please do not post questions on vehicle installation, software, **
** tuning, or general MegaSpark inquires to the MegaSquirt sites! **

These sites can not provide MegaSpark specific help and are too heavily loaded as is!  Return here for help once the controller hardware is assembled.


Wiring

Wiring Diagram

Only 4 connections are required -

DB 37 Pin #

MegaSquirt usage

MegaSpark usage

28

+12 volts

+12 volts (switched)

1-19

ground

ground

24

"coil" input

input trigger

34,35

injector #2 output

spark output - triggers ignition module

These connections are *optional*  -

DB 37 Pin #

MegaSquirt usage

MegaSpark usage

20

MAT

MAT - for data logging

21

CLT

CLT - for data logging

22

TPS

TPS - for ported MAP simulation and data logging

23

O2

DIY WB O2 - for data logging

37

Fuel Pump

Activated Output #1

30

Fast Idle

Activated Output #2


Input Trigger

The MegaSpark is designed to operate with *one and only one* input trigger per spark.  This requirement can be satisfied in a variety of different ways.  The input source can come from the distributor (required to be locked), crank, cam, flywheel.  As with MegaSquirt, some experimenting maybe required depending on the sensor.  A clean input signal is an absolute must with MegaSpark!

** MegaSpark does NOT work with multi-toothed wheels!

I am using a Crank Trigger located on the backside of a solid steel front pulley (not harmonic) -
"Latching" Hall Effect, similar to Jameco #174043, +5V power
1/8" Rare-Earth Magnets, RadioShack #64-1895 - set flush in 1/8" holes in pulley back (no glue needed)
air gap is 1/8" - too small of an air gap can cause erratic operation on latching hall effects

Input Trigger Position

The input trigger must occur at least 5 crank degrees before the total desired advance (for 8K RPM, increase to 8 crank degrees before for 12K RPM).  Also, it must occur after the prior spark - this places a maximum on the degrees BTDC of the input trigger:

** THIS CHART IS FOR EVEN FIRE **
 

Configuration
# Cylinders

Max Input Trig
Crank BTDC
"Static Timing"

Crank
# Trig's
Degrees

Cam/Dizzy
# Trig's
Degrees

4-stroke 2
2-stroke 1

127.5

1/360

2/180

4-stroke 3

127.5

-

3/120

4-stroke 4
2-stroke 2

127.5

2/180

4/90

4-stroke 5

127.5

-

5/72

4-stroke 6
2-stroke 3

120

3/120

6/60

4-stroke 8
2-stroke 4

90

4/90

8/45

4-stroke 10
2-stroke 5

72

5/72

10/36

4-stroke 12
2-stroke 6

60

6/60

12/30

For Odd-Fire: The "Static Timing" must be less than the shorter spark interval.  For example, on a V-6 with 90 degree & 150 degree spark intervals, the input trigger must be closer than 90 crank degrees BTDC.  Also, each trigger must occur at the same degrees BTDC for each spark, so the spacing of the triggers must match the odd interval spacing of the sparks.  This means that engines that have an odd number of sparks per crank revolution, such as a 4-stroke 6 cylinder (3 sparks per rev), can not trigger off the crank.

When mounting a sensor, it is suggested to position it for an input trigger ~45 crank degrees BTDC.  This will allow up to 40 degrees total timing advance.  Note: the input trigger position is settable in the PC software (under the label of "static timing"), so it is not necessary to have an adjustable sensor mount (though for a hall effect, you should have the ability adjust the sensor/magnet air gap - I just use washers to shim the mount).  Nor do you have to try to achieve an exact 45 degree position.  Also note the position of the sensor relative to the TDC mark is not important - it is the position of the sensor relative to its' triggers.  In the diagram, I purposely put a funny angle between the TDC mark and Hall Effect sensor to empathize this point.  So you are free to position the sensor where ever it is easiest to mount.  However, you should verify that there will not be any problems in mounting triggers, such as might be caused by balance holes in the back of a crank pulley, before actually mounting the sensor.  You can position the sensor/triggers for a greater than 45 BTDC static timing as long as the limits above are not exceeded.  I am running 56.5 degrees, but smaller values of static timing are suggested for best timing accuracy at lower (idle) RPM's.  The spacing between the triggers needs to as accurate as possible.

When sensing triggers on the distributor or cam, remember that the distributor/cam degrees are 1/2 of the crank.  So with the crank @ TDC, a distributor/cam trigger 22.5 degrees from the sensor to be equal to 45 crank degrees.

The outside ring of Harmonic Balances are subject to vibration (kind of what they're designed to do),  so may not be the best location for mounting triggers.

Input Sensor Interfacing

Given that I have no knowledge of OEM sensors, I can not give you any specifics on connecting particular sensors.  Below are some possible interfaces, but you will have to resolve any problems.  I have checked Circuit #1 with a latching hall effect, but otherwise the circuits are untested... I can not promise that they will work.  Please note that the logic sense is important.  The uP sees the input trigger when U4 is turned ON.

#1, "Open Collector" - Hall Effects,  possibly some Opticals

Notes:
* Input trigger delivered when transistor (Hall Effect) is turned on
* +5V for Sensor - Hall Effects may have an internal regulator and accept power from 5-30V.  But considering the noisy nature of the +12V in autos and the importance of a clean input signal, its probably better to use clean +5V power.  JP1-8 is the hole next to "JP1" label.
* D5 -Wing - probably not needed, replace with a jumper if removed
* D8 - John - do not install, use jumper
* C12 - Ed - possibly not needed, leave open (don't jumper) if removed
* C11 (not shown) - possibility this may need to be removed, leave open (don't jumper) if removed
* XG1- don't jumper to XG2, instead use X11 - this prevents operation on stim unless stem pin #25 is connected to ground
* A "non-latching" Hall Effect usually requires a magnet with S-pole facing the sensor to turn it on.  A "latching" Hall Effect will also require magnets with opposite pole facing the sensor in between to turn it back off.  See Installation Procedure/Hints for help on determining which side of the magnet turns the Hall Effect on.

#2, Voltage Pulse - possibly some OEM sensor modules, maybe VR if positive crossing @ trigger

Notes:
* D5 -Wing - probably not needed, replace with a jumper if removed
* D8 - John - do not install, use jumper
* C12 - Ed - possibly not needed, leave open (don't jumper) if removed
* C11 (not shown) - possibility this may need to be removed, leave open (don't jumper) if removed

#3, Conventional Points

Notes:
* Disconnect points from coil!!!  Trigger is points opening - not closing.
* May need to disconnect condenser.
* R10 - removed and replace with jumper
* need external pull up resistor, can use removed R10
* D8 - John - do not install, use jumper
* C12 - Ed - may need to adjust value or possibly not needed, leave open (don't jumper) if removed
* C11 (not shown) - possibility this may need to be removed, leave open (don't jumper) if removed


Ignition Boxes

MegaSpark was developed and tested with a MSD 6AL.  I would think other MSD models would work, as well as other after market ignition boxes (Accel, Crane, etc.) that are designed to work with points but do not rely on the point input dwell.  I have no knowledge of OEM (or other) ignition boxes, I can not give you any specifics on connecting particular ignition boxes.  But the following info may help.  Beware of boxes that also control the ignition advance!

Warning: you assume all risk of destroying the ignition box and the MegaSpark!

MegaSpark's "Spark Out" INJ-2 Operation

Normal Operation - "Invert INJ-2" not checked

Prior to the spark, INJ-2 is held to ground.  At the time for the spark, INJ-2 opens (disconnects from ground and floats).  It remains open for 1/2 the period between sparks, then it is reconnected to ground.  So INJ-2 has a ~50% duty...  grounded half the time, open (floating) the other half.

Inverted Operation - "Invert INJ-2" checked

Prior to the spark, INJ-2 is open.  At the time for the spark, INJ-2 is connected to ground.  Rest same as Normal Operation.

Ignition Box Interfacing

I would suspect most boxes would take one of the inputs below.  A trouble shooting procedure for the box (as might be found in a service manual) could prove very helpful.  Look for instructions for "manually" causing the box to fire a spark, such as "touch input to ground" or "remove input from ground" or "connect input to +12V".

#1, Spark fires on input disconnected from ground

This how conventional points operate.  Connect INJ-2 to the ignition box input.  "Invert INJ-2" is unchecked.

#2, Spark fires on input connected to ground

Connect INJ-2 to the ignition box input.  Select the "Invert INJ-2" option.

#3, Spark fires when voltage is applied to the input

Connect INJ-2 to the ignition box input.  "Invert INJ-2" is unchecked.  Connect a "pull-up" resistor (something like 1K ohms 1/4 watt) to the ignition box input.  The other end of the resistor needs to tied to the appropriate voltage - might be +12V or +5V or some other value.  You'll have to figure out the correct voltage!  And if a different resistor is needed.

#4, Spark fires on  voltage pulse negative edge - possibly HEI

Same as #3, but "Invert INJ-2" is checked.


Installation Procedure/Hints

* Assemble/Test MegaSquirt according to MegaSquirt assembly instructions
* Use the MegaSpark's S19 Firmware Update to install the MegaSpark firmware
    - the "Boot" header H1 must be shorted (power off first) - or place a jumper across R6
    - set the COM number under the PC configurators Port menu selection
    - after updating, turn the power off and remove the H1/R6 jumper
    - once the MegaSpark S19 is loaded, shorting H1/R6 is not needed for further firmware updates
* Testing input sensor operation - bench or in vehicle
    - set Extra-LED option to "Input" & download settings
    - middle LED (MegaSquirt Warm-up LED) will light while the input is on (trigger is OFF->ON)
    - use this to figure out which magnet face turns on a Hall Effect - mark that side with a dab paint
* If possible, install MegaSpark with +12V, GND and input trigger only - don't connect ignition box.  Operate vehicle and verify MegaSpark is receiving a clean input signal (no RPM glitches on Realtime screen) and there are no CPU resets.
* When connecting MegaSpark to ignition box's point input, be sure to disconnect any other (magnetic) input.
* Make sure you have a good GND to avoid CPU reset problems!!!
* Dialing in the Static Timing
    - this is simpler if the desire timing calculated by MegaSpark is constant, to that end -
        - disconnect & plug any MAP input to the MegaSpark
        - insure the first RPM bin of the Ignition Base Timing is greater than the engine idle speed
        - Download settings if changed
    - with the engine idling, observe the timing with a timing light
    - note any difference compared to the Ignition value on the Realtime screen
    - increase/decrease the Static Timing value to advance/retard the observed timing
        - remember to Download settings after changing the Static Timing
    - repeat as needed until the observed timing matches the Ignition value on the Realtime screen
* Observe current limits (800mA) on activated outputs - use relay if current is too high.
* Sharing CLT and MAT sensors w/ MegaSquirt - R4 (for CLT), R7 (for MAT) must be removed from either MegaSpark or MegaSquirt.  TPS and EGO signals can be shared without any changes.
* When using an input sensor located in the distributor, the distributor must be "locked".  Otherwise, the distributor can be left as-is.


Software/Operation Hints

* Many settings can be changed with the Page-Up and Page-Down keys.
* Download is disabled until you Upload from controller or Load settings from a file
* Setting changes must be Downloaded to take effect
* Download and Upload are disabled while the Realtime screen is open
* Realtime Config allows picking colors & viewing/hiding sensors
* "Ign MSD" will be zero without the Timing Monitor Circuit (optional)
* "Ported MAP Emulation" allows feathering in of MAP Adjustment from an unported MAP source
* "Play File" allows play back of Data Logs.  Must exit & restart MegaSpark to get out of "Play File" mode.
* During "Play File", you can only scroll back to the beginning of the graph.  Must reload the file if you wish to see data that's already scrolled off.

LEDs

MegaSquirt

MegaSpark

Squirt

Spark - one flash per spark output

Warm-up

Rev Limit - on when rev limiter is operating

Accel

Software selectable -
Reset - flashes for 4 secs after power-up or CPU reset
Knock - knock retard (not yet implemented)
Input - mirrors input trigger state

Data Log Format

This information is for those who want to dig into the data logs.  The rate is 20 times a second, so there's 50ms between samples.  The rate is controlled by the uP and thus pretty accurate - allowing for analysis of change over time.  These are comma separated variable (.csv) text files.  Each individual variable is one byte represented in decimal.

1

secl

Seconds count, lo byte of 2-byte counter

2

engine

Bits flags - hi to lo
7 - rev limit active                3 - not used
6 - not used                         2 - not used
5 - knock detected              1 - not used
4 - input on T1CH0             0 - engine running

3,4,5,6,
7,8,9,10

map,mat,clt,tps,
batt,ego,ad6,ad7

Raw A/D values

11

rpm2

RPM / 50, rounded

12

kpa

map converted to KPa

13,14

rpm_hi,rpm_lo

RPM, rpm_hi * 256 + rpm_lo

15

coolant

clt converted to F + 40

16

loop_sec

Indicator of uP load, hi byte of 2-byte loops per second counter

17

maxsp

Indicator of maximum uP stack usage, 64 to 0 is 0% to 100%

18

afrwbo2

ego converted to AFR * 10, assuming DIY-WB O2 is connected

19

airtemp

mat converted to F + 40

20,21

ignition,
ign_msd

Ignition Advance Desired, Measured (Timing Monitor)
crank degrees * 2, "signed"
if var  < 192 then degrees = var / 2  ;positive, BTDC
else degrees = (256 - var) / 2  ;negative, ATDC

22,23

igncnt_hi,
igncnt_lo

16-bit delay from input trigger to spark, timer counts

24,25,26

ts1_diff_2,
ts1_diff_1,
ts1_diff_0

24-bit interval between input triggers, timer counts

27

coolant2

Ignore! My personal use.

28,29,30

bspot1,
bspot2,
bspot3

Blank spots 1,2,3 - undefined, ignore
Some firmware versions may put data here for debugging


If you have comments, suggestions, questions, etc., please go to
http://www.msefi.com/

http://autos.groups.yahoo.com/group/megaspark/

This page has been hit  times. Last updated 11/29/04