The Windows 9x/ME/XP/Vista software application you use to tune and configure your MegaSquirt® or MegaSquirt-II is called MegaTune by Eric Fahlgren. (Version 2.25 or higher is needed to work with MegaSquirt-II). You also need Windows 9x/Me/XP on a computer (a laptop or notebook computer if you want to tune in the car) and a conventional serial port to communicate with MegaSquirt-II. A USB/serial converter may work, and many people have reported that they have been successful using a USB-serial adapter. Just about any computer that is capable of booting Windows 95 (or better) will be fast enough, but get the fastest laptop computer you think is reasonably priced, obviously. This document covers the use of the 2.8 versions of embedded software (aka. "code") on MegaSquirt-II.
Note that for 2.88 Code, the first thing you must do after loading code is set the ECU Type (under 'Fuel Set-Up/General') to match your hardware (MS-IITM or MicroSquirtTM controller), MegaTune will not let you change anything else until you do this. Do not change settings, expect the stimulator to work, load an MSQ, etc., until you have set the ECU Type (MS-II = 1, MicroSquirt = 2, the MS-II Sequencer will be 3). This setting applies to MS-II derivatives with code 2.88 or higher code only.
ECU Type setting was inserted to head off the potential MicroSquirtTM problems due to the coils being turned on with the old default configuration. As of the 2.88 code, if ECU Type is not set, the code will put the ignition outputs in a safe state (cycling the tach display from 0 to 8000 rpm, and also flashing the fuel pump LED) and wait until a known ECU type is put in by the user.
| Introduction to MegaTune | Installation | File | Fuel Set-Up |
| Ignition Set-Up | Basic Tables 'Basic Tables' are displayed as 12x12 'spreadsheets' to allow easy viewing of the numbers in the tables. This is best for setting up the tables. For tuning the tables in the vehicle or on a dyno, see the 'Tuning' menu item. These can be indexed to MAP or MAP/Baro.
|
Basic Tables
These can be indexed to MAP or MAP/Baro.
|
Basic Tables
This can be indexed to MAP or MAP/Baro.
|
| Other Tables | Tuning
Tuning offers a 3-D view of the table a a number of gauges simultaneously, so is a good place to be when actually tuning. |
X-Tau Tuning | Other Tuning |
| Communications | Tools | Help | |
MegaTune2.25+ is MegaSquirt® configuration editor software for Windows 95 (and later). It is written by Eric Fahlgren, and it used for the MegaSquirt® and MegaSquirt-II EFI controller. It allows all of the tuning and set-up parameters to be modified and has a real-time VE table editor, which allow a vehicle passenger to tune the engine while driving.
General Advice and Operation Some general principles to follow when setting the configuration parameters are:
Note that it is possible to damage your engine by choosing inappropriate tuning or set-up parameters in MegaTune. Be sure to read this document, and all associated tuning documents that apply to your engine, vehicle, and tuning circumstances. In particular, read the safety precautions.
Information on tuning using MegaTune with MegaSquirt® or MegaSquirt-II is listed separately from this section, and depends on the processor you have.
MegaTune has an 'automated' install package, similar to most other modern Windows software. You download the set-up file (see below), click on it, and the package virtually installs itself.
Files Get the latest version of MegaTune from http://www.megamanual.com/files/software/. Generally, you need MegaTune 2.25 for MegaSquirt-II. All versions will work with MegaSquirt, later versions often have more features.
Install Process To get the latest version of MegaTune:
While you are in the setting.ini files, you can verify or change the EGO sensor option under LAMBDA_SENSOR if necessary.
You can use mtCfg to change the color depth, temperature units (°F/C) and a large number of other parameters for MegaTune. See the documentation in the files displayed in mtCfg.
Be sure to 'Save' the file. You should now be able to launch MegaTune. Double-click the MegaTune icon (created above) on the desktop.
Communications/Settings dialog on the MegaTune menu.
You should always uninstall MegaTune before installing newer versions.
There are two parts for any firmware release:
If you download a different .s19 file (i.e., a different embedded code version) to your MegaSquirt® EFI Controller, then you must install the corresponding INI file in the place expected by MegaTune.
If the INI file does not correspond to the code you have load, MegaTune will generate an error message when starting. The error you see is telling you that the signature in the INI doesn't match what MegaTune is receiving from MegaSquirt. This can be for a number of reasons, the most common are:
Also, be SURE to set the CODE_VARIANT (MS-II) as well as activating the appropriate INI file, both actions are necessary.
Creating and Selecting New Projects
MegaTune allows you to manage data for multiple MegaSquirt® installations on the same computer. First you must use the installer to build yourself a default setup. Once you have a basic MegaTune setup, use mtCfg.exe to create a new project. Open mtCfg, then click on 'Project/New', type in the project's name, then click on okay.
Instead of "carN", use a real name, for example "Corvette" and "Audi" (the actual names are of no significance to MegaTune, they are there entirely for your convenience, so give them descriptive names that work for you.
Then use mtCfg to configure the new projects code variant, ego sensor, etc.
When you have only a single car directory, MegaTune assumes that you want to use that one, so starts there automatically. When you have more than one, MegaTune will present you with a list of choices at startup, so you can work on the correct one. By typing the initial letters of the project name, you can jump down the select list to the desired one quite quickly. Once you have the desired project highlighted, just hit the enter key or use the mouse to click "Ok."
In the processor specific configuration file (megasquirt-II.ini) in the MegaTune folder, you can edit the gauges to show ranges and warning appropriate to your combination. (Note that you must 'activate' the appropriate file before editing it!) To do this, open the file using Notepad or another text editor.
Each gauge has a number of properties, these are:
Examples:
Name Var Title Units Lo Hi LoD LoW HiW HiD vd ld
advBucketGauge = veTuneValue, "Advance Bucket", "degrees", 0, 55, -1, -1, 999, 999, 1, 1
advdegGauge = advance, "Ignition Advance", "degrees", 0, 50, -1, -1, 999, 999, 1, 1
Note that many of the variables are represented on the runtime, tuning, and front pages, and you may need to set additional parameters to get them all to look the way you want. For example, the EGO display on the front page is set in this section:
[FrontPage] #if NARROW_BAND_EGO egoLEDs = 0.0, 1.0, 0.5 ; Voltage settings. #elif LAMBDA egoLEDs = 1.5, 0.5, 1.0 ; Lambda settings. #else egoLEDs = 19.7, 9.7, 14.7 ; Afr settings. #endif
To change the gauges on the front page, find a section of your code's INI file similar to:
[FrontPage] #if NARROW_BAND_EGO egoLEDs = 0.0, 1.0, 0.5 ; Voltage settings. #elif LAMBDA egoLEDs = 1.5, 0.5, 1.0 ; Lambda settings. #else egoLEDs = 19.7, 9.7, 14.7 ; Afr settings. #endif ; Gauges are numbered left to right, top to bottom. ; ; 1 2 3 4 ; 5 6 7 8 gauge1 = tachometer gauge2 = throttleGauge gauge3 = pulseWidth1Gauge #if NARROW_BAND_EGO gauge4 = egoGauge #elif LAMBDA gauge4 = lambda1Gauge #else gauge4 = afr1Gauge #endif gauge5 = mapGauge #if IAC_GAUGE gauge6 = IACgauge #elif PWM_GAUGE gauge6 = PWMIdlegauge #else ; FIDLE_GAUGE gauge6 = matGauge #endif gauge6 = xTauGauge gauge7 = advdegGauge gauge8 = dwellGauge
Change the gauge assignments to those you prefer. Note that the value after the 'gaugeX =' label MUST appear in the [GaugeConfigurations] section of the INI file.
So while the type of sensor is set in the vehicle specific folder, the limits are set here. In most cases the defaults work well, but you can change them to suit your purposes. The format is name, upper limit, lower limit, switch point.
Expressions
MegaTune allows you to compute values from MegaSquirt-II's output channel data or from constants and settings in the database. These can then be used in datalogs or gauges.
Data types:
Operators in order of descending precedence:
Built-in math functions and constants:
MegaSquirt-specific functions:
#unset AUTOMARK_LOGGING_FEATURES
#if AUTOMARK_LOGGING_FEATURES
[OutputChannels]
; Make up some variable names...
highLoad = { rpm >= 3500 && throttle >= 50 }
enable = { rpm >= 2000 }
[Datalog]
enableWrite = enable ; Log entries are only written when the variable
; "enable" is true, see it's definition above.
markOnTrue = highLoad ; A datalog marker is written when "highLoad"
; transitions from false to true. The marker
; looks like "MARK 001 highLoad" to distinguish
; it from the manual markers.
#endif
|
Change the #unset AUTOMARK_LOGGING_FEATURES to # set AUTOMARK_LOGGING_FEATURES (note we have changed unset to set), and edit the enable conditions (tps/rpm/map/etc.) to your liking.
Datalogging will start when the conditions are met. You still have to start the datalog - Alt+L, <enter>, but MegaTune will only record lines when the conditions are met. So you can start the datalog 20 minutes in advance, knowing the lines are not being added until you want.
As noted in the code snippet above, you can also have MegaTune 'mark' the datalog on specific events by defining other variables (for example 'highload' in the snippet above).
You should always uninstall MegaTune before installing a newer version.
You can uninstall MegaTune in three ways:
MegaTune 2.25 has a menu structure that depends on the hardware and software you have loaded. This document covers only the MegaSquirt-II hardware and v2.8 code configurations. For other configurations, please see the developer's site. At the top of this page is a list of all the menu items in MegaTune 2.25 for MS-II/v2.8. Click on any of them to navigate to specific information on that topic.
Note that for 2.88 Code, the first thing you must do is set the ECU Type (under 'Fuel Set-Up/General') to match your hardware (MS-II or MicroSquirt), MegaTune will not let you change anything else until you do this. ECU Type setting was inserted to head off the potential MicroSquirt problems due to the coils being turned on with the old default configuration. As of the 2.88 code, if ECU Type is not set, the code will put the ignition outputs in a safe state (cycling the rpm from 0 to 8000 rpm, and also flashing the fuel pump LED) and wait until a known ECU type is put in by the user.
When MegaSquirt® is loaded and communicating with MegaSquirt® EFI Controller, the first thing you will see is the front page, which shows eight of the more useful gauges. A number of the sensor readings are displayed, as well as some outputs. For example, the injector pulse width is the measure in milliseconds of how long the injector is opened for each pulse, regardless of how many times it is opened in a cycle. Duty cycle gives the percentage of time the injector is open irrespective of individual pulse duration.
There is a bar gauge across the bottom of the window shows the oxygen sensor reading. The scale is determined by egoGauge value in the Tuning section of the MegaTune2.25+.ini file. This same setting controls the analog and bar gauges on the tuning page. The first value of this setting controls the lowest voltage displayed on the gauges, the second number controls the highest and the optional third value specifies the “alert” value, above which the LEDs are red. The bottom of the front page contains a status bar. The current file name (used for Save operations) is displayed in the left part of the status bar, followed by “saved” status. When the memory image (i.e., the settings you have chosen) has been modified since the last Open or Save operation, this entry shows SAVED in bold face.
The front page also indicates how many times MegaSquirt® has reset since MegaTune was started. These resets can be due to the user manually turning off the power to MegaSquirt® (cycling the ignition switch) OR they could be due to problem with MegaSquirt® or it's power supply.
When MegaSquirt® resets, MegaTune displays RESET X in the lower right corner (where X is the cumulative number of resets, including restarts) - MegaTune will also beep. Resets can cause a number of problems that cause the engine to run badly, including messing up the baro correction and enabling after start enrichment. So you should try to cure any reset issues before putting a lot of effort into tuning.
Resets generally indicate that the power to the processor was interrupted. This could mean that the input power actually was cut, but it can also mean that there was a power surge into the back plane (ground), so that there was no longer a 5v differential between the inputs and the grounds...
Resets are often caused by noisy power supplies (usually the alternator), or poor grounds. So you might recheck that the grounds are good, and add a car stereo power filter to MegaSquirt-II's 12V supply. These are cheap (~$5) and widely available. They typically have three wires: one from a switched 12 Volt source (the original source for MegaSquirt), one to go to MegaSquirt® (with clean power), and a ground wire.
Ignition noise, solenoids turning on or off, and that sort of thing can also cause resets. Check your harness routing to see if any ground or signal wires are near noise sources such as spark plug wires or the coil.
Solve reset issues as they come up, as they will confound your tuning efforts if you proceed without fixing them.
As well as the RESET indicator, MegaSquirt® has a number of other indicators that can be set manually. This is set by editing the variables and values in the indicators sub-section of the [FrontPage] section of the INI file you have activated:
;----------------------------------------------------------------------------
; Indicators
; expr off-label on-label, off-bg, off-fg, on-bg, on-fg
; indicator = { tpsaen }, "Not Accelerating", "AE", cyan, white, red, black
;
; Look in the new colorScheme.ini for the basic ones, add more or tell me what to add.
indicator = { ready }, "Not Ready", "Ready", white, black, green, black
indicator = { crank }, "Not Cranking", "Cranking", white, black, black, white
indicator = { startw }, "ASE off", "ASE ON", white, black, cyan, black
indicator = { warmup }, "WUE off", "WUE ON", white, black, blue, white
indicator = { tpsaen }, "Accel Enrich", "Accel Enrich", white, black, green, black
indicator = { tpsden }, "Decel Cut", "Decel Cut", white, black, green, black
indicator = { tps > floodClear && crank }, "Flood clear off", "FLOOD CLEAR ON", white, black, red, black
indicator = { batteryVoltage < 10.5 }, "Battery OK", "Battery LOW", green, black, red, black
indicator = { port0 }, "Port 0 Off", "Port 0 On", white, black, red, black
The front page is limited to eight gauges, which may not be enough, especially when you are learning to use MegaTune. If you go to the 'Tuning/Realtime Display', you can see many more variables at once. This is a good page to monitor while experimenting with the stimulator and MegaSquirt. MegaTune2.25+ allows you to save and restore configurations as disk files (they have an .msq extension). Use the Open, Save and Save As menu items to do this.
MegaSquirt has two types of memory RAM, which requires that the power be on for values to be retained, and flash, which retains it's values even when the power is shut off. In MegaTune, values that are edited are change in RAM (and thus affect engine operation) as soon as you move to another field (with the tab key or the cursor). To retain the values when shutting off MegaSquirt-II's power, you must 'burn' the to flash. You do this using the 'burn to ECU' button on the dialogs.
In general, MegaTune only burns the values on the current dialog when you click on the Burn to ECU button. To burn all the values you might have edited, the best method is to save them as a MSQ (which saves the values in RAM) then load and burn it (to flash).
MegaTune can store and retrieve set-up files, both entire set-ups (.msq files), and VE table files (.vex).
For the 2.8 code version, the datalogged variables are:
| Datalog Label | INI Variable | Code Variable (outpc.) | Description | |||||||||||||||||||||
| Time | time | none | This is a time variable generated by MegaTune that counts up with the tuning PC's clock. It is helpful for spotting gaps in the datalog (which can be caused by changing dialog pages (datalogs are not recorded if the user is on some pages) or communications issues.) | |||||||||||||||||||||
| SecL | seconds | seconds | This is the internal CPU clock from the controller's processor. | |||||||||||||||||||||
| RPM | rpm | This is the engine rpm (revolutions per minute). | ||||||||||||||||||||||
| MAP | map | map | The engine intake manifold kPa from the Manifold Absolute Pressure (MAP) sensor. | |||||||||||||||||||||
| MAP/baro | kpaix | kpaix | The current MAP value (above) divided by the current baro value to be used as an alternative load index. Baro pressure is not in the default datalog (the baro correction amount, Gbaro is, but not the baro value the correction is based on). Baro can be added by including the line:
in the [Datalog] section of the INI. | |||||||||||||||||||||
| MAF | maf | maf | This is the Mass Air Flow value determined from the MAF sensor feedback and the MAF table. | |||||||||||||||||||||
| TP | throttle | tps | Throttle opening position in %, o% is closed, 100% is WOT, if the TPS has been calibrated properly. | |||||||||||||||||||||
| vBatt | batteryVoltage | batt | This is the battery voltage as measured at MegaSquirt-II. | |||||||||||||||||||||
| if NARROW_BAND_EGO O2 elif LAMBDA else | egoVoltage lambda1 afr1 | ego1, ego2 | This is the ego sensor output voltage (if a narrow band sensor is selected). | |||||||||||||||||||||
| IAT | mat | mat | The intake air temperature in °F or C, depending on your settings. | |||||||||||||||||||||
| CLT | coolant | clt | The coolant temperature in °F or C, depending on your settings. | |||||||||||||||||||||
| Engine | engine | engine | Engine Operating/Status variables - bit fields for "engine" variable. This value will tell you if the engine was accelerating, warming-up, etc., and can be used to troubleshoot by telling you if accel enrichment, warm-up, etc. was active at any given time
![]() Note that running and cranking are allowed at the same time, so you will normally see 3, not 2, while cranking. | |||||||||||||||||||||
| Gego | egoCorrection | egocor1 | This is the percentage correction to the fuelling pulse width used to adjust the pulse width calculated from the fuelling equation based on EGO sensor feedback. | |||||||||||||||||||||
| Gair | airCorrection | aircor | This is the percentage correction to the fuelling pulse width used to adjust the pulse width calculated from the fuelling equation based on intake air temperature (IAT) density correction and the ideal gas law. | |||||||||||||||||||||
| Gwarm | warmupEnrich | warmcor | This is the warm-up percentage correction to the fuelling pulse width used to adjust the pulse width calculated from the fuelling equation based on coolant temperature (CLT) and the warm-up enrichment table (WUE). | |||||||||||||||||||||
| Gbaro | baroCorrection | barocor | This is the barometric pressure percentage correction to the fuelling pulse width used to adjust the pulse width based on the user's setting for baro correction (2-point, table; start-up, real-time, etc.). | |||||||||||||||||||||
| Gammae | gammaEnrich | gammae | This is the 'net' percentage correction to the fuel pulse width from the other gammas - air density, warmup and barometric corrections (but not including accel enrichments). | |||||||||||||||||||||
| AccelEnrich | accDecEnrich | tpsaccel | This is the 'net' correction (in milliseconds) to the fuel pulse width of accel enrichments, including TPSdot, MAPdot, and X-Tau, where used. | |||||||||||||||||||||
| Gve | veCurr1 | vecurr1 | This is the current interpolated VE value used for the fuelling equation for injector driver #1 (and #2 if not using dual tables), based on the current rpm and MAP value (or alpha-N conversion table, where appropriate). | |||||||||||||||||||||
| PW | pulseWidth1 | pw1 | This is the injector pulse width (including the opening time) for injector driver #1 (and injector driver #2 unless you are using the dual table option). | |||||||||||||||||||||
| DutyCycle1 | dutyCycle1 | computed by MegaTune | This is the duty cycle of injector driver #1 (and injector driver #2 if dual tables option is not selected). The duty cycle is the percentage of the time available that the injector is opening or squirting. Vlaues over 1100% are not physically possible, and indicate that the settings in MegaTuine exceed the capabilities of the injectors (which may be too small). | |||||||||||||||||||||
| Gve2 | veCurr2 | vecurr2 | This is the current interpolated VE value used for the fuelling equation for injector driver #2 if using dual tables, based on the current rpm and MAP value (or alpha-N conversion table, where appropriate). | |||||||||||||||||||||
| PW2 | pulseWidth2 | pw2 | This is the injector pulse width (including the opening time) for injector driver #2 if you are using the dual table option. Otherwise it has no meaning. | |||||||||||||||||||||
| DutyCycle2 | dutyCycle2 | computed by MegaTune | This is the current interpolated VE value used for the fuelling equation for injector driver #2 if using dual tables, based on the current rpm and MAP value (or alpha-N conversion table, where appropriate). | |||||||||||||||||||||
| SparkAdv | advance | adv_deg | The spark advance as seen at the crank shaft, including the all the factors such as trigger offset, spark table value, temperature corrections, etc. It is what you should see on a timing light, if you have set everything up correctly. | |||||||||||||||||||||
| knockRet | knockRetard | knk_rtd | This is the current amount of ignition retard being subtracted from the spark advance table 'look-up' value when knock is detected. It is determined from the user inputs. | |||||||||||||||||||||
| ColdAdv | coldAdvDeg | cold_adv_deg | This is the current amount of ignition advance being added to the spark advance table 'look-up' value advance when the coolant temperature is low. It is determined from the user inputs. | |||||||||||||||||||||
| Dwell | dwell | coil_dur | This is the actual computed dwell output, including all corrections. Does not apply to Ford EDIS. | |||||||||||||||||||||
| tpsDOT | tpsDOT | tpsdot | This is the current rate of change of the throttle position sensor - TPS - output (%/sec). | |||||||||||||||||||||
| mapDOT | mapDOT | mapdot | This is the current rate of change of the manifold absolute pressure (MAP) sensor output (kPa/sec) | |||||||||||||||||||||
| IAC | iacstep | iacstep | This is the current position (number of steps) of the stepper motor from the fully retracted position. | |||||||||||||||||||||
| deltaT | deltaT | dt3 | The time delta (interval, aka. ΔT) between rpm pulses in microseconds. It is the time between skip teeth - the processor is interrupted every time a tooth arrives, when it counts 12 teeth, as in your case, it calculates deltaT as the difference between present CPU clock time and the saved clock time 12 teeth ago. It is accurate to within better than a microsecond, because all the times are stored at the time the tooth arrives, even if the interrupt isn't entered until a bit later because there was another interrupt at that instant. | |||||||||||||||||||||
| Trigger± | trig_fix | trig_fix | The code for toothed wheels checks for missing or extra teeth and handles them if they occur, but only allows one or 2 corrections in a row. More than this and it re-synchs. This will tell users when they have noise or weak signal issues. Again each time a tooth arrives, the processor compares tooth deltaT (not a recorded variable like rpm deltaT) =present time - last tooth time, with the previous tooth deltaT. If the new tooth time is within PulseTol % of the old, it is accepted. If it is out of tolerance too long, the trigger± counter counts down (missing tooth) if too short it counts up (extra tooth). | |||||||||||||||||||||
| tachCount | tachCount | tachCount | Counts tach pulses for use in correlating datalog values with tach pulses (at low rpm). | |||||||||||||||||||||
| XTau1 | xTauFuelCorr1 | XTfcor0 | This is the current X-tau fuel correction for injector driver #1 (and injector driver #2 if not using the dual table option). | |||||||||||||||||||||
| XTau2 | xTauFuelCorr2 | XTfcor1 | This is the current X-tau fuel correction for injector driver #2 if using the dual table option. | |||||||||||||||||||||
| E85fuelCorr | fuelCorrection | fuelcor | This is the current fuelling correction based on the fuel composition sensor feedback and the flex fuel settings. | |||||||||||||||||||||
| Ethanol% | fuelComposition | computed in MegaTune from default values | This is the current calculating ethanol percentage in the fuel based on the flex fuel sensor feedback. | |||||||||||||||||||||
| AFRtrgt1 | afrtgt1 | afrtgt1 | This is the current target value from the AFR table for the current operating conditions (rpm and MAP kPa). |
Note that there are a number of other items that could be included in a datalog, these are shown in the [OutputChannels] section of the INI.
This allows you to export a VE table. You can export or import VEX files into any of the VE tables. These are saved in the VEX format. Be sure to give your saved files descriptive names. With MegaSquirt-II, you load the files from the tables menu.
This allows you to import a VE table. You can export or import VEX files into any of the VE tables. These are saved in the VEX format. The table will import VEX files of different sizes and automatically adjust them to match the current table size. With MegaSquirt-II, you load the files from the tables menu.
Start up the MT Configurator (from the Start menu under MegaSquirt® EFI Controller, or from MegaTune under 'File/Configurator'). Open the MegaTune2.25 tree item, and you'll see a number of megasquirt-II.ini.N.N files. Pick the one where N.N matches the version of embedded code you are running (i.e., megasquirt-II.ini.2.8), highlight the .ini file version that you wish to use and execute File -> Activate. This will rename it to be "megasquirt-II.ini" (deleting the existing megasquirt-II.ini file first). It will then be used by MegaTune when it starts up.
(Note that all 2.XY use the same 2.X INI file. For example, the v2.853 code uses the 2.8 INI file. This is the way the code upgrades are designed. Major revisions are incremented by +0.1 and require a new INI file, minor revisions (+0.01) use the same INI file.)
You need to tell MegaTune which version of MegaSquirt® you have (MS-II), as well as the EGO type, etc. To do this, use the mtCfg program, which opens automatically during the installation process (it can be opened directly from the MegaTune folder at any later time). Look for the CODE_VARIANT variable, it will be in 'Car1/settings.ini/Settings/CODE_VARIANT' in the directory tree on the left side of the mtCfg window. Click on CODE_VARIANT. You can then use the drop box in the upper right section of the window to select your code variant.
While you are in the setting.ini files, you can verify or change the EGO sensor option under LAMBDA_SENSOR if necessary. You can use mtCfg to change the color depth, temperature units (°F/C) and a large number of other parameters for MegaTune. See the documentation in the files displayed in mtCfg.
Be sure to 'Save' the file.
This will close MegaTune.
On the main MegaTune2.25+ menu is an item called 'Settings/General'. You can set these as follows:
So a value of 40% on a 6 cylinder gives an injection delay of 40%×120° = 49°. The injection will then occur at 48° after the tach event, or 48° - trigger offset (btdc).
Note this is a variable for injection start angle relative to the tach pulse (not necessarily TDC). The start of the fuel injection pulse width will begin at:
which is in crank degrees. When that time is exceeded in the main loop, MAP is grabbed, the pulse width is calculated, and fuel is injected in that sequence.
Now because MegaSquirt® does not do sequential injection (though the MS-II SequencerTM controller will), it won't squirt at the same point in the engine cycle for all the cylinders connected to the same injector driver, but by moving the injection timing delay around you may be able to improve your idle. There is no simple calculation to come up with the best number for you to use. The general idea is to avoid injecting into an open exhaust valve. Since MegaSquirt® controllers use a banked injection system, then it would be better to move the timing on all the cylinders to a place where it avoids this on all cylinders (or as many as can be accommodated).
What you have to do is adjust the injection timing delay from 0% to about 80% and see which value gives you the best idle - as determined by the highest vacuum, or leanest AFR, or smoothest idle, or whatever else you are tuning for.
Of course there is a limit - you can't inject at say 98% of the next predicted tach pulse interval because there may not be time to calculate it all. Plus there is bit more fluctuation in fuel timing - NOT in the overall fuel pulse width, which will still be interrupt driven and exact, but in when the injection starts. This could vary by as much as a few milliseconds at low rpm, but the idea is that it is way better to inject within +/- a few ms of optimum than to consistently inject at a non-optimal value.
However, to ensure there is plenty of time to calculate the PW and start the injection, the fuel start time is limited to force it to occur at least 2 ms before the predicted next tach pulse. So if you look at a scope you will see the fuel pulse move right relative to the tach input as you increase InjStart %, but it will stop when it gets within 2 ms of the next tach in pulse, regardless of your increasing InjStart %.
Input Smoothing Factors Input Smoothing Lag Factors Lag factors force the variables to change more slowly than the actual input value. Note that in all cases, 100 is no lag effect at all, and smaller numbers slow the input response speed. The lag factors are used as follows:
Sampling Rates: Reasonable values for tpsdotSample and mapdotSample are 25 ms for both. If you set mapdotSample and tpsdotSample both to 0, the program will try to sample tps and calculate tpsdot as fast as it can. This will make tpsdot vary all over the place from the tiniest variation in tps. And the same for mapdot. So keep the values reasonable, between ~10 and ~50.
The basic idea of IAC is that the motor or PWM solenoid starts out with a large opening of the air valve at cold startup, then gradually closes as the coolant temperature rises. The basic motor position at any given time is determined from the input table of step position versus coolant temperature. To this basic control algorithm, several features have been added as described below. You need to set MegaSquirt-II to tell it if you have a fast idle "solenoid type" valve, a PWM type valve, or a stepper motor IAC, or none of these. These are selected under Settings/Idle Control in MegaTune:
So, for example, if the motor last moved at 140°F, and the hysteresis is set to 5°F, then it won't move again until the temperature reaches 145°F. The setting prevent from moving the motor back and forth constantly, heating it unecessarily.
A value from 5°F to 10°F is good for most installations. This input can be used to avoid continuous motor motion (and wear) for small coolant temperature changes and random 'jitter' in the coolant temperature signal . Changes to the motor are only made when new coolant temperature > coolant temperature on the last move, or, new coolant temperature < (coolant temperature on the last move - Hysteresis temperature). What this does is allow constant motor motion while the coolant temperature is rising, but when it peaks, there will be no further motion unless things cool back down - which is unlikely.

The two spare port "T" pins (PT6 and PT7) are normally used to drive the stepper motor chip (IAC1,2). When you set pin PT6 high, it will make 1 of the 4 stepper output pins high and the other low, and no effect on the last two - which are controlled in the same way by pin PT7. So, by picking 2 of the 4 IAC outputs, you have two 12V spare pins that will directly drive about 0.5 Amps with no transistor needed. This is more than enough to drive a relay directly. If you are going to use port PT6 or PT7 as spares (IAC1,2), IdleCtl should be set to 0. This will keep the the stepper chip 'always enabled' and not turn it on and off, which would prevent the port from working as intended.
The pin on/off commands are set by pointers. When a user wants to use say an LED as a spare output, then the pointer is set to point to a dummy register in RAM (random access memory), and that's it. It's just like setting a jumper on the PCB to route a signal one way or another.
The spare pins have generic logic based on the values of up to two of the real time display variables. The user can specify these in MegaTune and they will be passed to MegaSquirt-II as offsets. The user can also specify:
Conversely, If you had injector specs that stated the opening time was 0.7 milliseconds at 14.5 Volts, and your battery correction was 0.20, then you should enter 1.0 as the 'Injector Opening Time'.
The optimal PWM current limit frequency is correlated with the inductance of the injector, resistance of the loop, and elapsed time/duty. The goal is to switch the injector current on and off without an appreciable change in *average* injector current - the current which holds the injector open. Faster PWM frequencies mean less current deviation. But since the injector is already held wide open (or should be) a faster PWM frequency will not hold it open any more than it already is.
A overall PWM setting above several kiloHertz (kHz) works based on most automotive injectors, and there is no advantage of running the frequency higher. In fact the higher switching will require a little more heat dissipation. Electromagnetic interference (EMI) with other circuits on MegaSquirt® is also an increasing possibility as frequency rises.
If you want to calculated the optimal period, then measure the injector inductance, and run it through the relation for inductor current:
When the inductor is charging, use the battery voltage for E, and when it is discharging use the voltage drop across the PNP Darlington, about 1.5 volts. You can then see the amount of current deviation based on PWM frequency.
If you want to measure this directly, install a low value resistor (like 0.05 ohms) in series with the injector and monitor the voltage drop across the resistor with a scope. You will then see the hold current and the deviations cased by frequency.
Alternatively, you can add resistors in series with the injectors. See the Injectors and Fuel Supply section of the MegaSquirt® manual for more details. To run low-impedance injectors with the PWM current limit mode, you need to set two parameters - the "PWM Current Limit %" and the "Time Threshold for PWM Mode" - both are on the “Constants” page. The current limit % is the percent duty cycle when the current limit is invoked. The time threshold is the amount of time from when the injector is first opened until the current limit is activated.
High impedance injectors can run on 12 Volts without problems. Low-impedance injectors require some form of current limiting. MegaSquirt® has pulse width modulation to limit the current. You need to set the PWM parameters to match your injectors:
Set the initial PWM% to 75% if and only if you have you impedance injectors and have NOT installed:
You will tune these after getting the engine running.
See “Setting the PWM Criteria” in the tuning section of the MegaSquirt® manual.
Failure to perform the tuning steps can result in damage to your injectors. If you have high-impedance injectors, set these values to 25.4 ms and 100%, and you do not need to tune them further.
| Fuel | AFR |
| Methanol | 6.4 |
| Ethanol | 9.0 |
| Gasohol (10% ethanol) | 14.2 |
| Gasoline | 14.7 |
| Propane | 15.7 |
With Alpha-N, you fill in a 6x6 table ('Other Tables/Alpha_N MAP table') that defines how the TPS is translated into a 'faked' MAP kPa that is then used with the 12x12 VE table.
So the ECU uses the TPS to look up the MAP in the 6x6 table (which should have TPS% ranging from 0% to 100%), then uses that to determine the fuelling based on the VE table. The advantage is that you can use different fuelling at different rpms (it also makes the blended MAP/alpha-N options possible).
Number of Cylinders | ||||||||||
| 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | ||
| 1 | OK | simultaneous only | simultaneous only | simultaneous only | simultaneous only | simultaneous only | simultaneous only | simultaneous only | simultaneous only | |
| 2 | no | OK | no | OK | no | OK | OK | OK | OK | |
| 3 | no | no | simultaneous only | no | no | simultaneous only | no | no | simultaneous only | |
| 4 | no | no | no | OK | no | no | OK | no | OK | |
| 5 | no | no | no | no | simultaneous only | no | no | simultaneous only | no | |
| Number | 6 | no | no | no | no | no | OK | no | no | OK |
| of | 7 | no | no | no | no | no | no | no | no | no |
| squirts | 8 | no | no | no | no | no | no | OK | no | no |
| 9 | no | no | no | no | no | no | no | no | no | |
| 10 | no | no | no | no | no | no | no | OK | no | |
| 11 | no | no | no | no | no | no | no | no | no | |
| 12 | no | no | no | no | no | no | no | no | OK | |
"OK" means the combination will work with either simultaneous or alternating. "no" means it will not work with either, i.e., not at all.
There are a number of considerations in choosing the number of squirts:
More squirts are more likely to help if the engine:
However, if the engine is tuned so that the idle MAP is minimized (likely 13.5:1 AFR or so), and has a higher idle speed (say 800 rpm compared to 600 rpm), then more squirts is less likely to help.
There are definitely some down sides to more squirts:
So more squirts may help. They may not, however. And this can be a bandage for poor idle or accel tuning. So users should start with 2 squirt/alternating for port injection, and tune it as well as they can.
Then, if they can't solve some issues, they should try more squirts. But jumping straight to more squirts is probably not a good idea - most often it just masks the need for a richer idle mixture or more accel enrichment.
|
Example: Suppose you have a 4 cylinder 4-stroke engine. Then in 720° (two revolutions) you have 4 spark events (at 0°, 180°, 360° and 540°, then starting over at 720°=0°). MegaSquirt can only inject on an ignition event, so 1, 2, or 4 squirts/cycle for this engine.
If you have 2 squirts/simultaneous, you have:
but with 2 squirts /alternating, you have:
Both are two squirts per cycle, but alternating only has 1/2 as many total squirts per injector (i.e., since only one channel is active per squirt), so the pulse width must be doubled. 4 squirts/simultaneous would look like this:
There are 4x as many injection events with 4 squirts/simultaneous compared to 2 squirts/alternating, so the pulse width is just 1/4 as long (neglecting the opening times). The req_fuel calculator will show this - watch the top and bottom numbers as you make changes to the alt/sim and number of squirts. The top number stays the same (it is the 'unadjusted number' for 1 squirt simultaneous), while the bottom 'adjusted' number used for the pulse width calculations changes with the number of squirts and simultaneous/alternating. |
#unset MAPbaro
to:
# set MAPbaro
for going for MAP to MAP/baro (and unset if going from MAP/baro to MAP only, obviously). Otherwise the tables will not show on the menu (they will be grayed out).
MegaSquirt historically always includes the AFR in the calculation as part of the VE table, unless you have 2.8+ MS-II code, and have set the 'Use separate VE & AFR table' option under 'Fuel Set-Up/Other Fuel Settings'
The reason the AFR and VE tables were combined in the early codes is that they are tuned together. That is, you tune the VE table to get the AFR you want. So in practical terms, there was nothing to be gained by separating them, they would do the same thing (and eat up more memory). This was before wide band sensor were widely available.
When wide band sensors became popular and relatively cheap, the AFR table was invented to set targets for the wide band sensor, and nothing else. So it affected fuelling 'after the fact' in the ego correction, but was NOT used in the initial fuel pulse width calculation. In this case, setting the VE to the 'true VE' would result in ego correction trying to reach the AFR target. But if you wanted EGO correction to be minimal, you would still put VE*AFR in the VE table.
However, it was realized that there was some educational value in separating out the AFR and VE tables, since these are both real physical quantities, and it helps to understand how the engine is working if both quantities appear in the fuelling equation. So using 'separate VE & AFR table' takes the AFR table from an EGO correction to act as both ego correction AND a part of the initial fuel calculation. In this case, the 'true VE' would go in the VE table, the desired AFR goes in the AFR table, and the EGO correction should be minimal (assuming everything else is correct, of course).
Fuel Response Time (cyclic): This is a tool for experimental determination of how a change in fuelling propagates through the system. Additional fuel added (in milliseconds) to normal fuel pulse width for the 'number of injections', which is repeated every 'time between added fuel' in seconds. The idea is that there is a step function in the fuelling (with no other changes). This will help in determining the X-Tau settings, as well as the EGO sensor response time. The amount of time for the EGO sensor to respond to the fuel impulse is dependent on both the transport time (a function of rpm) and the sensor response time.
Nitrous Control (switched by E0 low): The N2O enrichment input is a percentage which multiplies the Δtime between tach pulses. This provides a fixed fuel flow rate for the constant N2O flow rather than a fixed pulse width. Since the same variable is also used for the fuel response test impulse, which is in milliseconds, a change in the settings.ini file is required if you want to use N2O enrichment.
You expose the nitrous menu (under 'Other fuel settings/Additional Fuel') by going into the settings.ini file in your project's /mtCfg/ sub-folder and changing the default setting from fuel response determination (#unset n2o) to the nitrous setting (#set n2o):
find:
#unset n2o ; choose between n20 enrichment (=set) and PW impulse (=unset) triggered by PE0 (affects menus)
and change it to:
#set n2o ; choose between n20 enrichment (=set) and PW impulse (=unset) triggered by PE0 (affects menus)
Then whenever PE0 (the JP4 jumper on MS-IITM itself) is pulled low (grounded by the nitrous switch) the specified percentage of fuel will be added (this will work best with a one-stage system, of course!). The specified amount of ingition retard (up to 25.5° will also be applied.
Make sure you test this by seeing what it does to the pulse width before you use this with nitrous.
These parameters define the closed loop behavior of MegaSquirt. You must have a either a narrow band or wide band EGO sensor/controller that will work with v2.8 of controller code. To disable closed loop operation altogether, set the EGO Step value to zero.
Dual Sensors: The dual lambda sensor feature has been in the MS-II code since V1.0. You connect the second sensor to the ADC6 input with appropriate circuitry and it adjusts the PW2 output independently of PW1. You connect the second sensor to the JS5 hole (on a V3 main board) - X7 on a V2.2 main board, duplicating the R10, R11, C10 circuit from the v3.0 PCB in the proto grid area. There is only one calibration because it is assumed you are going to use the same type of sensor on each side. If there is a small difference, you can compensate for it in the separate AFR target tables.
From the time the processor commands the injector to open to the time you get a valid feedback from the O2 sensor, the following has to happen:
The control algorithm used in the processor takes into account that there will be a delay between injecting more fuel and getting back a reading and then injecting more or less fuel based on that reading. It can calculate the time between injections, so you don't have to be concerned with that. But it does need the sensor + transportation delay because it has no way of calculating that. If that delay is even the least bit longer than 1 injection cycle, you have to wait for the next cycle to correct.
The equation used looks like this:
It assumes you have a measured transport delay at a fixed rpm and map value, e.g, at idle, and you can put the specific rpm, map and measured delay into the equation and you get out a progra