Honeywell Pressure Sensor Troubles - Help?

My sensor: SSCDANN150PAAB5
Sensor Datasheet: Safety and Productivity Solutions | Honeywell

Below is my script:

int sensorPin = A0; // select the input pin for the pressure sensor
int pressure = 0; // variable to store the value coming from the sensor
int raw = 0;
float voltage = 3.3;
float supply = 5;
float error;
void setup() {

  • Serial.begin(9600);*
    }
    void loop()
    {
    _ error = 0.1*supply;_

  • // read the value from the sensor:*

  • raw = analogRead(sensorPin);*
    _ voltage = raw * ( supply / 1023.0);_
    _ pressure = (voltage - error ) * (150/(0.8*supply)); //convert reading to PSI_

  • // output reading*

  • Serial.print("Pressure: " );*

  • Serial.print(pressure);*

  • Serial.print(" PSI");*

  • Serial.println("");*

  • Serial.print("Raw: " );*

  • Serial.print(raw);*

  • Serial.println("");*

  • delay(500);*
    }

Verified that my wiring connections are correct.

I am applying 100PSI to the system (known PSI of the source) and I am not getting accurate readings.

Can anyone spot anywhere in my script that may be source of the issue?

Also, my sensor is reading ~20 PSI in the room (situated in California) (raw value: ~220) - can anyone verify if this makes sense?

When I apply 100 PSI it reads 150 PSI (I feel it would be much larger but that is the measurement limit of the sensor - so I have a feeling my math in the script is off).

Untested.
Assuming sensor is 0-150 PSI.
Offset/max values are calculated from the datasheet (2.5% and 97.5% of VCC).
Adjust if needed.
Leo..

int offset = 26; // zero pressure adjust
int fullScale = 997; // max pressure adjust
float pressure; // final pressure in psi

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

void loop() {
  pressure = (analogRead(A0) - offset) * 150.0 / (fullScale - offset);
  Serial.print("Pressure is  ");
  Serial.print(pressure, 1); // one decimal place
  Serial.println("  psi");
  delay(500);
}