# analog Gauge Pressure sensor to arduino uno

HI Guys i really am in need of help

I have a MPX5700GP pressure sensor, it has a 0- 700kPa gauge pressure range and a 0-5V output voltage. The sensitivity is 6.4mV/kPa. its my design project for college.

My problem is I dont know how to take the volages and compensate the values accordingly, the output voltage on the sensor compared to the values displayed serially are not the same.

if my sensor is reading no pressure. the voltage output is 0.20V but if i display the analog value it shows 40.

im really lost. could somebody help me. i have recorded a range of values with pressure accordingly. if any data is needed. i will send. please help

More information required :

Circuit in use Code you are using Data you are seeing (pressure versus voltage versus counts)

based upon the info you gave:

``````// averaging for noise removal
float sum = 0;
for (int i=0; i< 16; i++) sum += analogRead(A0);
sum /= 16;

float voltage = 5000.0 * sum /1024.0;  // mV
float pressure = voltage/6.4;  // kPa
``````

hey thanks for the info, but why is the a count of 16?

because after i get my readings i still need time to save the data to the eepropm and timestamp it

16 is because that is a number that balances the extra time and the result quite well for most sensors I have used. The averaging is not strictly needed as you can handle noise also otherwise e.g. by a low pass filter.

Can you post your sketch sofar?

Arduino Readings and Analog Readings

Apllied pressure (kPa) Vout of sensor (mV) A0 output 0 208 49 50.04 526 105 100 847 170 150 1168 236 200 1490 301 250 1813 367 300 2132 434 350 2459 500 400 2785 567 450 3110 633 500 3437 700

i am battling to send my datasheet and pic. but these are my readings

dorain: Arduino Readings and Analog Readings

Apllied pressure (kPa) Vout of sensor (mV) A0 output 0 208 49 50.04 526 105 100 847 170 150 1168 236 200 1490 301 250 1813 367 300 2132 434 350 2459 500 400 2785 567 450 3110 633 500 3437 700

i am battling to send my datasheet and pic. but these are my readings

Well a simple map() function set up to use the 'calibration' numbers you are seeing is one way to skin the cat.

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

void loop()
{
int val = analogRead(A0);
val = map(val, 49, 700, 0, 500);
Serial.println(val);
}
``````

Lefty

The map solution is probably the simplest, below my code adjusted for the zero calibration

``````// averaging for noise removal
float sum = 0;
for (int i=0; i< 16; i++) sum += analogRead(A0);
sum /= 16;

float voltage = 5000.0 * sum /1024.0;  // mV
float pressure = (voltage-208)/6.4;  // kPa
``````

okay thanks guys, but im still not getting the pressure values on the serial monitor. im getting so stressed out here. please any advice. am i making a mistake or is there a problem with my arduino?

It would be easier to help if we could see your code.

dorain: okay thanks guys, but im still not getting the pressure values on the serial monitor. im getting so stressed out here. please any advice. am i making a mistake or is there a problem with my arduino?

Can you be a little more specific of what exactly is stressing you out? What is your expectations Vs what you are getting? And of course your code will be to be seen to offer any corrections if indeed there are correction needed.

Lefty

Hello folks, I am using G1/4 Pressure Transmitter Sensor 0-1.2 MPa sensor can you guide for programming part.The conversion of bar to pascal or bar to Mpa or pascal to psi.Though I am new to it.Plz guide me .