Pages: [1]   Go Down
 Author Topic: analog Gauge Pressure sensor to arduino uno  (Read 756 times) 0 Members and 1 Guest are viewing this topic.
Offline
Newbie
Karma: 0
Posts: 7
 « on: April 01, 2012, 05:46:19 am » Bigger Smaller Reset

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
 Logged

SW Scotland
Offline
Edison Member
Karma: 6
Posts: 1053
Arduino rocks
 « Reply #1 on: April 01, 2012, 06:00:14 am » Bigger Smaller Reset

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

Netherlands
Offline
Tesla Member
Karma: 86
Posts: 9355
In theory there is no difference between theory and practice, however in practice there are many...
 « Reply #2 on: April 01, 2012, 06:17:14 am » Bigger Smaller Reset

based upon the info you gave:

Code:
// 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
 Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Offline
Newbie
Karma: 0
Posts: 7
 « Reply #3 on: April 01, 2012, 06:34:05 am » Bigger Smaller Reset

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
 Logged

Netherlands
Offline
Tesla Member
Karma: 86
Posts: 9355
In theory there is no difference between theory and practice, however in practice there are many...
 « Reply #4 on: April 01, 2012, 06:45:14 am » Bigger Smaller Reset

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?
 Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Offline
Newbie
Karma: 0
Posts: 7
 « Reply #5 on: April 01, 2012, 06:53:06 am » Bigger Smaller Reset

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
 Logged

Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15293
Measurement changes behavior
 « Reply #6 on: April 01, 2012, 08:41:29 am » Bigger Smaller Reset

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.

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

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

Lefty
 Logged

Netherlands
Offline
Tesla Member
Karma: 86
Posts: 9355
In theory there is no difference between theory and practice, however in practice there are many...
 « Reply #7 on: April 01, 2012, 10:10:54 am » Bigger Smaller Reset

The map solution is probably the simplest, below my code adjusted for the zero calibration
Code:
// 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
 Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Offline
Newbie
Karma: 0
Posts: 7
 « Reply #8 on: April 01, 2012, 01:59:37 pm » Bigger Smaller Reset

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?
 Logged

New Jersey
Offline
Edison Member
Karma: 24
Posts: 2345
 « Reply #9 on: April 01, 2012, 02:47:55 pm » Bigger Smaller Reset

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

Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15293
Measurement changes behavior
 « Reply #10 on: April 01, 2012, 04:31:43 pm » Bigger Smaller Reset

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

 Logged

 Pages: [1]   Go Up