# Pressure Sensor

I have a pressure sensor I would like to use with an Arduino. I can’t find an equation that will give me an out put of 15 psi.

Pressure Sensor 785-SSCSNBN015PGAB5 from Mouser Electronics.
Reads an analog input on pin 0, converts it to voltage, then to PSI for a pressure of 0 to 15 PSI.
pin 1 nc, pin 2 +5V, pin 3 Sig, pin 4 GND.
Arduino read analog input 51 = .25V = 0 and 972 = 4.75V = 15. (1023 is max for the Arduino)
*/

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 10, 11, 5, 4, 3, 2);

void setup()
{
lcd.begin(16,2);
Serial.begin(9600);
}

void loop()
{
// read the input on analog pin 0:
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V) then to 0 to 15 psi:
float PSI = ((analogRead(A0) - 51 ) * 15) / (972 - 51);

// print out the value on lcd you read:

lcd.setCursor(0, 0);
lcd.print(raw);
lcd.print(" raw");
lcd.setCursor(0, 1);
lcd.println(PSI);
lcd.print(" PSI");

// print out the value you read:

Serial.print(raw);
Serial.print(" raw");
Serial.print(" “);
Serial.print(PSI);
Serial.println(” PSI");

delay(500);
}

Try this (untested).
Leo..

``````int rawValue; // A/D readings
int offset = 102; // zero adjust
int fullScale = 922; // max pressure (span) adjust
float pressure; // final pressure

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

void loop() {
pressure = (rawValue - offset) * 15.0 / (fullScale - offset);
Serial.print(rawValue);
Serial.print("\tPressure is  ");
Serial.print(pressure);
Serial.println(" psi");
delay(500);
}
``````

float PSI = ((analogRead(A0) - 51 ) * 15) / (972 - 51);

This one calculates using 16bit interger math. Result: 'overflow'

Change 15 to 15.0 alters to type float.