MPXV5050dp Differential Pressure Sensor

Hey guys,
I am using a differential pressure sensor to measure air pressure coming from a pneumatic press Device, and I keep getting multiple values read / fluctuations even when the Pressure is constant, and even when the pressure is Zero. I changed the code and tried using another sensors of the same kind but nothing changed, I however used the circuit meant for decoupling and filtering (the one made up of 3 capacitors and is found in the Datasheet) and still nothing changed as well, I also tried different Arduinos but it was not the problem, any OP AMP suggestion ? Can someone please help, it is critical for my project.
Datasheet :
965149514005333mpx5050 (2).pdf (461.7 KB)
Code :

Code.ino (854 Bytes)
Output e.g :
I get 12,662mmHg/12,255mmHg/13,069mmHg/13,477mmHg/14,229mmHg
for a constant Pressure of 30 mmHg
I will so thankfull if someone could help me with it

Please show your code using < CODE> tag.
Please show the output of both voltage and mmHg.
How did you wire the sensor?

Hey DrDiettrich,
Thank you for replying, and sorry if I posted the code in a wrong way it is my first time posting here.
Here is my Code :


int sensorPin = A2;
int sensorValue = 0, sensorMax = 352, sensorOffset = 57;
float voltage = 0, mmHg = 0, voltageMax = 5.0, kpaRangeTopVoltage = 5.0;
 
void setup() {
  Serial.begin(9600);
 // analogReference(EXTERNAL);
}

void loop() {
  sensorValue = analogRead(sensorPin) - sensorOffset;   // offset Adj.
  Serial.print("sensorValue(offset");
  Serial.print(sensorOffset);
  Serial.print("): ");
  Serial.println(sensorValue, DEC);

  if (sensorValue == 0) {
    mmHg = 0;
    voltage = 0;
  } else {
    voltage = sensorValue * (voltageMax / sensorMax);
    mmHg = (((voltage / kpaRangeTopVoltage) - 0.04)/0.018 )/ 0.1333;    // Voltage to Druck to mmHg
  }
  
  

  Serial.print("Voltage: ");
  Serial.println(voltage, 3);
  Serial.print("mmHg: ");
  Serial.println(mmHg, 3);
  Serial.println();
  delay(1000);
}

I wired the sensor as recommended in the Datasheet which means pin 1 is no connection, Pin 2 goes to 5V and pin 3 to ground and pin 4 to A2, and all other pins are no connections.
Output when no pressure is applied :
![Screenshot (27)|690x388](upload://2jEKGswk5oSGF8tbWZD903SAK8e.png)
Output at 50 mmHg pressure Applied :

Output when no pressure is applied :

Cable type, length?

Please show output as text, not as unreadable screenshot.

I used the normal arduino cables the short ones, I also soldered the sensor to the so called Perfboard,
Here is the output as Text

sensorValue(offset57): 122
Voltage: 1.733
mmHg: 127.778

sensorValue(offset57): 122
Voltage: 1.733
mmHg: 127.778

sensorValue(offset57): 125
Voltage: 1.776
mmHg: 131.330

sensorValue(offset57): 119
Voltage: 1.690
mmHg: 124.226

sensorValue(offset57): 123
Voltage: 1.747
mmHg: 128.962

sensorValue(offset57): 121
Voltage: 1.719
mmHg: 126.594

sensorValue(offset57): 124
Voltage: 1.761
mmHg: 130.146

sensorValue(offset57): 125
Voltage: 1.776
mmHg: 131.330

sensorValue(offset57): 120
Voltage: 1.705
mmHg: 125.410

sensorValue(offset57): 122
Voltage: 1.733
mmHg: 127.778

sensorValue(offset57): 121
Voltage: 1.719
mmHg: 126.594

sensorValue(offset57): 121
Voltage: 1.719
mmHg: 126.594

sensorValue(offset57): 124
Voltage: 1.761
mmHg: 130.146

This reading came at a constant 50 mmHg pressure

Are you supplying it with a clean 5V?
Do you have a 1uF and 0.01uF bypass connected to Vs.
Do you have a 470pF capacitor connected to Vout
Which pinout are you using?

Hey Jim,
thank you for replying
I am using the following pinout as recommended in the datasheet:
pin 1 : N/C (no connection)
pin 2 : 5V
pin 3 : Gnd
pin 4 : A2
Pins 5,6,7,8 are no connections (acc. to the Datasheet)

what do you mean with clean 5 v ? I have my Arduino connected to my Laptop via USB, I also tried a battery as supply and it did not work

And yes I used the circuit of 1 and 0,01 µF and the 470 pF as I stated in my question , and still did not help

Can you be a bit more specific? Most probably your cables receive noise from the environment. Ribbon or shielded cable may help to reduce the noise.

A scope can be very helpful in checking analog signals.

I used shielded cables, unfortunatley I have no oscilloscope available

How did you connect the shield? The shield should be connected only at one end, not used as common GND.

A scope should stand on top of your wishlist.

I connected it at one end and did not use it as a common ground

Since the sensor output is ratiometric with the supply
voltage, any variation in supply voltage will also proportionally
appear at the output of the sensor.

The actual voltage measured by the arduino ADC will also vary with the ADC Vref

The offset voltage will also vary

The overall accuracy is only +/-2.5% of full scale or +/- 1.25kPa or +/- 9mmhg

So there a quite a few things to consider when using that sensor.

how can I make the supply voltage as suitable as possible ? any ideas ? because I also believe it is the problem

Use this voltage regulator:

Connect it to the sensor and the Uno Aref pin

If you’re using an external reference on the AREF pin, you must set the analog reference to EXTERNAL before calling analogRead()Otherwise, you will short together the active reference voltage (internally generated) and the AREF pin, possibly damaging the microcontroller on your Arduino board.

The A/D of an Uno (assuming you use an Uno R3) doesn't jump more than one A/D value with a pot or pressure sensor powered from the 5volt pin. Using an external supply and reference will only complicate things. I expect there is something else going on, like soldering.
Would like to see real pictures of the setup.

Wishful thinking. You only have about 900 usable A/D values, which is not enough to display 50,000 values. One stable decimal places is all you get. Oversampling could increase that to two decimal places, but not three.

Try this, with only the sensor directly connected to 5volt/A2/GND of the Uno R3.
If it isn't stable, then I expect hardware problems.
Leo..

const byte sensorPin = A2;
float sensorRating = 50.0; // 50kPa sensor
int offset = 41; // zero pressure adjust
int fullScale = 962; // max pressure (span) adjust
float pressure; // final pressure

void setup() {
  Serial.begin(9600);
}

void loop() {
  pressure = (analogRead(sensorPin) - offset) * sensorRating / (fullScale - offset);
  
  Serial.print("Pressure: ");
  Serial.print(pressure, 1); // one stable decimal place is all you get
  Serial.println(" kPa");
  delay(500);
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.