MegaSquirt® Electronic Fuel Injection Computer - MAP Sensor


The manifold absolute pressure (MAP) sensor used in MegaSquirt® controllers are the absolute pressure sensors which are manufactured by Motorola. These sensors are designed to be mounted directly on a PCB, thus eliminating extra wiring and potential noise issues - all one has to do is run a manifold vacuum line to the built-in barbed port and you are good to go.

There are two different Motorola MAP sensors that can be used on-board the MegaSquirt. The first, Motorola part number MPX4115AP, is designed for normally-aspirated engines (i.e. without external intake boost mechanisms), and yields a range of 5 to 115 kiloPascals (kPa), or 1 Bar. The other Motorola sensor, part number MPX4250AP, is designed for turbo or supercharged engines, and can operate from 5 to 250 kPa, or 2.5 Bar. Both of these units yield a linear analog voltage which is proportional to pressure. This pressure is filtered by a resistor/cap, and is fed into one ADC channel on the MC68HC908GP32 processor. The absolute accuracy of the sensors are about +/- 2 percent, which is more than enough for this application. All MegaSquirt®'s sold since mid 2002 have been supplied with the MPX4250AP 'turbo' MAP sensor, which work just as well with normally aspirated engines.

The MAP sensor is used by MegaSquirt® for two separate tasks. First, it is used as a Manifold Absolute Pressure monitor, which monitors the intake tract pressure (absolute), which is a direct (proportional) indication of mass air flow and required fuel. Also, when the MegaSquirt unit is first turned on, a sample of the MAP sensor is taken and is used to determine barometric pressure, and hence a barometric pressure correction factor for VE. Both the MAP and barometric pressure correction factor values are derived from table lookup from two files: kpafactor.inc for MAP readings, and barofactor.inc for barometer correction factor.

It is strongly recommended that one uses the Motorola MAP sensors for MegaSquirt® - they have been tested and verified operational in actual use. However, if one wants to use another MAP sensor, then they will have to do a few things. First, the MAP input signal is not brought out on the DB-37 connector. To use an external sensor, one will have to run a single jumper wire from the MAP input signal PCB pad (pin #1 on the on-board MAP) to an unused pin on the DB-37 connector (like pin #25).

The second item is the generation of new MAP and barometric correction factor files. Below is the C source code used to generate the two configuration files for the Motorola MPX4115 and MPX4250 sensors. You can see at the top of the file is the user-modification area - simply enter the number of pairs for NPRES, and change the arrays PRES and VOLT in the beginning of the code to correspond to your sensor's transfer function. The Motorola sensors are linear, hence there are only two data pairs - if you are using non-linear sensors, be sure to enter several kPa-voltage pairs.

/**********************************************************/
/**********************************************************/
/**********************************************************/
/**     Genmap.c - used for generating MAP transfer      **/
/**           function files for MegaSquirt.             **/
/**                                                      **/
/**      Generates barofactor.inc and kpafactor.inc      **/
/**                                                      **/
/**          Bruce A Bowling - August 2001               **/
/**********************************************************/
/**********************************************************/
/**********************************************************/


#include 
#include 
#include 
#include 

/**************************/
/* User-defined area here */
/* Change the NPRES number for the number of KPA-volt points you have */
/* Be sure that the VOLT array is sorted acending values */
/* Both the MPX4115 and MPX4250 values are here (the MPX4250 is commented out) */


#define NPRES 2

// MPX4115 values
double  pres[NPRES]={20.,    100.};
double  volt[NPRES]={0.425, 4.025};

// MPX4250 values
//double  pres[NPRES]={20.,250.0};
//double  volt[NPRES]={0.2,  4.8};

/* end user defined area here */
/******************************/

unsigned char map[256], barometer[256];


void main()
{
	
	double count, vcalc, pcalc, barocor;
	FILE *fp, *afp;
	int i,ik;

	fp = fopen("./kpafactor.inc","w");
	fprintf(fp,"KPAFACTOR:\n");

	afp = fopen("./barofactor.inc","w");
	fprintf(afp,"BAROFAC:\n");

	/* Loop over all of the A/D range (0 to 255 for 8 bits) */
	for(count=0.; count <256.; count += 1.0)
	{
		ik = (int) count;
		if(count < 0.1 || count > 254.) 
		{
			map[ik] = 100;
			barometer[ik] = 100;
			fprintf(fp, "\tDB\t100T\n"); /* This is the end-pont limp-home values */
			fprintf(afp,"\tDB\t100T\n"); /* This is the end-pont limp-home values */
		}
		else
		{
			/* determine voltage for corresponding count */
			vcalc = count * 5.0/255.0;
			
			/* Find where voltage value lies in volt[] array */
			i=1;
			while(i < (NPRES - 1) && vcalc > volt[i]) i++;
			
			/* Linear interpolate */
			pcalc=pres[i]+((pres[i]-pres[i-1])*(vcalc-volt[i]))/(volt[i]-volt[i-1]);
			
			/* Limit range and write */
			if(pcalc > 255.) pcalc=255.;
			if(pcalc < 0.) pcalc=0.;

			map[ik] = (unsigned char) (pcalc);
			fprintf(fp,"\tDB\t%dT\n",(int)(pcalc));
			
			/* Generate barometer correction factor based on pcalc value */
			barocor = 100.0*(1.0 - 0.0047 * (pcalc - 100.));

			barometer[ik] = (unsigned char) barocor;
			fprintf(afp,"\tDB\t%dT\n",(int)(barocor));

		}
	}
	
	fclose(fp); 
	fclose(afp);

}



© 2003, 2008 Bowling and Grippo. All rights reserved. MegaSquirt® and MicroSquirt® are registered trademarks.