I am working on a project that involves daisy chaining analog pressure sensors. Right now I am working on getting just one sensor to give me correct readings. I am using the Honeywell ABPDRNN100PGAA5 analog gage sensor with the following datasheet:
I just attached GND, Vin, and Vout pins directly to the Arduino. This is the code I am using. Is this code okay, or do I need to add things? Even when the pressure changes, the change in values is very small in my serial readings. Based off of the datasheet, I am assuming readings of 102 are in units of psi? Please help or give any guidance if you have. Thank you.
//pin 1 to GND
//pin 3 to A0
//pin 6 to 5V
int sensorPin = A0;
int sensorValue = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
delay(500);
}
The output is ratio metric , refer to the data sheet - the analog output appears not to be calibrated ( unsure from a quick read, digital is ) and goes from 10% to 90 % of the supply voltage
( which is also the ref voltage for your A/D)
So 90% ~= 15psi = 0.9*1023
So at 15psi you will read around 920 and at zero psi around 102 , so you have to scale the values , eg use “map” .
The way I do this, is to remove the input offset, divide by the input range, multiply by the output range, add the output offset.
The calculation is good, but some argue that they don't like it.
It is a 5V ratiometric sensor of 100psi with 10% minimal output and 90% maximum output.
Use a 5V Arduino board, use the 5V pin to power the sensor and keep the voltage reference to the default of 5V.
Please don't change the numbers. If you measure the 5V pin and it is 4.8V, then don't change the numbers. The calculation is more a formula to get the psi of a ratiometric sensor.
1023 is the maximum value from the analog input , returned from analogRead .
Have a google of the Arduino analog input , as suggested .
I had assumed from the link you had the 15psi transducer , if you have a 100psi one then your scaling changes , you need to understand how this works and calculate any new factors you need
ABP : Honeywell "ABP" series of pressure sensors.
D : DIP package
RN : Single radial barbed port
N : Dry gases only, no diagnostics
100PG : 0 psi to 100 psi, gage
A : Analog output
A : 10% to 90% of Vsupply (analog), no temperature output, no sleep mode
5 : 5.0Vdc
There are several ways to do this. Your sensor has a 4.0 volt span starting at 10% of VCC and ending at 90% of Vcc do with Vcc = 5.000 volts and your pressure sensor is 0 to 100 PSI. Therefore 0 PSI = 0.5 volts and 100 PSI = 4.5 volts.
Your uc (Micro-controller) A/D (Analog to Digital Converter) is a 10 bit device or 2^10 = 1024 so full scale is 1024 bits and if 5 volts is your reference then 0 to 5 volts = 0 to 1023 bits.
Since 0 PSI = 0.5 volt and 0.5 volt is about 101 bits and 100 PSI = 4.5 volts and 4.5 volts is about 930 bits a crude simple approach would be to just map it. The bottom line simple code would look like this:
void setup() {
Serial.begin(9600);
}
void loop() {
int val = analogRead(0); //sensor out to A0 Analog In Pin 0
val = map(val, 101, 930, 0, 100); //Map to 101 to 930 bits become 0 to 100 psi
//analogWrite(9, val);
Serial.println(val); //Print the value
delay(500);
}
Starting with this crude and simple few lines the code can be improved by for example averaging 10 readings to get one and using float to get a decimal in there so we get places to the right of the decimal. Text can be included following val like PSI and the list goes on. Anyway, the above code works, I applied DC voltages to simulate the pressure transducer outputs. Crude but functional. I would not use it as is but improve upon it.