MXP2200DP pressure reading

Hi i am trying to use MPX2200 differential pressure sensor with my arduino mega
http://cache.freescale.com/files/sensors/doc/data_sheet/MPX2200.pdf

I cant figure out how to convert the voltage i get from the arduino to Pressure

I would appreciate any help

Thanx in advance

It's default voltage is 10V, and the Arduino Mega is 5V. Do you have 10V ?
The output is very small, maximum 40mV differential voltage and 0.2mV per kPa. I think you need an OpAmp.

In the datasheet the pins are numbered 1,2,3,4 and a schematic show which pins are the voltage and which pins are the outputs. Have you seen that ?

You can try it, and use two analog inputs. But I don't know of the voltage output will be half of the values at 10V.

In the datasheet it mentions no minimum voltage supply so i thought i could test it using 5V supply.

My Vout is the value of the +Vout pin minus the value of the -Vout pin?

My arduino measures about 2.5 V from each pin(I will post a screen later).40 mV should be the max difference i get between my 2 outputs or the max output i get from each pin?

Finally my actual question was about which formula i should use to convert voltage to pressure

Thanx again and sorry for my bad english.

I really don't know if the output is only half with 5V (I should know it though). I also don't know why there is no minimum. It is piezo and trimmed resistors inside, perhaps it does work with 5V.

The two outputs +Vout and -Vout both to an analog input.
There is often an offset, but sometimes the +Vout is the higher voltage and sometimes the lower voltage. You will see for yourself.

I have not tested the code below, it should give a good start.

const int pinVplus = A0;
const int pinVmin = A1;
const float offset = 0.0;        // 0.0 for now, adjust this.
  ...
  float vPlus = (float) analogRead( pinVplus) / 1023.0 * 5.0;
  float vMin = (float) analogRead( pinVmin) / 1023.0 * 5.0;
  Serial.print( F("vPlus[V]="));
  Serial.println( vPlus, 4);
  Serial.print( F("vMin[V]="));
  Serial.println( vMin, 4);

  float diff = vPlus - vMin;
  diff -= offset;
  Serial.print( F("diff[V]="));
  Serial.println( diff, 4);
 
  // 0.2mV per kPa at 10V.
  // Assume 0.1mV per kPa at 5V.
  // Since the 'diff' is a float in volt, the pressure is 1/0.1mV times the diff.
  // So if the voltage changes 1 mV the pressure changes 10 kPa.
  float pressure = diff / 0.0001;        // 0.0001 is 0.1mV
  Serial.print( F("pressure[kPa]="));
  Serial.println( pressure, 4);

So far so good. But now it gets interesting: Some ATmega chips have a special mode to measure differential voltages. The ATmega2560 has 4 differential inputs that can also set a gain of 10 or 200. Perhaps you can find an example for the ATmega2560 in combination with Arduino.

Hi again and thanx for helping me.

I used your code(i was actually using a very similar code written by me but just in case i was wrong i tried yours too).

The results seemed to be the same i post some pictures below. The first picture is vPlus-Vmin and the second one is vMin - Vplus.
They seem pretty unstable and not realistic i think.
Do you think i should add some other parts to my circuit (resistances capacitors etc.).Right now i have just the sensor hooked up to my arduino

I am looking forward to your reply

That is noisy. It could be worth the effort to try to make it better, but you need an opamp to amplify the signal.
The Arduino Mega has 10-bits ADC, so 0...5V input is 0...1024. That is 5mV resolution. And the total span of the sensor could be 20mV at 5V.

Remove some noise by adding a capacitor of 1nF or 10nF from A0 to GND, and another one from A1 to GND.

You don't have to make an RC-filter, because the 'R' of the RC-filter is the output impedance of the sensor. So just a capacitor is okay, and it won't harm this sensor.

Next thing is using the average, trying to get a maximum resolution. I use 20 samples because that will still fit in an integer. You could try 1000 samples with a long integer.
It is important to divide by 20 with float numbers, so nothing is truncated.
Do this for both analog inputs, and with the capacitor at the inputs, the result could be 10 times more stable.

// Old line : float vPlus = (float) analogRead ( pinVplus ) / 1023.0 * 5.0;

#define NUM_SAMPLES 20
int sumPlus = 0;
for( int i=0; i<NUM_SAMPLES; i++)
  sumPlus += analogRead ( pinVplus );
float vPlus = ((float) sumPlus / (float) NUM_SAMPLES ) / 1023.0 * 5.0;

You need something like this schematics

The whole link is here

Another approach

Another approach would be to use an op-amp in a non-inverting circuit with gain of 125, because the MXP2200 pressure sensor only provides 0-40mV on its output. The MCP6002 is low cost and available here.

Next time use MPX5200DP and forget extra circuits.

Peter_n:
I really don't know if the output is only half with 5V (I should know it though). I also don't know why there is no minimum. It is piezo and trimmed resistors inside, perhaps it does work with 5V.

The two outputs +Vout and -Vout both to an analog input.
There is often an offset, but sometimes the +Vout is the higher voltage and sometimes the lower voltage. You will see for yourself.

I have not tested the code below, it should give a good start.

const int pinVplus = A0;

const int pinVmin = A1;
const float offset = 0.0;        // 0.0 for now, adjust this.
  ...
  float vPlus = (float) analogRead( pinVplus) / 1023.0 * 5.0;
  float vMin = (float) analogRead( pinVmin) / 1023.0 * 5.0;
  Serial.print( F("vPlus[V]="));
  Serial.println( vPlus, 4);
  Serial.print( F("vMin[V]="));
  Serial.println( vMin, 4);

float diff = vPlus - vMin;
  diff -= offset;
  Serial.print( F("diff[V]="));
  Serial.println( diff, 4);

// 0.2mV per kPa at 10V.
  // Assume 0.1mV per kPa at 5V.
  // Since the 'diff' is a float in volt, the pressure is 1/0.1mV times the diff.
  // So if the voltage changes 1 mV the pressure changes 10 kPa.
  float pressure = diff / 0.0001;        // 0.0001 is 0.1mV
  Serial.print( F("pressure[kPa]="));
  Serial.println( pressure, 4);




So far so good. But now it gets interesting: Some ATmega chips have a special mode to measure differential voltages. The ATmega2560 has 4 differential inputs that can also set a gain of 10 or 200. Perhaps you can find an example for the ATmega2560 in combination with Arduino.

Hi, if I use a 12 V dc external supply instead of the 5V dc from Arduino, can I still directly use the analog pin on arduino Mega to output the voltage? thanks.