Mass Air Flow (MAF) sensor guide

This page has now been superceded, please click here

Introduction - Settings (incl MAFMAP) - Tuning - Wiring -

These instructions apply to 3.2.x firmware


Mass air flow (MAF) sensors provide a measurement of actual airflow through the intake system of an engine. In its most basic form, the fuel required by the engine (in mass per second) is directly related to the air flowing into the engine (in mass per second) so the MAF sensor should give a good basis for the fuel equation. (By comparison, Speed Density uses RPM, MAP, MAT and VE to estimate the mass air flow.)
In practice, like any other sensor input the MAF has its own quirks and can suffer from reversion effects (particularly on "cammy" engines) where the air flow gets measured twice.

The Megasquirt implementation of MAF consists of the following main elements:

  • Engine and injector parameters
  • MAF calibration table *
  • MAF correction table *
  • Optional trim table using VE2
    (* It is planned to merge these together in a future code release)


    The first step in MAF configuration is to ensure you have set up the basic settings for your engine.
    Basic Setup > Engine Constants
    MAF engine constants
    The critical settings to enter here are:

  • Engine Stroke
  • No. cylinders
  • Number of Injectors

    Having entered those details, click on the Required Fuel button to calculate the global fuel constant.
    You will need to re-enter the numbers as the calculator doesn't pick them up automatically. Make sure you set the correct units.

    Next, load a calibration curve that matches your MAF

    From the Tools menu in TunerStudio, select Calibrate MAF Table

    Either pick a predefined calibration...

    or select custom inc file and browse for it

    Having selected a built in calibration or loaded your own you need to Write to Controller. Then Close.

    Next you need to configure the MAF sensor input to match where your sensor is wired.

    Advanced >MAF options page:
    maf settings
    MAF port selects the hardware input pin where the MAF is connected. (See wiring section below.) Or "Off" if no sensor is in use.
    Engine size - note that this is in cubic inches. 1ci = 16.4cc (Future releases are changed to cc)

    To use MAF for fuelling

    Basic Setup > More Engine Constants page, the following are typical settings to use MAF:
    load params Primary fuel load is set to MAF
    Incorporate AFR target is set to include AFR target
    Stoichiometric AFR is set to 14.7 for petrol/gasoline.
    Ignition load is set to MAFMAP


    As shown above, the primary fuel load is MAF because fuel required is directly related to mass air flow. However, ignition and other load based tables are not directly related in the same way. While it would be possible to use MAF volts as the Y-axis on other tables, it would mean that only a very narrow band of the table was used and tuning would suffer. So instead of that, the code calculates a synthesised load value called MAFMAP. This behaves similarly to MAP in a speed density system and should give a repeatable load value and allow tuning of those tables in the conventional manner. Do not be too concerned about the exact values of MAFMAP, but do make sure the axes on the table are set to cover all MAFMAP values and RPMs. When live tuning, the active cell will be highlighted.

    A MAF only install will need to use MAFMAP for spark and AFR table lookups. But, if you have a MAP sensor installed you can choose to set "Speed Density" for spark and/or AFR which will then use MAP as the Y-axis in the table.


    Initially it is suggested to leave the MAF correction curve/table at all 100%.
    MAF correction table

    Ensure you have configured the basic engine parameters: number of cylinders, number of injectors, engine size and used the ReqFuel calculator to set ReqFuel.
    As noted above, set primary fuel load to MAF and spark and AFR to use MAFMAP.
    Configure the AFR table for your chosen target AFR values. Ensure that the load and rpm axes cover your expected range, alter them to suit if needed.
    It is suggested that EGO correction be set to "No correction" at this time.
    Having started your engine, your primary tuning tool at this point is to make tweaks to the MAF correction table curve so that the reported AFR from your wideband matches the target table you configured. (You can enable the AFR error gauge in TunerStudio to see the difference between the two.)

    Trim table using VE2

    If and only if you have exhausted tuning using the correction curve alone, you can enable a secondary fuel load as MAFMAP to give you VE2 as a trim table. This gives you a full trim table of MAFMAP vs RPM.

    Basic Setup > More Engine Constants page
    maf trim

    When first enabling VE2 as a trim table you will need to fill it with 100%. Press CTRL-A, = and then enter 100. The table should now look as follows
    maf VE2 trim table


    MAF sensors have at least three wires. GND, power supply, signal.
    The power supply is typically 12V and should be taken from a fused source from the main relay.
    Signal GND should connect to Megasquirt sensor ground.
    If present, Power GND should connect to the engine block along with the other Megasquirt power grounds.

    You may choose from either pin 'JS5 (ADC6)' or 'JS4 (ADC7)' either requires a hardware modifications inside the Megasquirt case.
    analogue inputs
    Assemble the circuit on the prototype area of the mainboard and connect your MAF signal into the case through a spare pin on the DB37 connector. e.g. One of SPR1,2,3,4 if they are free.

    For Microsquirt choose either SPAREADC and SPAREADC2 - no modifications required.

    Ford MAF Sensor Pin-Outs:

    Nissan Infinti Q45 MAF Sensor:

    An alternative to the Ford MAF sensor is the 80mm Infiniti (Nissan) Q45 MAF sensor, which apparently flows more air than any other stock MAF sensor and gives a voltage output.

    PinOEM colourFunction
    BMAF output signalWhiteTo Megasquirt analogue input
    DGroundBlackConnect to Megasquirt sensor ground
    ESwitched 12 voltsBlack/whiteFused supply from Main Relay

    GM Frequency MAF sensors:

    Some GM MAF sensors are known to give a frequency output rather than an analogue voltage. These are not supported in MS2/Extra.

    If you have a question, comment, or suggestion for this FAQ please post it on the forum.

    No part of this manual may be reproduced or changed without written permission from James Murray and Ken Culver.