Freescale pressure sensor, model MPXV5010GP

I'm hoping that someone could help me out there, I'm trying to interface with a Freescale pressure sensor, model MPXV5010GP with a Sanguino (w/ breakout board).

I've followed the notes found at http://spiffie.org/electronics/archives/microcontrollers/Arduino%20and%20Freescale%20MPX%20Pressure%20sensors.html

On the sensor, I have pin Pin 2 connects to +5 (VCC). Pin 3 connects to Analog #0 (Pin 24 on the Sanguino), Pin 4 connects to Ground (GND).

When I measure the voltage on Pin24 and GND I get ~690mV which is what I'd expect as I understand this is the offset voltage for the sensor. However, using the following code:

// AnalogInput

int potPin = 24; // select the input pin for the potentiometer int val = 0; // variable to store the value coming from the sensor

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

}

void loop() { val = analogRead(potPin); // read the value from the sensor // stop the program for some time Serial.print(val); }

I get readings of 336-350, which I'm calculating to 1.75v. I have a tube running from the port on the sensor to open air... then I push the tube in a glass of water.

a.) Why is the AnalogRead function giving me 330-360, when I (think) i should be getting around 120 for the .6v. b.) Why is there no voltage change as the tube gets pushed into the water?

int potPin = 24;
...
val = analogRead(potPin);

If you have the pressure sensor connected to the Arduino's analog input 0, you'll need to write:

int potPin = 0;

Pin numbers are Arduino numbers, not the AVR chip's pin numbers.

Thanks.... but I'm using a Sanguino so it's actually pin 24 for analog 7. Although I see put the wrong pin in my description, pin 3 is actually connected to Analog 7, or pin 24.

My Sanguino uses 0 to 7 when calling analogRead()...

Yes, the argument to "analogRead()" is an analog channel number, not a physical pin number. So for the first analog input channel, you need "analogRead(0)", and so on.