jump to navigation

Manifold Air Pressure Measurement 2010/03/27

Posted by Michael in 2JZduino.

The intake manifold air pressure identifies the gas pressure at the beginning of the compression stroke of the engine. Accurate measurement of this parameter is critical to determining the amount of ignition timing delay necessary to safely avoid detonation.

The pressure sensor selected for my 2JZduino is the Freescale Semiconductor MPX4250AP. This sensor provides absolute pressure measurement from vacuum up to 250 kPa and is suited for automotive applications. Mouser sells this sensor for $11.

The sensor is mounted directly to the 2JZduino shield PCB (seen far right in the picture below) where it is electrically connected to +5V, ground, and one of the analog inputs. A 1/4″ pneumatic air line connects between the sensor and the engine intake manifold (“T”ed into a vacuum line).

Sampling the pressure sensor signal (as well as the air fuel ratios) is done continuously by the Arduino Mega on-board analog digital converter (ADC). The result is serviced by the “ADC Conversion Complete” interrupt vector using the code listed below. (Note the code shown also services the air/fuel ratio bank1 and bank2 signals.) The conversion is done with the ADC prescaler set to 128 (the maximum setting). All things accounted for (conversion time, interrupt routine execution, multiplexed sampling) the Manifold Air Pressure is measured approximately every 300 microseconds. (At 7000 RPM, one engine revolution takes 8500 microseconds.)

void setup()
  // setup ADC
  ADMUX = B01100000;  // default to AVCC VRef, ADC Left Adjust, and ADC channel 0
  ADCSRB = B00000000; // Analog Input bank 1
  ADCSRA = B11001111; // ADC enable, ADC start, manual trigger mode, ADC interrupt enable, prescaler = 128

ISR(ADC_vect) { // Analog->Digital Conversion Complete
  // Channel0: MAP, Channel1: AFRb1, Channel2: AFRb2
  static byte SeqIndex = 0;
  char ADCch = ADMUX & B00000111;  // extract the channel of the ADC result

  byte StdSequence[3] = {0,1,2};
  if (SeqIndex >= 3) SeqIndex = 0; // constrain SeqIndex
  ADMUX = (ADMUX & B11100000) + StdSequence[SeqIndex]; // set next ADC channel
  ADCSRA = B11001111;  // manually trigger the next ADC, ADC enable, ADC start, manual trigger mode, ADC interrupt enable, prescaler = 128
  // process the ADCch data (use the Left Adjusted ADC High Byte)
  if (ADCch == 0) {
    ManifoldAirPressure = constrain(15 + ADCH, 0, 255);  // MPX4250 sensitivity 20mV/kPa.  15 kPa offset
    MAPindex = constrain((ManifoldAirPressure - 80) >> 2, 0, BoostPressureIntervals_LookupTable-1);  // index: 0->25 = kPa: 80-180
  else if (ADCch == 1) {
    AirFuelRatioB1_ADCH = ADCH;
  else if (ADCch == 2) {
    AirFuelRatioB2_ADCH = ADCH;

Note that the value stored in “ManifoldAirPressure” has units of kPa. By coincidence the calculation is extremely simple. Firstly, there is a -15 kPa bias in the sensor (calibrated at atmospheric pressure) so a 15 kPa offset is introduced. Second, only the high byte of the ADC result is used providing 8-bit precision for the 5V Vcc reference. This provides a resolution of 19.6 mV (5V/255). The MPX4250 has a published sensitivity of 20mV/kPa for a supply voltage of 5.1V. At 5.0V supply the sensitivity is 20*5/5.1 = 19.6mV/kPa. Thus there is a practically exact 1:1 relation between the ADC result and the pressure in kPa.

The “MapIndex” variable is simply a lower resolution expression of the Manifold Air Pressure. It stores an array index value between 0 and 25 that represents the MAP in the range of 80-180 kPa. The practicality of this is that in this specific application ignition timing only needs adjustment when the MAP approaches or exceeds atmospheric pressure, and a resolution of 4 kPa is more than sufficient.



No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: