Help with interfacing to a pressure sensor

Hi, I bought a MPX4115AP and I am trying to interface it to the Arduino.

It outputs 46mv/kPa, and I want to code it to output values in hPa. 1kPa = 10hPa, so I tried multiplying the analog value by 10 but get very large numbers, which makes sense because it is reading 1 increment (Out of 1024) as 1kPa, which is not the case with this sensor? How would I go about getting readings in hPa from this sensor?

Thanks :slight_smile:

After reading the analog input pin (which has a range of 0-1023) you can use the map function to scale it to any units range you want to associate it with.

http://arduino.cc/en/Reference/Map

Lefty

Hi, yea I considered the map function, however I am still unsure of how to get the values to read in kPa. The sensor says it's operating pressure range is 15 -> 115kPa, which is 150 -> 1150hPa.

So if I did map(val, 0, 1023, 150, 1150); technically I should get a reading in hPa output?

A reading of 1023 is 5000 millivolts. 1 hPa is 4.6 millivolts. So when analogRead returns 1023 the pressure is 5000/4.6 = 1087 hPa

Assuming the output from the sensor is linear, the map function would be:

map( val, 0, 1023, 0 ,1087)

Yeah the output is linear. It's strange because the sensor is reading about 880 just sitting there, and there is no way the room pressure is that low :frowning:

1014 or around that seems more likely. Maybe I am missing something ...

http://au.farnell.com/freescale-semiconductor/mpx4115ap/sensor-abs-press-16-7-psi-867b/dp/1457151

Maybe I am missing something ...

I would measure your Arduino's +5vdc power and see how close you are to +5.00vdc. As the sensor uses the that as it's reference, it's bound to create a offset error if deviated from +5.000.

I would just create a software constant called offset_error that you could add to the raw analog input value as a calibration correction. Give the constant a value (either +/- counts) that makes the sensor match some independent reference value and then see if it tracks accurately over a few days of normal barometric variation.

Lefty

Any luck with interfacing with this pressure sensor?
I'm trying to do connect an Arduino Mega to a MPX12DP.

It's similar to the sensor you are using.

It seems to put out a tiny range, and also, with room pressure, it's putting out about 3 volts. Changing the pressure by blowing into the end makes the needle of my volt meter barely move. But move it does, so I'm thinking there must be a way to hook this up.

Thanks.

CD

Be VERY GENTLE with your pressure sensor. Blow on it to "see if it is working" at your own peril. Maybe put it in a (sealed) empty plastic soda bottle, and gently squeeze bottle to "exercise" it?

Years ago, there was much work with similar sensors by some 1-Wire weather monitoring enthusiasts. Advice above stems from things frequently mentioned back there/ then.

Search Google for "1-wire barometer"... the Bray and Simat articles will give you more than you need (the 1-wire interfacing), but they will also show you some electronics associated with similar sensor... electronics to condition the output... you're just putting an Arduino where they put 1-Wire ADCs.

The pressure sensor that I'm using is much more robust than anything that would be used to measure barometric pressure and it is designed to measure the bellows pressure of the bellows of an accordion.

I'm making a musical instrument that is designed to be blown into.

The sensor puts out miniscule changes in voltage and I may have to use the 'map' function.

CD

If the changes are very, very small, you may want to look at inserting an op amp between the sensor and the Arduino.

Here is the data sheet on the sensor I'm using.

http://www.freescale.com/files/sensors/doc/data_sheet/MPX12.pdf

Which op amp should I use/try? I'm using an Arduino Mega.

CD