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:
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:
Is there anything obvious that could give me this error?
Why could there a difference between the arduino reading and the voltmeter reading?
Is it because I haven't put resistors anywhere, like between the pressure sensor and Arduino?
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
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..
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.
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..
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.