Hi! I am using honeywell ASDX-RR-X-005PG-A-A5 differential pressure sensor. The problem is,
The sensor shows constant value no matter how much the pressure i give
I am not sure if I am coding the transfer function properly..
int SensorPin = A2;
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.print("P: ");
Serial.print(getPressure());
Serial.println("kPa");
delay(1000);
}
float getPressure(void) {
float pressurePSI,pressureKPA,pressureVDC;
int pressure;
pressure = analogRead(SensorPin);
pressureVDC = (float)pressure * 0.0048828125; // (5/1024 = 0.0048828125) <- is this needed for analog output?
pressurePSI = (pressureVDC*0.8) + 0.5; //transfer function; i am not sure if this is right..
pressureKPA = pressurePSI*6.89476;
return pressureKPA;
}
Attached is the datasheet.
I tried many codes from internet and this forum and still haven't found the proper one..
Seems I need to declare the min and max voltage and pressure too?
You have understood that the pin numbering of the device is non-standard. ? It is not like an IC for example.
You have connected the Vout pin of the device to pin A2 of your Arduino and the GND of the device to GND of the Arduino (and, if there is a separate power supply, to the GND of that as well) ?
have you tried simply printing the value of analogRead( A2 ) without any numeric processing ? You should get a value between 0 and 1023 (if your Arduino has a 10 bit ADC resolution) which varies with pressure.
When I use your calculation, then a analog value 0 gives 3.45 and a analog value of 1023 gives 31.00. You should see a change.
You could disconnect the sensor and connect a wire from A2 to GND and then to 5V to see if something changes.
Could you measure the voltage at A2 with a multimeter ?
Can you show a photo of the sensor and the wiring ?
So the "A5" at the end means 5V and from 10% to 90% ?
And the "005PG" means 5 psi range ?
Does that mean that the minimal pressure is 0 psi and the maximum pressure is 5 psi ? The datasheet is very confusing.
Then 0 psi is 10% of 5V = 0.5V ?
Then 5 psi is 90% of 5V = 4.5V ?
int rawADC = analogRead( SensorPin);
float voltage = (float) rawADC / 1024.0 * 5.0;
float psi = (voltage - 0.5) / 4.0 * 5.0; // fix offset, divide by voltage range, multiply by pressure range.
This sensor is ratiometric, that means that the output is according to VCC. That matches the calculation, since the 5.0 Volt is no more in the resulting psi value. If the VCC drops to 4.5V, the calculation still gives the right pressure value.
You have understood that the pin numbering of the device is non-standard. ? It is not like an IC for example.
You have connected the Vout pin of the device to pin A2 of your Arduino and the GND of the device to GND of the Arduino (and, if there is a separate power supply, to the GND of that as well) ?
have you tried simply printing the value of analogRead( A2 ) without any numeric processing ? You should get a value between 0 and 1023 (if your Arduino has a 10 bit ADC resolution) which varies with pressure.
Hi!
Err.. i attach the picture of the my sensor wiring.. i guess there is no problem on it?
Yeah
I attach the picture as well. I don't know why arduino forum doesn't let me post pictures
So, when I take raw data, the sensor will show a value of 382 regardless of the pressure i blow into the tube. Weirdly, the data changes when I block the other tube with my finger.. (yet still no air flow to give pressure difference) only for a while and then.. it returns to normal.
Koepel:
When I use your calculation, then a analog value 0 gives 3.45 and a analog value of 1023 gives 31.00. You should see a change.
You could disconnect the sensor and connect a wire from A2 to GND and then to 5V to see if something changes.
Is it okay? I am afraid it will break the sensor..
Koepel:
Could you measure the voltage at A2 with a multimeter ?
Can you show a photo of the sensor and the wiring ?
Okay, it is attached
Koepel:
So the "A5" at the end means 5V and from 10% to 90% ?
And the "005PG" means 5 psi range ?
Yes..
Koepel:
Does that mean that the minimal pressure is 0 psi and the maximum pressure is 5 psi ? The datasheet is very confusing.
Yes! It is soo confusing! Took me days of multiple 'should i do this or not' things because i need to do this for my thesis and I need to measure negative pressure. I don't even know if the datasheet tells me it is possible.. Because it is differential pressure, so it can measure negative? I don't know if it can measure -5 psi..
Koepel:
Then 0 psi is 10% of 5V = 0.5V ?
Then 5 psi is 90% of 5V = 4.5V ?
int rawADC = analogRead( SensorPin);
float voltage = (float) rawADC / 1024.0 * 5.0;
float psi = (voltage - 0.5) / 4.0 * 5.0; // fix offset, divide by voltage range, multiply by pressure range.
This sensor is ratiometric, that means that the output is according to VCC. That matches the calculation, since the 5.0 Volt is no more in the resulting psi value. If the VCC drops to 4.5V, the calculation still gives the right pressure value.
I tried your code and in starting condition, it gives 11.85 kpa value. weird..
lilbro:
So, when I take raw data, the sensor will show a value of 382 regardless of the pressure i blow into the tube. Weirdly, the data changes when I block the other tube with my finger.. (yet still no air flow to give pressure difference) only for a while and then.. it returns to normal.
5 PSI (full scale deflection) should be detectable if you breath in to it. Typical would be 2 PSI according to this.
I suppose if you block 1 inlet, the pressure is 0 PSI and at the other is about 14 PSI (atmospheric pressure)
I guess that if is a differential gauge, then when both sides are at equal pressure, you should get a mid scale reading. That would be 512 if everything is at 5 volts (UNO ADC is 10 bit). However, it appears that you have connected the device to the 3,3 volt source (if I interpret your picture correctly) which reduces that to 337.
But looking at the datasheet, it does not look like a differential pressure device. For a differential 5PSI device, the product code looks to me like ASDX-RR-X-005PD-A-A5. (note the PD) Maybe the bottom inlet you are breathing into (according to the picture) is only the diaphragm housing vent. Try blowing into the top inlet.
lilbro:
Hi! I am using honeywell ASDX-RR-X-005PG-A-A5 differential pressure sensor.
That part number is not a differential pressure sensor. Its a gage sensor, thats what the 'G' in 005PG stands for.
Its designed to measure the pressure relative to atmospheric in a flowing gas stream.