Go Down

Topic: Heavy PSI Air Pressure Sensor Reader (Read 28863 times) previous topic - next topic

n0tn1c3

I have searched and not found any information on this so decided will make a thread to help out in the future.
I am attempting to read the air pressure from a vehicles air suspension. I am using 1/4" port air pressure sensors, Arduino nano and Arduino compatible LCD screen for output. My current goal is to read in from one sensor and display the current PSI.


Working Voltage: 5VDC
Output Voltage: 0.5-4.5 VDC
Sensor material: Carbon steel alloy
Working Current: <=10 mA
Working Pressure Range: 0-1.2 MPa
Cable length: 17cm / 6.69inch
Sensor Length: Approx. 5.1cm / 2.01inch
Screw Diameter: 1.3cm / 0.51inch
Destroy Pressure: 3.0 MPa
Working TEMP. Range: -20 to 85 Celsius Degree
Storage Temperature Range: 0-85 Celsius Degree
Measuring Error: +_ 1.5 %FSO
Temperature Range Error: +_3.5 %FSO
Response Time: <=2.0 ms

These have 3 wires. Power, Ground, And Signal.

My first question would be how to connect with sensor to the NANO board?
I see that power and ground can go to where it needs to and then the signal does to the board.

And then how would i lay out the code. I am very knowledgeable with C. I've seen many i can edit but feel like i can have something very simple to start with.

Any input or advice is welcomed. Will update on progress

Wawa

Black to ground.
Red to +5volt.
Yellow to A0.

Start with simply reading the A/D value.
Report back.
Leo..
Code: [Select]
void setup() {
  Serial.begin(9600);
}

void loop() {
  int sensorValue = analogRead(A0);
  Serial.println(sensorValue);
  delay (500);
}

n0tn1c3

Alright so i haven't forgotten about this project. i have just recently got all my hardware and finally figured out how to wire up this cheap TFT touch screen. ( which turns out to be pretty cool)

So i have it reading the sensor but the number is way off or doesn't even work. I've test with another manual pressure reader and never matches and doesn't even move. This reads around 1020 and fluctuates -10 and +10 ever now and then. I've left the sensor by its self with out any pressure and with pressure. and then i disconnected the sensor and ran the code and it returned numbers in the hundreds.

Using Arduino NANO, 2.8" LCF TFT touch Screen and 0 - 1.2mpa sensor
Mpa will be converted to PSI which 1 Mpa = 145.038 PSI

Here is my code so far, if any all input is appreciated.

int sensorValue = analogRead(A5);
 tft.println(sensorValue);
 delay (500);

Wawa

So you tried the sensor with the sketch I gave you. And you got the right A/D values.
And then you wrote the code to convert those A/D values to pressure readings.
And calibrated offset and span,
And you made sure that all worked before you tried to connect the TFT screen.
Skipping several steps would not be wise.
Leo..

n0tn1c3

First I used the. Ode you provided. Did all with the serial screen. Received a value around 300 and when blowing into the sensor you could see it jump like 10 numbers. So that's not the acurate reading to begin with but I said hey it must be something I'll need to convert later. So I added the screen. Received numbers around 1000 and when blowing I to rise around 10 numbers as well. Now it stayed at 1020 or 1021 or so with the screen attached. I'm going to use the serial screen and said we if I can get the numbers right. Thanks

jremington

#5
Dec 28, 2015, 05:09 pm Last Edit: Dec 28, 2015, 05:16 pm by jremington
"blowing into the sensor" is not a valid test of a sensor intended to measure up to 10 bar, or 150 PSI. The pressure difference is probably too small for the sensor to measure.

However, if you have connected the sensor properly I would expect about 0.5 V at the output, at atmospheric pressure, which does not agree with an ADC reading of > 1000 on a 5V Arduino.

Try measuring the output voltage with a multimeter.

n0tn1c3

#6
Dec 28, 2015, 07:01 pm Last Edit: Dec 28, 2015, 07:18 pm by n0tn1c3
I did not get to use a multimeter to test the output. However the jumper for my signal was bad. Now correctly I am getting a consant number of 110 at 0 PSI or 0 Mpa.

I have continued testing numbers and resulted in 330 (327) at 40 PSI (.2758 Mpa) and dropping back down 280 (282) at 22 PSI (.1517 Mpa)

Now I beleive psi or Mpa either choice. I have to use that number and convert it. Is that correct?

jremington

If you want to measure the pressure accurately with that sensor, you need to calibrate it against one or more accurately known pressure values. Adafruit has a pretty good overview on how to do that.

Wawa

Try this.
Change the offset value (second line) to the number you get in the serial monitor without pressure (zeroing).
Adjust the "fullScale" value for the right readout at full pressure (calibration).

If that works, think about adding "smoothing" for more stable readings.
Leo..
Code: [Select]
int rawValue; // A/D readings
int offset = 102; // zero pressure adjust
int fullScale = 922; // max pressure (span) adjust
float pressure; // final pressure

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

void loop() {
  rawValue = analogRead(A0);
  Serial.print("Raw A/D is  ");
  Serial.print(rawValue);
  pressure = (rawValue - offset) * 1.2 / (fullScale - offset); // pressure conversion
  Serial.print("   The pressure is  ");
  Serial.print(pressure, 3); // three decimal places
  Serial.println("  Mpa");
  delay(500);
}

n0tn1c3

#9
Dec 30, 2015, 04:27 am Last Edit: Dec 30, 2015, 04:49 am by n0tn1c3
Thank You Wawa. Ive tried the code and edit it. Ive done 6 test  to collaborate the PSI with my air tank and another pressure reader. Ive got it down to be very accurate and if its off it is less than .99 of a PSI which is very little. I had to break down the formula in separate equations to make it accurate. Right now i am reading in 3 air pressure transducer and displaying the PSI on the screen.

n0tn1c3

Now that I am successful in this set up. I am trying to tweak it. First of I would like it to stop blinking every time it updates. I would prefer a nice change in number. I know this may not be possible. But if anyone knows of how, it would be much appreciated

Wawa

#11
Jan 02, 2016, 10:45 pm Last Edit: Jan 02, 2016, 10:47 pm by Wawa
Now that I am successful in this set up. I am trying to tweak it. First of I would like it to stop blinking every time it updates. I would prefer a nice change in number. I know this may not be possible. But if anyone knows of how, it would be much appreciated
Don't know if you can do this with your display..
I write the words to my display in "setup".
And write/update only the numbers in "void loop".
Faster updates is no (visable) flickering.
Leo..



kpraveen

Can you please give details of the pressure sensor. I mean datasheet or model number .....

Thanks.

shreyastechno@gmail.com

lucian_v

@kpraveen - I am using this one

https://www.aliexpress.com/item/New-Electric-Unit-Pressure-Transducer-Sensor-Oil-Fuel-for-Gas-Water-Air-Easy-removal-Carbon-Steel/32673407346.html?spm=a2g0s.9042311.0.0.ZKdGTg

There are many providers and seems difference is on the max pressure that they are able to measure

Anudiip

hi,n0tn1c3

can i have the pressure tranducer code please..i am doing air pressure experiment for the flow of oxygen in the tank.

Go Up