The Windows 9x/Me/XP 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, all versions work with MegaSquirt®). 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. USB will 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.
Introduction to MegaTune | Installation | File | Settings |
Table | VE Table 1
|
VE Table 2
|
Ignition Table
|
Tuning | Communications | Tools | Help |
MegaTune2.25+ is the Windows 95 (and later) configuration editor by Eric Fahlgren 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 installs itself. You may have to select some options, or you may chose to select all the defaults. Files Get the latest version of MegaTune from http://www.megamanual.com/files/software/. Generally, you need MT2.25 for MegaSquirt-II. All versions will work with MregaSquirt, 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 to your MegaSquirt® EFI Controller, then you must install the corresponding INI file in the place expected by MegaTune.
The error you are seeing 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 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. 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, it is there for your purposes, so give it a descriptive name that works 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 file (megasquirt-I.ini, megasquirt-II.ini, etc.) in the MegaTune folder, you can edit the gauges to show ranges and warning appropriate to your combination. 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'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 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 standard MegaSquirt® and MegaSquirt-II hardware and code configurations. For other configurations, please see the developer's site. Below is a list of all the menu items in MegaTune 2.25. Click on any of them to navigate to specific information on that topic.
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's 12V supply. These are cheap (~$5) and widely available. They typically have three wires: one from a switched 12V 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'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).
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, 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.
(New code versions (2.889+) have their own INI, so for example 2.890 code (Monitor_v2.890.abs.s19) has a specific 2.980 INI (megasquirt-II.ini.2.890).
You will find the INI files here: http://www.megamanual.com/files/ini/ and the code S19 loadable files here: http://www.megamanual.com/files/code/
Note that all older 2.XY (prior to 2.889) use the same 2.X INI file. For example, the 2.35 code uses the 2.3 INI file. This is the way the older code upgrades are designed. Major revisions were 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® and code you have (MS, MS-II, etc.), 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:
Input Smoothing Lag 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:
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 or a stepper motor IAC, or neither. 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:
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-inpedance 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:
Note that most distributors are shipping the V3 main board with the flyback circuit installed. If you are not sure, look for the presence of Q3 and Q11 on the heat sink (3rd and 7th from the left), or ask the distributor.
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 |
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.
You can also set:
These parameters define the closed loop behavior of MegaSquirt. You must have a narrow band O2 sensor hooked up for this mode to work in v.1.0 controller code; either a narrow band or wide band will work with v.2.0 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.
The two parameters for characterizing transport delay come form the two causes: one is the response time of the sensor itself even if you had it stuck on the cylinder head exhaust port + it includes averaging done in WB controllers. The second parameter is a function of the transport of gas from the cylinder head to the sensor - which is a function of geometry and speed/load.
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 eq and you get out a program input (KDly2) needed by the MS II code to approximate the transport delay at any arbitrary rpm and map. KDly1 is the sensor response delay and include the averaging done by whatever WB interface system you are using. You could get some idea of the K2 delay by estimating exhaust flow velocity and measuring pipe/ port lengths or by maybe using a spare port to energize a solenoid to squirt a small single shot of extra gas into the intake at a fixed time. You then datalog everything and measure how long it took from the time the solenoid was energized to when the extra gas showed up on the afr reading.
Automatic Mixture Control (AMC) allows MegaSquirt® to adjust the VE table based on the exhaust gas sensor without a laptop computer attached, much like OEM ECUs.
In the 'Settings/Ignition Options' dialog you can select the:
The missing tooth code uses the teeth of the missing tooth crank wheel to create 'tach teeth'. That is, it creates a tach signal from a particular tooth, then skips a number of teeth before declaring another tooth a tach signal. This means that all the tach teeth must correspond to real teeth. For a four stroke cycle engine, this means that the total number of teeth, including missing ones, must be evenly divisible by ½ the number of cylinders (or by the number of cylinder for a 2-stroke).
There is more information on the trigger wheel usage in the missing tooth trigger wheel decoder page.
The trigger wheel settings are:
Bin | Voltage (V) | Duration (ms) | Comment |
1 | -4.0 | 2.0 | Increases dwell by 2.0 milliseconds at 8.0 Volts |
2 | -2.0 | 0.9 | Increases dwell by 0.9 milliseconds at 10.0 Volts |
3 | 0.0 | 0.0 | No compensation is applied at 12.0 volts |
4 | 2.0 | -0.5 | Decreases dwell by 0.5 milliseconds at 14.0 Volts |
5 | 4.0 | -0.9 | Decreases dwell by 0.9 milliseconds at 16.0 Volts |
In general, you should have small positive numbers in the negative bins, and small negative numbers in the positive bins. DO NOT rearrange the order of the voltage bins.
The -4.0 and -2.0 bins are useful for generating a good 'hot' spark for cranking. Note that normal running voltage is often about 14 volts, which in this case would remove 0.5 milliseconds. Be very careful not to put overly large numbers in these bins. You engine may now run at all or may run poorly with large negative numbers, and may burn out the coil with large positive numbers.
This table tells MegaSquirt-II how to position the IAC stepper motor at various temperatures. There are ten temperature bins. At start-up, MegaSquirt-II 'retracts' (opens) the stepper motor by the number of steps specified in the 'Idle Control/Start Value' field. The number specified in this table are how many steps the stepper closes when the coolant temperature reaches the specified temperature. So if you want the stepper to be completely closed at idle, you would set the last bin (160°F) to equal the start value.
For those that have PWM style idle valves (typically Ford, as well as others), this is the ten element table that specifies the duty cycle (in percent) at each of ten temperatures. Generally, higher temperatures require higher duty cycles.
This is the MAP table that is used for alpha-N fuelling computations when the hybrid alpha-N option is selected.
This lets the user define a 6-element table of barometric correction (based on either the initial MAP value, or a second baro MAP sensor value). A 6 point table of baro pressure vs a correction change will allow you to modify the baro correction equation for your particular car, compensating for things like exhaust size. With this you can take EGO feedback vs barometric data at various elevations or barometric pressures. From this you can determine the % additional/ less correction you need to get your AFR where you want it. This does require that you add a second MAP sensor for baro. But you should be able to tune the table to give you a very stable AFR at any altitude.
Some users have found that the ideal gas law calculation of air mass does not work especially well for them. This could be because the air entering the cylinder does not reflect the measured temperature. The MAT correction table lets the user define a 6-element table of MAT (intake air temperature) correction.
The concept of "X-Tau" compensation is very simple: for every squirt of the fuel injector, the majority of the fuel makes it into the cylinder, but some of the fuel from the squirt collects on the wall of the intake manifold and intake valve. In simplistic terms, a certain percentage of fuel (1-X) gets into the cylinder, the remainder sticks to the walls (X), hence the term 'wall wetting'.
The fuel that sticks to the walls eventually evaporates back into the airstream and is drawn into the cylinder. This is a time variable, call it Tau, which is the amount of time it takes to get the fuel clinging to the wall back into the cylinder.
Both X and Tau can be a function of RPM/MAP, coolant temp, etc. X value is pretty much constant but the Tau is a function of several parameters.
Note that if the injection pulse width is the same, and if it arrives with a fixed time interval (i.e. same RPM) then a equilibrium is reached where the amount of fuel sticking to the walls is in equilibrium with the wall film dissipating back into the airstream. However, a change in pulse width or a change in the time between injections upset this equilibrium, requiring an "adjustment" in the delivered fuel if one wants to compensate, hence the term "transient fuel compensation".
There is more on X-Tau here: www.megamanual.com/ms2/xtau.htm.
There are a number of user-configurable settings for X-Tau.
If X-Tau is enabled under 'Settings/General/X-Tau Usage', then you'll find the 12x12 Tau time table (rpm vrs. kPa) under 'Tables/X-Tau Settings'. In addition, there are:
This is a 10 element table that defines how tau changes as a function of coolant temperature.
This is a 10 element table that defines how tau changes as a function of intake air temperature.
If you have selected 'Table' for the 'Prime, ASE, WUE Tables' under 'Settings/General', then you can fill in a 10-element table for the priming pulse versus temperature (the pulse that occurs before MegaSquirt® receives an rpm signal) instead of linearly interpolating between two points.
If you have selected 'Table' for the 'Prime, ASE, WUE Tables' under 'Settings/General', then you can fill in a 10-element table for the cranking pulse width versus temperature (the pulse with that occurs while MegaSquirt® is in cranking mode, generally under 300 rpm) instead of linearly interpolating between two points.
If you have selected 'Table' for the 'Prime, ASE, WUE Tables' under 'Settings/General', then you can fill in a 10-element table for the afterstart enrichment (ASE) versus temperature (the percentage of additional fuel added when MegaSquirt® has transitioned from cranking mode to running mode) instead of linearly interpolating between two points.
If you have selected 'Table' for the 'Prime, ASE, WUE Tables' under 'Settings/General', then you can fill in a 10-element table for the afterstart enrichment (ASE) taper versus temperature (the number of cycles during which additional fuel is added when MegaSquirt® has transitioned from cranking mode to running mode) instead of linearly interpolating between two
All interpolation in MS uses table end points (NOT extrapolation) when the indexing value exceeds the limits of the table, but that fact is especially important when considering the computations of volumetric efficiency from the VE table. This means that if your biggest MAP bin contains 100%, then any MAP value over this will produce 100% (for a given RPM). This does NOT mean that the pulse width will be the same for MAP readings of 100 kPa and 200 kPa, the MAP value is used to scale the pulse width accordingly, so for this example you will get twice as much fuel.
To clarify how all these factors are used, the basic pulse width calculation (containing no enrichments, etc.) is.
Volumetric efficiency is a function of many factors (intake and exhaust tract design, camshaft lobe shape, and so on) but can be characterized very well for a given engine by MAP and RPM. I could go on about resonance and laminar flow, but it is sufficient to say that at low MAP (30 kPa), the VE is typically very poor due to turbulence effects, so VE is low (maybe 10-30%). At the MAP values 100 kPa and higher, the torque curve is a close reflection of the VE curve, so expect the VE values to peak at about the same point.
Very Important Note The VE values in MS do not reflect the true VE in your engine, since you usually do not want to run stoichiometric combustion in all operating regimes! They are a combined value giving the VE multiplied by any enrichments or enleanments that you desire. When your turbo motor is running at 250 kPa and has a true VE of 100% at 14.7:1 AFR, you would enter 111% to get 13.2:1 AFR.
The Required Fuel value determines the ideal pulse width at 100% VE. The entries in this table scale that value to determine the actual pulse width (neglecting all correction factors and enrichments). As such, both the required fuel and the VE table entries are more or less arbitrary, but it is useful to make them as close to correct as possible. In other words, if your required fuel value is 15.0 ms and the VE table entry being used is 100%, you could achieve the same pulse width with 10.0 ms and 150%, respectively. It is also important to understand that these VE values do not indicate the amount of fuel delivered over time. For example, if you have a row in the table that is 100% across the board, then fuel delivered is proportional to RPM. Say that the engine is running at 2500 RPM and the pulse width is 12.0 ms. If you speed the engine up to 5000 RPM the pulse width will remain at 12.0 ms, but this delivers twice as much fuel because there will be twice as many injection events in a given time interval.
The MAP bins define the range over which you can vary the VE values used for pulse width calculations. These values are in kPa (absolute) and can vary from 0 to 255 kPa; usually 0 to 100 for a naturally aspirated motor and 0 to max boost on a turbo- or supercharged one. The biggest value might be 100%, even for a turbo motor, IF you want the fuel at boost to be linearly proportional to MAP. Typically, though, you want some values above the 100 kPa value to add fuel as coolant when boosting. This might result in a table that looks like this: MAP VE (%) ... 100 80 150 100 200 100 250 120 4000 RPM to ensure that extra fuel is delivered when boost is applied. The low value should be around 20 kPa for a stock type engine and the top value should be around the maximum pressure that you expect your engine to see (i.e., ~100 kPa for naturally aspirated motors, somewhat over max boost on a turbo- or supercharged motor to give yourself some headroom). The MAP bin values are stored in MS as "KPARANGEVE."
The RPM bins define the range over which you can adjust VE based on engine speed. If you have a representative torque curve for a motor like yours (ideally from a dyno run, but probably nearly as good from one of the many engine simulation packages available), you can set the spacing of these values from that. Find the places on the graph where the curve is "bending" the fastest (i.e., has big second derivatives; usually from idle to up near the torque peak) and use smaller RPM intervals over these. For long stretches where the curve is straight, but not necessarily horizontal, you can use bigger gaps in the bins. The reason for this is that the algorithm is going to do linear interpolation between these points (that is, it is going to play connect-the-dots), so you will have smaller error between bin points if you choose them well. It is usual to have the low end of the torque curve well represented, down to idle, and the top end should be somewhere near your redline value. For a street engine, the torque curve is usually dropping rapidly at redline, dictating that you have that top value up near redline. On a race motor, you are much nearer the torque peak, so will probably group the RPM bin values more tightly up there for finer control over the range of interest. The RPM bin values are stored in MS as "RPMRANGEVE."
These constants are derived from the:
1. Inputs Fill in all of the values (use your best estimate if you don't have measured numbers, but remember your table will only be as good as your estimates, and sometimes quite a bit worse).
3.
Verify
Note that you can export or import VEX files into any of these tables. Use the 'Table/XXX Table/Files/VE Table Import' to import them, 'Table/XXX Table/Files/VE Table Export' to export them. These are all saved in the VEX format, so be sure to give your saved files descriptive names. The table will import VEX files of different sizes and automatically adjust them to match the current table size.
These constants are derived from the:
1. Inputs Fill in all of the values (use your best estimate if you don't have measured numbers, but remember your table will only be as good as your estimates, and sometimes quite a bit worse).
3.
Verify
This is a table that is used to increase the ignition advance at lower coolant temperatures. Because cool mixtures burn more slowly and are less likely to detonate, additional spark advance at lower temperatures can help the engine to run better and more efficiently.
The ten element cold advance table lets you specify this additional advance. Typically, a total of about 6° degrees is added at -40°F, and you should be sure to use 0° at fully warmed up temperatures (otherwise this will be added to your advance table).
This is a table that is used to reduce the ignition advance at higher intake air temperatures. Because hot mixtures (typically from the heated air from a supercharger or turbocharger) burn more quickly and are more likely to detonate, reducing spark advance at higher intake air temperatures can help the engine to run better and avoid destructive detonation.
The ten element MAT-based retard table lets you specify this reduced advance.
This lets you adjust the values used for all temperature related table. For example, you can raise the maximum temperature to 180°F or 200°F or even more.
Time (s)
Time in seconds since MegaSquirt® last booted ("secl"). This value is derived from the 8-bit
seconds value in the internal MS clock, and will therefore only display
values from 0 to 255 (it wraps around to zero when it hits 255). If
the time wraps around before hitting 255, a reset has occurred, and this
will be noted on the front page status bar. Note that with MS-II, the datalogs will show secl continuing to climb above 255 (up to 65536), this is normal.
Barometer (kPa and
in/Hg)
The barometric pressure as measured by
MegaSquirt. Currently this is a static value determined at startup.
Returned by MegaSquirt® in "baro" as a raw ADC count.
O2 (v)
This is the voltage detected on the EGO sensor if on
is installed. For narrow band sensors this ranges from 0-1 v and typical
wideband sensors have a voltage range of 0-5 v.
Coolant (F)
The value reported by the coolant temperature sensor
(returned by MegaSquirt® in "cts" as a raw ADC count). Don't be alarmed if
it seems to be stuck at 215 F when your dash gauge is reading higher. Due
to 8-bit software constraints this is the maximum value that MegaSquirt®
knows about. If you used a non-GM CTS and changed the THERMFACTOR
table in your MS, then MegaTune would show you "wrong" values for coolant
temperature.
Batt (v)
Current battery voltage as measured inside
MegaSquirt. If this number looks lower than actual battery voltage
(probably 14.0 v or higher), then you may not have big enough wires
running to MS; put a voltmeter across the wires from the board to their
source in your vehicle's wiring loom (should be less that 1 v, a lot
less). Returned from MS as a raw ADC count in "batt."
TPS (v)
Throttle position in volts. Most TPSs don't range
from 0 to 5 v, so don't be alarmed if yours only goes from 1.5 to 4.4 v as
this is normal. The nominal TPS value itself is generally not interpreted
in an absolute way, but rather the rate of change in TPS is what is used
for acceleration enrichment. However the value of ~3.5 volts is used
to denote "flood clear" mode; i.e., if you hold the throttle down past the
3.5 volt level (the voltage from the TPS) when cranking, the pulse width is cut back to 0.3
milliseconds. Returned from MS as the variable "tps" in a raw ADC count.
GammaE
Gamma is the total enrichment factor, computed by
MegaSquirt® taking into account all of warmup, acceleration/deceleration,
barometric, and manifold air temperature sensor correction factors, but excluding EGO correction, which is handled separately
(See Corrections/Enrichments, below.) Returned from MS as a percentage
value in "gammae."
MAP (kPa)
The manifold absolute pressure as seen by MegaSquirt®
in kiloPascals. Returned in MegaSquirt® "map"
as a raw ADC count, converted in MegaTune using a hard-coded transfer
function.
MAT (F)
The raw temperature of the air at the Manifold Air
Temperature sensor. Used in conjunction with MAP to compute manifold air
density. (See note on Coolant temp, above.) Returned by MegaSquirt® in "mat" as a raw ADC count.
RPM
Engine speed in RPM. If this is jumping around in an
unpredictable manner, you probably have a poor ignition signal input to
MegaSquirt. It is returned from MS as RPM/100 in the variable "rpm."
Pulse Width (ms)
The injector pulse width being used by MegaSquirt® to
squirt fuel into your motor. Reported as 10xPulse width in the MegaSquirt®
variable "pw".
IAC DC (%)
If a PWM Idle valve is selected, this is reporting
the PWM percentage applied to the valve (0 to 100%). If a stepper motor
IAC is selected, it reports the total number of steps made to extend the
pintle, with 0 being the start value.
Corrections/Enrichments (percent)
This part of the realtime display shows all the
individual correction factors used to compute gamma and the resulting
pulse width.
EGO
This is the correction factor computed from O2 sensor
readings. Returned as a percentage by MS in "egocorr". See "Exhaust Gas Oxygen" on the
Enrichments page, below, for parameters to modify MegaSquirt's computation
of this factor.
Barometer
A barometric correction is applied, based on the
initial MAP sensor reading. Returned in "barocor" by MegaSquirt.
Warmup
The warmup
correction factor applied due to startup and coolant temperature status.
Returned in "warmocor" by MegaSquirt. See
"Warmup Enrichment Bins" to modify the computation of this factor.
Air Density
Air density correction is computed from MAT. This
value is returned from MegaSquirt® in "aircor".
Volumetric
Efficiency
The current computed VE value
determined by look up in the VETABLE using RPM and MAP. Reported in "vecurr" by MegaSquirt.
Acceleration
Unlike all the other corrections here, the
acceleration enrichment is an additive factor; take the result of all the
above multiplied through, then add this one on. Returned from MegaSquirt®
in "tpsaccel".
Runtime Messages
This message is a decoded version of the MegaSquirt®
engine status variable "engine." Possible status values are
(these are their names in the controller code megasquirt.h and
megasquirt.asm):
In this dialog you can set the warm-up enrichment (WUE) bin values and a few other related settings. The WUE bins are used to provide additional fuel during warmup, much like a 'choke' on a carburettor. A WUE value of 100 means no enrichment. Typically values are 100% at the highest temperature (usually 160°F) and increase up to around 160 or more by -40°F. Setting a warmup enrichment bin to 100 (usually the last one, but you can set it to 100% at other bins too) disables the warm-up enrichment. In MS-II you can edit the temperature bins themselves, as well (see this).
Priming Pulse
This is the duration in milliseconds of a priming pulse that is applied when the MegaSquirt® controller is powered up. If you don't want a priming pulse, set this field to zero. The prime pulse is NOT meant to provide starting fuel (it is meant to clear any air that might have leaked into the fuel system while the engine was shut down), that's what the cranking pulses (see below) are for (as they are both rpm and temperature dependent, and thus much more likely to give the correct amount of fuel for starting under all conditions). (Only available for version 2.0 and later of MegaSquirt® controller code.)
Cranking Pulsewidth
Cranking pulse width determines how long the injector will be open in milliseconds for each pulse while the engine is cranking (i.e., the RPM is below 300). The actual pulse width is determined by performing linear interpolation on the line described by the end points you enter for the "-40 degrees F" and "170 degrees F" values. For instance, if you enter 10.0 ms as the pulse width at -40 F and 2.0 ms at 170 F, the pulse width will be 6.0 ms when you start your engine at 65 F. Note: Cranking pulse occur at every ignition event, while running pulses only occur at the interval specified on the constants page; if you have a 4 cylinder engine and are taking the tachometer signal from the coil, then you will get four (4) cranking pulses per cycle and depending on settings one injection per cycle while running. The MegaSquirt® variables "CWU" and "CWH" hold the low temperature and high temperature pulse widths, respectively.
Note that even in a 'piggy-back' application, do not set MegaSquirt's cranking pulse widths to zero. This will cause unpredictable pulse widths up to 13 milliseconds. Instead, set them to 0.1 milliseconds in that application. This allows very little fuel to flow.
Afterstart
Enrichment
The afterstart enrichment (AE) is
one that decays from its max value (specified in the "Enrichment
(percent)" field) to zero in a linear fashion over a period defined in
"Number of Ignition Cycles." If you specify 20% enrichment over 250
ignition cycles, then the first pulse is enriched by 20%, the 125th pulse
is enriched by 10% and the 250th (and later) by zero percent (this assumes
1 event per cycle, or a 1 cylinder engine; divide by the number of
ignition events per cycle to get the specific behavior for your motor).
MegaSquirt® stores these values in the flash constants called "AWC" (Afterstart Warmup Count) and "AWEV" (Afterstart Warmup Enrichment Value).
Acceleration enrichment (AE) occurs when you open the throttle "rapidly" to avoid bogging the engine. In v.1.01 MegaSquirt® EFI Controller, this is done solely based upon the rate of change in the throttle position sensor (also called TPSDOT).
MegaSquirt-II allows this acceleration enrichment to be triggered by a change in the TPS (TPSdot) or a change in the MAP (MAPdot) or any combination of the two.
The MAPdot settings are on the left side of the accel wizard, and the TPSdot settings are on the right. Each column of 4 bins allows you to specify the rate of MAPdot or TPSdot, and in the corresponding bin (to it's right) you can specify the amount of fuel (in milliseconds per injection) that should be added to the pulse width calculated based ont he MAP, rpm, etc.
Acceleration Enrichment
Bins (ms)
These bins specify the actual
enrichment in terms of pulse width. They are linearly interpolated to
determine a value that is ultimately added to the computed pulse width.
The array of values is called "TPSAQ" as
stored in MegaSquirt. Note that with MegaSquirt-II, you have two sets of
bins, one for TPS based acceleration enrichment, and the other for MAP
based acceleration enrichment.
You can use the slider to choose between the TPSdot and MAPdot accel enrichments. Move it to the left to select more MAPdot accel enrichment., and to the right for more TPSdot enrichment.
Below the accel bins are a number of other settings:
MAPdot Threshold
This is the threshold in kpa/sec below which no
acceleration enrichment will occur (you can move the throttle from idle to
full open without acceleration enrichment, if you open it slowly enough).
A typical value is 80 kPa/sec. Tuning Note: While you are tuning the VE table you should set this
threshold artificially high (maybe 150.0) to disable acceleration
enrichment completely. After the VE table is fairly well-defined, set this
back to 80 and begin tuning AE.
TPSdot Threshold
This is the threshold in %/sec (v/sec in some older code versions) below which no
acceleration enrichment will occur (you can move the throttle from idle to
full open without acceleration enrichment, if you open it slowly enough).
A typical value is 15%/sec.
Accel Time (sec)
This value indicates how long the acceleration
enrichment "squirt" will last. Typical values are around 0.3 second.
MegaSquirt® stores this value in the variable "TPSACLK".
Accel Taper Time (sec)
This value indicates how long after the 'Accel Time' that MegaSquirt® tapers the acceleration enrichment from the 'bin value' to the 'End Time'.
enrichment "squirt" will last. Typical values are around 0.2 second.
MegaSquirt® stores this value in the variable "TPSACLK".
End Time (sec)
This value indicates how long the acceleration
enrichment will be after the 'Accel Time' + 'Accel Taper Time'. Typical values are around 0.5 millsecond.
MegaSquirt® stores this value in the variable "TPSACLK".
Cold Accel Enrichment
(ms)
The acceleration enrichment pulse also
varies depending upon coolant temperature. The value specified here is the
pulse width added to the value from the bin calculations at -40 F. The
Cold Acceleration Enrichment amount is linearly interpolated from full
amount at -40 F down to zero at 165 F. A typical value might be 2.0 ms.
This value is stored in the "TPSACOLD"
variable in MegaSquirt.
Cold Accel Multiplier
(%)
Another means for increasing the amount of
fuel delivered by the acceleration enrichment pulse is supplied by this
value; it is likewise interpolated from the full specified amount at -40F
down to zero at 165 F. Before the Cold Acceleration Enrichment value is
added to the base acceleration enrichment pulse width, it is multiplied by
this value. Total AE = Base AE * CAM + CAE The difference between the two
types of AE cold modify can be easily seen with a few examples:
1) Assume we have a calculated AE pulse of 5.0 ms. Say our coolant temperature is 40 F, giving a CAE pulse of 2.0 ms and CAM is turned off (100%). The result is 5.0+2.0 = 7.0 ms.
2) Assume same base AE and temperature, but now we turn off CAE (0.0 ms) and set CAM to give 140%. The result is the same, we get 5.0*1.4 = 7.0 ms.
3) Take the first case, but hit the accelerator faster, giving 8.0 ms base AE pulse. We now have a result of 8.0+2.0 = 10.0 ms.
4) Take case 2, but with the higher base AE pulse, giving 8.0*1.4 = 11.2 ms. The bottom line is that the CAE modifier is constant and independent of the base pulse, where on the other hand, the CAM modifier has a proportional effect on the AE, bigger base pulse means bigger result. This value is stored in the "ACMULT" variable in MegaSquirt.
Decel Fuel Amount
(%)
When you let off the throttle rapidly
(that is the closing rate exceeds TPSDOT Thresh) and the engine is turning
faster than 1500 RPM, then deceleration fuel cutoff is performed by MS.
Deceleration fuel amount is multiplied by the "normal" pulse width, that
is, if the calculated pulse is 12.0 ms and you have 20% decel amount, then
the resulting pulse width is 2.4 ms. A value of 100% causes the fuel to
remain at its calculated value, and can cure bucking on deceleration in
vehicles with manual transmissions; those with automatic transmissions may
benefit in fuel economy by using values below 100%. The MegaSquirt®
variable "TPSDQ" holds this value as a
percentage.
This window enables you to tune the VE table 'on the fly'. On the left are a number of gauges, and on the right are two items - a graphical representation of the VE table at the top, and a status box at the bottom.
Cursor
The "cursor" is the red cross on the tuning RPM vs MAP graph on
the right half of the screen. The values corresponding to the current
cursor position are displayed in the status window in the same color as
the cursor. These represent the values that will be changed when the
shift-up/down arrows are pressed.
Spot
The "spot" is the green dot specifying current engine operating
position in the VE graph. The numeric values corresponding to the spot are
displayed in green in the status window.
Keystrokes
To navigate the VE map on the right of the Tuning screen, use the arrow keys move the tuning cursor, up moves up on the MAP axis of the grid and down moves to a lower MAP bin. If you know VI, then you can alternatively use the standard motion keys from that editor; use "k" to go up, "j" to go down, "h" to go left and "l" to go right. Left and right arrow keys move to the higher and lower RPM bins, respectively.
The shifted up and down arrow keys richen or lean the VE table bin at the cursor. Alternatively, the "q" key richens the currently selected bin and "w" leans it. Whenever you change a value in MegaTune, it is immediately changed in the MegaSquirt® controller's RAM. These changes will go away when you turn off the engine if you do not save them into flash memory by typing "b" for "burn to flash."
You can also easily modify the required fuel value on the tuning screen. Hold both shift and ctrl down while typing up and down arrow keys, each keystroke will change the value up or down by 0.1 ms.
You can rotate the grid so you can see the values better on the 3D window more clearly. Hit the "m" and "n" keys and see what happens. Once you find an orientation you like, copy down the numbers that are displayed in the status window and you can set those as your defaults in the base ini file:
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.Tools/Autotune
Autotune is an algorithm built into recent releases of MegaTune that automatically tunes your VE table based on EGO feedback. It is similar to MSTweak3000, but operates in real-time, without a datalog, and on any variant of code and processor that uses MegaTune.
The VE value inside MegaSquirt's RAM memory is modified and your engine feels the effect immediately, but it is not burned to flash and made 'permanent' until you click "Burn Table". If you do not burn the table, the changes will be lost the next time the power is cycled on MegaSquirt.
With a narrow band sensor, you can use auto-tune with any algorithm and any sensor to tune the low-power part of the table, it will get you to stoich (or AFR targets) quite nicely, which will give you a starting point from which to extrapolate the high-power part.
You don't need a dynomometer to get the high output regions of the VE table done, but you definitely should NOT use auto-tune with a narrow band sensor for that part of the table, you'll end up with broken or melted pistons. In order to use auto-tune for WOT tuning, you must be running a wide band lambda system (sensor and controller), with an appropriate EGO correction algorithm that allows you to set specific AFR targets (i.e., MS-II). If one of these requirements is missing, then you must rely on seat-of-the-pants and experience.
To enable autotune, select 'Tuning/VE Table1/Tools/Autotune'. An autotune status text indicator will appear in the message window in the lower right corner of MegaTune. Note that auto-tune updates the VE table in RAM, and requires that you click "Burn" to save the changed VE table permanently.
Beware that if you go so rich that you start to see misfires, the lambda sensor will read the unburned mixture as dead lean (since unburned oxygen is present) and the closed loop algorithm will attempt to add fuel, which the auto-tune algorithm will detect and adjust the VE bin richer, thus making a bad situation worse. Use with caution, auto-tune will not perform magic!
Typically, acceleration enrichment and decceleration enrichment happen while the engine RPMs are changing quite rapidly, and they usually turn off EGO correction at the same time, pretty much negating those two conditions.
To start with, set the EGO step size (in MegaTune) to 1%, and set the authority down to ~10%, so that auto-tune doesn't do unstable jumps. The default auto-tune gain is 50%, so if you could jump a VE entry by as much as 5% in a single operation with the above numbers.
The EGO control algorithms all turn off correction (i.e., set the correction factor to 100%) whenever AE, decel, warmup or any number of other enrichment types come active. The 100% EGO value in turn has the effect of turning off the auto-tune.
The EGO correction step doesn't come into play at all, that's only internal to the EGO algorithm itself and dictates how rapidly it moves when correcting. The auto-tune step is determined by the current EGO correction (which is limited by the EGO controller authority), and the proportional gain, so only those two values really play a role in computing how big the auto-tune step will be. So, things proceed like this:
There are a number of parameters that affect the operation of auto-tune. These are written into the custom.ini file:
The radius (or vertex tolerance parameters) is how near to a vertex the operating conditions must be before the VE will be adjusted. For example, with the above settings, auto-tune will adjust a vertex if the operating point is within 200 RPM and 7 kPa of that vertex. If you increase the radius parameters, which would allow tuning farther from a vertex, then you may be changing the wrong vertex (typically four are involved at any given time, but auto-tune only changes the nearest one). The radius parameters try to minimize this error by only tuning when the nearest vertex has overwhelming influence.
For the limits (or tuning block parameters), "X" is RPM. Y is normally MAP, TP or load. Z is the VE itself. The limit parameters box the tuning points, no changes will be made outside the box. The radius parameters dictate how close the operating point must be to the tuning point for auto-tune to operate, if the operating point falls outside this smaller box, then no action is taken. If you change the limits, then you don't change the accuracy or speed, just the region that is valid for tuning.
Initial startup interval is the time in seconds between when the operating point approaches a tuning point and when the first adjustment is made.
The update interval is the time between each subsequent adjustment.
Note: If the interval parameters are made too short, the algorithm will become unstable and oscillate, since the EGO signal has some latency: you change the pulse width, which a cycle later causes the combustion mixture to change and then depending on the volume of pipe between the cylinder and the EGO sensor, there is some delay before the change is sensed. So you don't want to make these too short, you must allow enough time for the system to react and stabilize.
Proportional gain is how much of the ego correction is used to adjust the VE value. If you set it to 1.0, and the ego correction indicates a 15% error, then the VE will be adjusted by 15%, while gain of 0.5 will adjust VE by 7.5%. I'd suggest keeping this at 0.5 or lower.
Lumpiness is a parameter to limit how far a vertex's VE can be adjusted. The example below will keep the vertex that is being tuned within 5% of the extremes of the four surrounding vertices, under the assumption that the table should be somewhat smooth and will be 'rough tuned' to start. Note that the limits are transient, so if auto-tune changes vertex A by +5%, then moves to adjacent B, which also goes +5%, then the limit when we return to A will now be 5% above B.
[AutoTune] table = veTable1Map lumpiness = 5 ; percent
There are two diagnostic messages to tell you what is going on with the auto-tune algorithm when it is turned on, but isn't doing any tuning. They are:
Note that there are no menus to configure auto-tune in MegaTune (other than the EGO parameters). All the other data that MegaTune displays in dialogs for you to edit is stored somewhere inside your MegaSquirt; the tuning parameters for auto-tune are just MegaTune-specific data and really have nothing to do with MegaSquirt. This means that you need to edit the custom.ini file to make changes to the tuning algorithm's parameters. You may have to add to the custom.ini file:
;------------------------------------------------------------------------------- ; Add your customizations here, they will be read at the end of the ; standard megatune.ini processing and override any settings there. ;------------------------------------------------------------------------------- [AutoTune] table = veTable1Map ; Should be the map3d_id of a TableEditor entry. allowAutoTune = on corrector = egoCorrection ; Vertex tolerance parameters xRadius = 200 ; RPM yRadius = 7 ; MAP ; Tuning block parameters xLimits = 1500, 4000 ; RPM yLimits = 60, 90 ; MAP zLimits = 10, 200 ; VE ; Controller parameters initialStartupInterval = 1.0 ; seconds updateInterval = 1.0 ; seconds proportionalGain = 0.5 lumpiness = 5 ; percent
This window enables you to tune the second VE table in dual table mode 'on the fly'. On the left are a number of gauges, and on the right are two items - a graphical representation of the VE table at the top, and a status box at the bottom.
Cursor
The "cursor" is the red cross on the tuning RPM vs MAP graph on
the right half of the screen. The values corresponding to the current
cursor position are displayed in the status window in the same color as
the cursor. These represent the values that will be changed when the
shift-up/down arrows are pressed.
Spot
The "spot" is the green dot specifying current engine operating
position in the VE graph. The numeric values corresponding to the spot are
displayed in green in the status window.
Keystrokes
To navigate the VE map on the right of the Tuning screen, use the arrow keys move the tuning cursor, up moves up on the MAP axis of the grid and down moves to a lower MAP bin. If you know VI, then you can alternatively use the standard motion keys from that editor; use "k" to go up, "j" to go down, "h" to go left and "l" to go right. Left and right arrow keys move to the higher and lower RPM bins, respectively.
The shifted up and down arrow keys richen or lean the VE table bin at the cursor. Alternatively, the "q" key richens the currently selected bin and "w" leans it. Whenever you change a value in MegaTune, it is immediately changed in the MegaSquirt® controller's RAM. These changes will go away when you turn off the engine if you do not save them into flash memory by typing "b" for "burn to flash."
You can rotate the grid so you can see the values better on the 3D window more clearly. Hit the "m" and "n" keys and see what happens. Once you find an orientation you like, copy down the numbers that are displayed in the status window and you can set those as your defaults in the base ini file:
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
Autotune is an algorithm built into recent releases of MegaTune that automatically tunes your VE table based on EGO feedback. It is similar to MSTweak3000, but operates in real-time, without a datalog, and on any variant of code and processor that uses MegaTune.
The VE value inside MegaSquirt's RAM memory is modified and your engine feels the effect immediately, but it is not burned to flash and made 'permanent' until you click "Burn Table". If you do not burn the table, the changes will be lost the next time the power is cycled on MegaSquirt.
With a narrow band sensor, you can use auto-tune with any algorithm and any sensor to tune the low-power part of the table, it will get you to stoich (or AFR targets) quite nicely, which will give you a starting point from which to extrapolate the high-power part.
You don't need a dynomometer to get the high output regions of the VE table done, but you definitely should NOT use auto-tune with a narrow band sensor for that part of the table, you'll end up with broken or melted pistons. In order to use auto-tune for WOT tuning, you must be running a wide band lambda system (sensor and controller), with an appropriate EGO correction algorithm that allows you to set specific AFR targets (i.e., MS-II). If one of these requirements is missing, then you must rely on seat-of-the-pants and experience.
To enable autotune, select 'Tuning/VE Table1/Tools/Autotune'. An autotune status text indicator will appear in the message window in the lower right corner of MegaTune. Note that auto-tune updates the VE table in RAM, and requires that you click "Burn" to save the changed VE table permanently.
Beware that if you go so rich that you start to see misfires, the lambda sensor will read the unburned mixture as dead lean (since unburned oxygen is present) and the closed loop algorithm will attempt to add fuel, which the auto-tune algorithm will detect and adjust the VE bin richer, thus making a bad situation worse. Use with caution, auto-tune will not perform magic!
Typically, acceleration enrichment and decceleration enrichment happen while the engine RPMs are changing quite rapidly, and they usually turn off EGO correction at the same time, pretty much negating those two conditions.
To start with, set the EGO step size (in MegaTune) to 1%, and set the authority down to ~10%, so that auto-tune doesn't do unstable jumps. The default auto-tune gain is 50%, so if you could jump a VE entry by as much as 5% in a single operation with the above numbers.
The EGO control algorithms all turn off correction (i.e., set the correction factor to 100%) whenever AE, decel, warmup or any number of other enrichment types come active. The 100% EGO value in turn has the effect of turning off the auto-tune.
The EGO correction step doesn't come into play at all, that's only internal to the EGO algorithm itself and dictates how rapidly it moves when correcting. The auto-tune step is determined by the current EGO correction (which is limited by the EGO controller authority), and the proportional gain, so only those two values really play a role in computing how big the auto-tune step will be. So, things proceed like this:
There are a number of parameters that affect the operation of auto-tune. These are written into the custom.ini file:
The radius (or vertex tolerance parameters) is how near to a vertex the operating conditions must be before the VE will be adjusted. For example, with the above settings, auto-tune will adjust a vertex if the operating point is within 200 RPM and 7 kPa of that vertex. If you increase the radius parameters, which would allow tuning farther from a vertex, then you may be changing the wrong vertex (typically four are involved at any given time, but auto-tune only changes the nearest one). The radius parameters try to minimize this error by only tuning when the nearest vertex has overwhelming influence.
For the limits (or tuning block parameters), "X" is RPM. Y is normally MAP, TP or load. Z is the VE itself. The limit parameters box the tuning points, no changes will be made outside the box. The radius parameters dictate how close the operating point must be to the tuning point for auto-tune to operate, if the operating point falls outside this smaller box, then no action is taken. If you change the limits, then you don't change the accuracy or speed, just the region that is valid for tuning.
Initial startup interval is the time in seconds between when the operating point approaches a tuning point and when the first adjustment is made.
The update interval is the time between each subsequent adjustment.
Proportional gain is how much of the ego correction is used to adjust the VE value. If you set it to 1.0, and the ego correction indicates a 15% error, then the VE will be adjusted by 15%, while gain of 0.5 will adjust VE by 7.5%. I'd suggest keeping this at 0.5 or lower.
Lumpiness is a parameter to limit how far a vertex's VE can be adjusted. The example below will keep the vertex that is being tuned within 5% of the extremes of the four surrounding vertices, under the assumption that the table should be somewhat smooth and will be 'rough tuned' to start. Note that the limits are transient, so if auto-tune changes vertex A by +5%, then moves to adjacent B, which also goes +5%, then the limit when we return to A will now be 5% above B.
[AutoTune] table = veTable1Map lumpiness = 5 ; percent
There are two diagnostic messages to tell you what is going on with the auto-tune algorithm when it is turned on, but isn't doing any tuning. They are:
Note that there are no menus to configure auto-tune in MegaTune (other than the EGO parameters). All the other data that MegaTune displays in dialogs for you to edit is stored somewhere inside your MegaSquirt; the tuning parameters for auto-tune are just MegaTune-specific data and really have nothing to do with MegaSquirt. This means that you need to edit the custom.ini file to make changes to the tuning algorithm's parameters. You may have to add to the custom.ini file:
;------------------------------------------------------------------------------- ; Add your customizations here, they will be read at the end of the ; standard megatune.ini processing and override any settings there. ;------------------------------------------------------------------------------- [AutoTune] table = veTable1Map ; Should be the map3d_id of a TableEditor entry. allowAutoTune = on corrector = egoCorrection ; Vertex tolerance parameters xRadius = 200 ; RPM yRadius = 7 ; MAP ; Tuning block parameters xLimits = 1500, 4000 ; RPM yLimits = 60, 90 ; MAP zLimits = 10, 200 ; VE ; Controller parameters initialStartupInterval = 1.0 ; seconds updateInterval = 1.0 ; seconds proportionalGain = 0.5 lumpiness = 5 ; percent
This window enables you to tune the MS-II AFR table 'on the fly' if you have the wide band sensor option selected. On the left are a number of gauges, and on the right are two items - a graphical representation of the AFR table at the top, and a status box at the bottom.
Cursor
The "cursor" is the red cross on the tuning RPM vs MAP graph on
the right half of the screen. The values corresponding to the current
cursor position are displayed in the status window in the same color as
the cursor. These represent the values that will be changed when the
shift-up/down arrows are pressed.
Spot
The "spot" is the green dot specifying current engine operating
position in the VE graph. The numeric values corresponding to the spot are
displayed in green in the status window.
Keystrokes
To navigate the AFR map on the right of the Tuning screen, use the arrow keys move the tuning cursor, up moves up on the MAP axis of the grid and down moves to a lower MAP bin. If you know VI, then you can alternatively use the standard motion keys from that editor; use "k" to go up, "j" to go down, "h" to go left and "l" to go right. Left and right arrow keys move to the higher and lower RPM bins, respectively.
The shifted down and up arrow keys richen or lean the AFR table bin at the cursor. Alternatively, the "w" key richens the currently selected bin and "q" leans it. Whenever you change a value in MegaTune, it is immediately changed in the MegaSquirt® controller's RAM. These changes will go away when you turn off the engine if you do not save them into flash memory by typing "b" for "burn to flash."
You can rotate the grid so you can see the values better on the 3D window more clearly. Hit the "m" and "n" keys and see what happens. Once you find an orientation you like, copy down the numbers that are displayed in the status window and you can set those as your defaults in the base ini file:
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
This window enables you to tune the MS-II AFR table 'on the fly' if you have the wide band sensor option and the dual table mode selected. On the left are a number of gauges, and on the right are two items - a graphical representation of the AFR table at the top, and a status box at the bottom.
Cursor
The "cursor" is the red cross on the tuning RPM vs MAP graph on
the right half of the screen. The values corresponding to the current
cursor position are displayed in the status window in the same color as
the cursor. These represent the values that will be changed when the
shift-up/down arrows are pressed.
Spot
The "spot" is the green dot specifying current engine operating
position in the VE graph. The numeric values corresponding to the spot are
displayed in green in the status window.
Keystrokes
To navigate the AFR map on the right of the Tuning screen, use the arrow keys move the tuning cursor, up moves up on the MAP axis of the grid and down moves to a lower MAP bin. If you know VI, then you can alternatively use the standard motion keys from that editor; use "k" to go up, "j" to go down, "h" to go left and "l" to go right. Left and right arrow keys move to the higher and lower RPM bins, respectively.
The shifted down and up arrow keys richen or lean the AFR table bin at the cursor. Alternatively, the "w" key richens the currently selected bin and "q" leans it. Whenever you change a value in MegaTune, it is immediately changed in the MegaSquirt® controller's RAM. These changes will go away when you turn off the engine if you do not save them into flash memory by typing "b" for "burn to flash."
You can rotate the grid so you can see the values better on the 3D window more clearly. Hit the "m" and "n" keys and see what happens. Once you find an orientation you like, copy down the numbers that are displayed in the status window and you can set those as your defaults in the base ini file:
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
This window enables you to tune the MS-II ignition advance table 'on the fly'. On the left are a number of gauges, and on the right are two items - a graphical representation of the advance table at the top, and a status box at the bottom.
Cursor
The "cursor" is the red cross on the tuning RPM vs MAP graph on
the right half of the screen. The values corresponding to the current
cursor position are displayed in the status window in the same color as
the cursor. These represent the values that will be changed when the
shift-up/down arrows are pressed.
Spot
The "spot" is the green dot specifying current engine operating
position in the VE graph. The numeric values corresponding to the spot are
displayed in green in the status window.
Keystrokes
To navigate the spark advance map on the right of the Tuning screen, use the arrow keys move the tuning cursor, up moves up on the MAP axis of the grid and down moves to a lower MAP bin. If you know VI, then you can alternatively use the standard motion keys from that editor; use "k" to go up, "j" to go down, "h" to go left and "l" to go right. Left and right arrow keys move to the higher and lower RPM bins, respectively.
The shifted down and up arrow keys increase or decrease the advance in the ignition table bin at the cursor. Alternatively, the "w" key richens the currently selected bin and "q" leans it. Whenever you change a value in MegaTune, it is immediately changed in the MegaSquirt® controller's RAM. These changes will go away when you turn off the engine if you do not save them into flash memory by typing "b" for "burn to flash."
You can rotate the grid so you can see the values better on the 3D window more clearly. Hit the "m" and "n" keys and see what happens. Once you find an orientation you like, copy down the numbers that are displayed in the status window and you can set those as your defaults in the base ini file:
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
In general, you want:
To set the spark advance table, you should try to understand what your engine needs in the following areas:
MegaTune version 1.51 or later reads and saves the com port in a file named megatune.cfg. This file will be created in the same directory as the megatune.exe executable, if it does not exist.
Port The communications port number should correspond to the port to which the MS controller is attached. Usually you will select port 1 or 2, but some machines force you up to higher numbers (for instance, we have seen COM5 as the default on some IBM Thinkpad laptops).
Timer Interval (ms) The timer interval dictates how frequently the runtime and tuning displays are updated. An interrupt is generated at the specified interval, and the real time data is pulled down from the MS controller. Use 100-200 ms to start; you can try to smaller values if your computer is fast enough (for example, 50 milliseconds works without problems on a P2 233 mHz laptop).
Serial Data Rate The
data rate is hard coded into your MegaSquirt® embedded code, use:
- 9600 for MegaSquirt® EFI Controller,
- 115200 for MegaSquirt-II.
Other values will NOT work without
re-coding and reprogramming and you will spend a lot of time trying to
figure out what is wrong.
Verify ECU
Communications Click this button to attempt communications with the
MegaSquirt® controller. Success will be reported if MegaTune is able to
contact MegaSquirt.
This creates and saves a file in your project directory that contains all of the tuning parameters for MegaTune. While it has essentially the same information as the .MSQ files, the distinction is that the dump file is intended to be read by humans, rather than computers, so it can be opened in notepad and read directly.
Each 'dump' is appended to any previous dumps, and stamped with the date and time, so it can be a running record of your tuning changes.
One of the first things you should do after installing MegaTune is set up the throttle position file. This is pretty simple, you need to turn on the MegaSquirt® (don't start the engine!), go to the Tools menu and select Calibrate TPS. Leave the throttle closed and pick the Get Current button for closed position, push the pedal to the floor (this is why the engine MUST NOT BE RUNNING) and pick on the Get Current button for wide open throttle. Click OK and you're done. Whenever you change the TPS or mess with the throttle body, just go through this procedure again.
For each of the coolant (CLT) and intake air (IAT) temperature sensors, this utility lets you specify the resistance of the sensor at 3 different temperatures (along with a bias resistor value) which allows you to use non-standard temperature sensors (the defaults are for the standard GM sensors). It functions much like EasyTherm did for MegaSquirt-I.
IMPORTANT NOTE: Do NOT burn tables ('Calibrate AFR Table' or 'Calibrate Thermistor Tables') on a running engine. Even idle is NOT allowed, because these tables ONLY exist in flash, so once a table is erased, there is nothing but garbage in there until it is re-programmed, one word at a time. Until that reprogramming is complete, operating the engine is unsafe.
To have MS-II recognize your EGO sensor, you need to go to 'Tools/Calibrate AFR table' in MegaTune and choose 'Narrow band' (it will probably already be selected), then click 'OK'. This will download the Volts versus AFR table to MegaSquirt-II, and will dictate what MegaTune reports in terms of both volts and AFR.
IMPORTANT NOTE: Do NOT burn tables ('Calibrate AFR Table' or 'Calibrate Thermistor Tables') on a running engine. Even idle is NOT allowed, because these tables ONLY exist in flash, so once a table is erased, there is nothing but garbage in there until it is re-programmed, one word at a time. Until that reprogramming is complete, operating the engine is unsafe.
This allows you to use 'non-standard' MAP and baro sensors, as well as in some cases to adjust the amount of barometric correction.
Before tuning your advance table, be sure to use a timing light to verify that your 'trigger offset' is calibrated. Changing the Trigger Offset in MegaTune will not change the displayed advance, instead, it changes the actual advance as seen with a timing light. Your goal is to make these two match.
To do this, get your engine warmed-up (otherwise the timing moves as the temperature increases) and idling, then use a timing light to verify to be certain your actual advance as shown by a timing light equals your the advance display on the advance gauge in MegaTune. (8° in this case). (Note that positive numbers denote BTDC, and negative numbers denote after TDC.)
The trigger offset value can theoretically be set anywhere physically, however, since it may be used for cranking and 'fault mode' timing (GM 7-pin HEI), it is best to set it at a reasonable number for idle, say ~8° BTDC (or whatever is recommended by the module's manufacturer). Check this with a timing light. To get the trigger offset to this value, you may have to rotate your distributor or move your crankshaft VR sensor.
The trigger offset is a quick way to move the entire table around. This could help in for example dyno tuning if you wanted to see in one run what retarding everywhere did to you, then start moving things around according to the horsepower curve compared to baseline with 0° offset.
This is a special mode designed for flow testing and/or cleaning injectors using MegaSquirt® as a driver. Bruce and Al get several inquiries a week on the JectorRate FI driver setup, enough that we think that adding this mode will be useful.
Gasoline is dangerous, especially in vapour form. If you use gasoline, it should be in a 'closed system' (One that does not allow vapours or liquid to escape). Be sure to have at least two fire extinguishers on hand, and keep them physically speareted so the you will always have a clear path to at least one. Consider using other fluids than gasoline for testing. See this page: www.not2fast.com/efi/injector_info.shtml for some alternative fluids.
To activate the test mode, you set the 'Injector Test Mode' to 'Test Mode', burn it to flash ("Burn to ECU") and cycle power. To get out of test mode you just turn off the option in MegaTune- you don't have to burn it. The code burn the 'normal mode' setting automatically and then reboots itself, coming up in normal mode.
There is also a 'Repeat Mode' which means to repeat the number of squirts you just. The code resets the Test Mode and repeats. The user can keep sending 'Repeat Mode' (up to 127) if that's easier and the code will keep repeating the number of squirts. Or users can just cycle power without turning off the Test Mode, which is just as easy unless your full time job is testing injectors.
Injector test mode sets up a specific injector pulse width, duty cycle, and an adjustable commanded number of pulses. So, an injector can be plumbed up on a test stand with test fluid, and the injector exercised for a specific number of pulses/widths. And the injector open time and PWM current limit will still be there, so these can be characterized in the flow. The test fluid volume can be measured, alternatively the mass change introduced by the fluid can be measured on a sensitive scale.
The injector test mode allows you to set up:
Note that flow values will be most accurate for longer pulse widths (up to 65 milliseconds), BUT if you are testing low impedance injectors they will flow too much current at longer pulse widths without some form of current limiting. Since the injector test mode has PWM current limiting, you can use long pulse widths with the test mode, IF YOU HAVE SET UP THE PWM PARAMETERS. See this link for information on how to do that: www.megamanual.com/ms2/configure.htm#pwm.
To test the injectors, enter the number of squirt, pulse width, etc., you want, then cycle the power to MegaSquirt® to start the test. The MegaSquirt® will fire the injectors for:
For example, for injector test squirts = 400, Injector test PW = 20.000 and Off time = 60), the total duration of the test is:
If you collected 38cc of fuel from 2 injectors during this time, and they had an opening time of 1.0 milliseconds, the flow rate would be:
Since this is for two injectors, the injectors flow 150 cc/min each.
When the test is complete, test mode then sits there waiting for either a reset command from MegaTune or change the test option and reset to resume normal mode. This could be used on the bench for commercially testing/cleaning injectors or to clean/test them in your car by pulling out the injectors from their pockets and letting them squirt into a can. The cost of a complete MS-II fully assembled is still way cheaper than a commercial tester/cleaner. (Bruce and Al saw one for $8000 and all it had besides a controller were 8 burettes.)
There is more information here: www.mnegamanual.com/ms2/injectortest.htm.
MegaTune Tuning Software
by Eric Fahlgren {eric@wryday.com}
Version 2.25 (release info is here)
Originally derived from MegaSquirt® PC Configurator
by Bruce Bowling and Al Grippo
See http://www.megamanual.com/ for full details.
Choose this for the Help topics available for MegaTune.
Al Grippo and Bruce Bowling have created MegaSquirt-II, which is a plug-in daughter card that replaces the 8-bit MC68HC908GP32 with a 16-bit MC9S12C32 processor. MegaSquirt-II is an intermediate step from the original MegaSquirt® towards UltraMegaSquirt.
It is basically a plug-in processor card that has the MC9S12C32 processor plus support hardware as well as a stepper motor chip, and an ignition module controller. The embedded code is written in C, rather than assembly language, so it should be more accessible to more programmers (Stephane Carrez has ported GCC to the HC12 processor so, although it doesn't use the full 9S12 instruction set, we are able to use his version to write code for the MS-II).
For current documentation, go to www.megamanual.com/ms2/, or for support questions visit http://www.msefi.com/.