pressure sensor (0.5V to 4.5V ) 174 PSI stability issue

Hi,

I am trying to measure the water level based on water static head. I used pressure sensor (range 0.5 v at 0 PSI to 4.5V ,174 PSI) sketch is below:

const int Sensor_Pin = A0;
float Analog_reading;
int Pressure;
int percentage;
int head;
int Inch;

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

void loop()
{
  Analog_reading = analogRead(A0);
  Pressure = ( Analog_reading - 102 ) * 174 / 821 ;
  head = 2.31 * Pressure / 1 ;
  Inch = head * 12;

  percentage = map(Pressure, 0, 30, 0, 100);

  Serial.print(" Analog = ");
  Serial.print(Analog_reading);
  Serial.print(" PSI = ");
  Serial.print(Pressure);
  Serial.print("  head =");
  Serial.print(head);
  Serial.print(" feet");
  Serial.print(" Inch= ");
  Serial.print(Inch);
  Serial.print(" %= ");
  Serial.println(percentage);

  delay (500);

Serial Out put:

 Analog = 102.00 PSI = 0  head =0 feet Inch= 0 %= 0
 Analog = 104.00 PSI = 0  head =0 feet Inch= 0 %= 0
 Analog = 104.00 PSI = 0  head =0 feet Inch= 0 %= 0
 Analog = 103.00 PSI = 0  head =0 feet Inch= 0 %= 0

At pressure 

 Analog = 116.00 PSI = 3  head =6 feet Inch= 72 %= 10
 Analog = 116.00 PSI = 3  head =6 feet Inch= 72 %= 10
 Analog = 116.00 PSI = 3  head =6 feet Inch= 72 %= 10
 Analog = 114.00 PSI = 2  head =4 feet Inch= 48 %= 6
 Analog = 115.00 PSI = 3  head =6 feet Inch= 72 %= 10
 Analog = 115.00 PSI = 3  head =6 feet Inch= 72 %= 10


}

Is there problem in calculations / low resolution / power supply issue.

I use on board 5V and also external 5V stable power but results are same.

I want to achieve the accuracy in inch. can it will resolve with ADS 1115 external ADC.

Ghulamfarid:
I want to achieve the accuracy in inch. can it will resolve with ADS 1115 external ADC.

Seems you bought the wrong sensor.
A 12bar sensor (guessed from the 174 PSI) has a span of 120meters of water.
Measure that with the 10-bit A/D of an Arduino (820 useable values), then you have a theoretical resolution (steps) of 120/820= 14.6cm or 6 inches.
No way to lower that resolution to 1 inch.

An ADS1115 is a poor solution, since you need a ratiometric A/D (the Arduino) for a sensor like that.
Using an absolute/voltage A/D (the ADS) will result in instability/drift of the readout.
Leo..

Wawa:
Seems you bought the wrong sensor.

Yes I realized that after buy. I need some favor, Just review the sketch and confirm that software side there is no problem. If I want to use external ADS1115 than what will be here:

Pressure = ( Analog_reading - 102 ) * 174 / 821 ;

Do you think below sensor will work as I expect also I will shift from volts to ma.

0 to 0.2 Mpa (4 to 20 ma)

What is the maximum head you want to read? 174 PSI is close to 400 feet of water, (120) meters.

JCA79B:
What is the maximum head you want to read? 174 PSI is close to 400 feet of water, (120) meters.

30 feet

percentage = map(Pressure, 0, 30, 0, 100);

30 feet of water head is about 13 PSI, 0.9 bar, 90 kPa. You need a pressure transducer with a range of 15 to 20 PSI, 1 to 1,5 bar or 100 to 150 kPa, compatible with water, with a 0 to 5 volt, or 0.5 to 4.5 volt, or serial output like I2C or SPI.
The one you linked, with 0.2 MPa (29 PSI, 2 bar, 200 kPa) range would work but has the added complication of needing a load resistor to convert the mA output to voltage, plus needing an 8 volt + power supply, try to find one with the output type I listed.