Arduino Forum

Community => Gigs and Collaborations => Topic started by: vareun on Feb 07, 2014, 07:00 am

Title: Help in Pressure transducer coding...
Post by: vareun on Feb 07, 2014, 07:00 am
For my air pressure pump project i'm trying to attach a positive pressure transducer to the system.one of my pal gave me a link and code for the listed sensor below. please help me as I'm trying to learn
http://www.farnell.com/datasheets/8723.pdf
the sensor he mentioned was a Free Scale MPX4115 .
I could not understand the code below even after referring  to the transfer function.

  /* get the pressure */
  val = analogRead(pressurePin);
  pkPa = ((float)val/(float)1023+0.095)/0.009;
  pAtm = kpa2atm*pkPa;

the whole code can be see in:
https://gist.github.com/csete/813836

and also is it possible for me to use the MPX4250 Sensor in the same code. if not what are the differences should be made???
http://www.farnell.com/datasheets/9703.pdf
Title: Re: Help in Pressure transducer coding...
Post by: arduinoadrian on Feb 15, 2014, 04:16 am
You may get better answers if the post is moved to Science and Measurements
Title: Re: Help in Pressure transducer coding...
Post by: robtillaart on Feb 15, 2014, 10:03 am

I could not understand the code below even after referring  to the transfer function.
  /* get the pressure */
1  val = analogRead(pressurePin);
2  pkPa = ((float)val/(float)1023+0.095)/0.009;
3  pAtm = kpa2atm*pkPa;


line 1: reads the value the sensor returns 0..5V mapped upon a value of 0..1023
line 2: converts this value of 0..1023 to a KiloPascal - a unit of pressure
line 3: converts the KiloPascals to atmosphree by multiplying with a constant.

What part do you not understand.?

Quote

and also is it possible for me to use the MPX4250 Sensor in the same code.
if not what are the differences should be made???
http://www.farnell.com/datasheets/9703.pdf

If the sensor has the same pressure to voltage transfer function => yes
else => no

2 answers in the gigs forum, please donate $2 to charity of choice ;)
Title: Re: Help in Pressure transducer coding...
Post by: knut_ny on Feb 16, 2014, 07:54 pm
Select a sensor which has the connection u need.
(some measure relative P, others abs P)
The datasheet will give you the trsnsfer funtion needed to report correct P