Pressure transducer problem. Help please

Hallo.

I’m trying to make this pressure transducer (http://www.ebay.com/itm/Pressure-transducer-or-sender-1600-psi-stainless-steel-for-oil-fuel-air-water-/271511515207?hash=item3f3758f047:g:Pv8AAOSw7aBVFBvE&vxp=mtr) to work with my Arduino UNO. It’s a linear sensor that outputs 0.5V at 0psi (0 bar) and 4.5V at 1600psi (110bar) of pressure.
So the gain (k) is about 27.5bar/V.

The code:

double t=0;
double dt=0.1;

#include <stdio.h>

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

void measurePressure(){
int rawReading = analogRead(A1); // Range : 0…1024
float rawVoltage = (rawReading * (4 / 1024.0)) + 0.5; <----- is this right?
float Pressure = (rawVoltage*k);

Serial.print("Time: “);
Serial.print(t);
Serial.print(” rawReading: “);
Serial.print(rawReading);
Serial.print(” Voltage: “);
Serial.print(rawVoltage);
Serial.print(” Pressure: ");
Serial.println(Pressure);

}

void loop() {
measurePressure();
t=t+dt;
delay(100);
}

The rawReading at 1bar is 99-101 but if I translate this into voltage I get 0.89V which is to much. It should read just a little over 0.5V.

The sensor has 3 wires (+5V, GND and Signal). I connected it to the Arduino UNO: +5v sensor to the 5V arduino pin, GND to GND arduino pin and the signal to the arduino analog pin A1.

Please help =)

100/1023 * 5 = 0.489V Perfect!, isn’t it

If math is the problem, use MAP

I sort of doubt that math was the problem.

I’m not sure if this is an absolute or a differential pressure sensor. I got it basicly for free.

As you have pointed out 100/1023 * 5 = 0.489V ----> this corresponds to 1.019bar of pressure (I checked).
The senor gives an output of 0.5V to 4.5V depending on the pressure. If I use simple math to determine the gain of the sensor I get:

k=((110bar-0bar)/(4.5V-0.5V))=27.5bar/V <---- If I use this koeficient in the pressure equation I get 13.3bar of pressure in my office. That’s way to high.

Should I substract the zero pressure voltage from the calculated one? But then the pressure is 0bar which is ok I guess, if it’s a differential pressure sensor.

Input/advice is welcome =)

I guess its relative pressure as it has than ‘open’ top.
analogRead 100 ? => voltage= 0.5 (more or less)

Pressure = (voltage - .5) * 27.5 = 0 (no overpressure… just as it should be?)

known: 0.5V gives you 100, 4.5V gives 921
then: pressure = map(analogRead(A_input),100,921,0,1600); // an int will do fine

110 bar is a hell of a pressure… If your practical use is for pressure, say below 20 bar (<300psi),
I suggest adding an amplifier (gain 4) to get better resolution.

Thank you for the reply.

I understand what you did with the MAP function, but why did you choose the new range to be from 0 to 1600?

I rewrote the code and now it looks like this:

int Newanalog=map(analogRead(A1),100,921,0,1280); <---- at 110bar the reading is 1280 ( (12805/1600)+0.5V =4.5V )
float voltage=Newanalog
(5/1600)+0.5; <----- at atmospheric pressure (reading is 0) U=0.5V
float pressureBar=(voltage-0.5)k; <----- at room conditions the pressure is 0bar (this is realy the differential pressure).
float pressurePa=pressureBar
100000;

Serial.print("Time: “);
Serial.print(t);
Serial.print(” NewAnalog: “);
Serial.print(Newanalog);
Serial.print(” Voltage: “);
Serial.print(voltage);
Serial.print(” Pressure(bar): “);
Serial.print(pressureBar);
Serial.print(” Pressure¶: ");
Serial.println(pressurePa);

My measurements will be at around 50bar so I hope it will be fine. I’m building a solid fuel rocket engine as my bachelors thesis and I have to measure pressure, temperature and thrust. Temperature and thrust readings work perfectly. Pressure is the only thing that’s bugging me.

..sorry. The 'new range' taken from picture, : psi. Interesting project. Good luck