Strange pressure readings from pressure sensor, can't seem to find the issue.

Hi All,

I have been measuring pressure for a project I am working, cycling a chamber from atmospheric pressure to 700mbar, on and when I measure the voltage to the Arduino from the sensor, I do not get any reading to indicate a drop in pressure, just an oscillating wave on the serial plotter.

Here is the sensor I am working with P/N 7974970 -1 BAR TO 9 BAR:

https://docs.rs-online.com/2349/0900766b8162acfd.pdf

It says 0-5v output. At atmospheric pressure 0 bar Gauge (1 bar absolute) I would expect to see a voltage of 0.5v but the pressure sensor shows the attached image. I put a voltmeter across the V output (to A0) and the Ground pin (to arduino ground) and saw a measurement of 0.63v. Later when the chamber pressure was reduced, I would expect to see a drop in voltage, there wasn't any, just the cycling seen in the attached image at around 1.2v. The pressure chamber was definitely at vacuum (the lid was sealed on tight and couldn't be pulled off anymore)

So the questions I have are:

  1. Is there anything obvious that could give me this error?
  2. Why could there a difference between the arduino reading and the voltmeter reading?
  3. Is it because I haven't put resistors anywhere, like between the pressure sensor and Arduino?
  4. What could be a reason that the pressure doesn't show a change when the pressure drops in the chamber?

Here is the code I used to serial plot the voltage from the output:

int SolenoidB= 8 ;

void setup() {
  Serial.begin(9600);  
  pinMode(SolenoidB,OUTPUT); //That is to let air come out of the chamber to create the vacuum
}

void loop() {
// read the input on analog pin 0
  int sensorValue = analogRead(A0);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (5.0 / 1023.0);
  // print out the value you read:
  Serial.println(voltage);
  delay(100);
}

I massively appreciate any help and would be very grateful if anyone had any ideas for a noob like myself :smiley:

Thanks,

Are you supplying 9-32 volts to the sensor?

Paul

How are you powering the Arduino.
With a 0-5volt sensor, and the needed default Aref, you made the readings also dependent on supply voltage.
Leo..

Hi,

thanks for taking the time to get back to me.

Yes, I am supplying a 24v DC supply to the sensor straight from the mains. I wired it up as mentioned in the data sheet.

You mentioned I was making the readings on supply voltage also Leo, did the code not isolate the A0 input voltage?

Alex

I asked you how you power the Arduino.
Since you're using that power supply as 'reference' to measure pressure voltage against.
I might help if we also knew which Arduino you're using.

Shouldn't you convert A/D value to pressure instead of to volts.
It seems you're not building a voltmeter here.

700mbar from a 10bar sensor is using a small part of it's (and the Arduino's) capability.
Don't expect more than ~70 different pressure steps.
Leo..

Hi Leo,

I am powering the Arduino from the USB on my laptop, it it better to power from a battery?

I have an ARDUINO A000066 Uno R3 DIP Edition, 1.5".

Yeah, sorry. I have been measuring voltage at the moment to see if it changes when the pressure drops in the chamber. I have it converted to pressure in my other code, using the relevant formula:

void LCD_Print(int Pressure)
{
  PREAD = (Pressure/1024)*200;
  lcd.setCursor(0, 0); // Set the cursor on the first column and first row.
  lcd.print(PREAD); // Print the string "Hello World!"
  lcd.setCursor(0, 1); //Set the cursor on the third column and the second row (counting starts at 0!).
  lcd.print("MBAR READING");
}

Ok, I thought the issue with the pressure range would lead to a larger measured range. Would you recommend any good pressure sensors for what I am doing? I was finding it hard to find one that would measure vacuum.

Many thanks again,

Alex

You could try switching to 1.1volt Aref in setup().
That increases resolution about 5x, also makes sensor readings independent of the supply of the Uno.
Not sure if that will fix your problem.
Many things can cause noise, including PC/laptop-sensor grounding/groundloops.
Leo..

Ok, great. Thanks again Leo.

I will give that a try.

Would it be suitable for the ground of the pressure sensor to go to the ground pin on the arduino? or would cause issues?

In theory, both sensor ground and sensor supply negative should meet at an Arduino ground pin.
Leo..

Are you sure you have the 0-5v transducer and not the 4-20mA one ?

If the timescale is in ms the rimple is @ 50Hz, which means you have a grounding problem. Remember you're trying to measure a DC signal so the potential matters. The voltmeter would not work if you connect just one pin.
The internal supply of desktop PC's are notorious for causing potential differences. Laptops are a lot better here.
Volt meters also do a better job in averaging the measurement, which you can do in your code.