# What could I use for a depth sensor in a SeaPerch ROV? Answered

I am in the process of building a SeaPerch ROV, and I want to add a few sensors with an Arduino. I have the other ones figured out, but I can't figure out what I could use for a depth sensor. I've thought about using a pressure sensor and calibrating it to give me a rough estimate of how deep it is, but I don't think that'll work too well. So if someone has some ideas for what I could do for this, that would be quite helpful. Thanks.

Tags:

## Discussions

Hello.
I recommend using MXP4250 gauge pressure sensor found on Digikey.com for around \$15.

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=MPX4250AP-ND

It has a pressure range from 2.9psi to 36psi, which would roughly correlate to 24.8 meters of depth following a derivation of the hydrostatic pressure law (http://en.wikipedia.org/wiki/Fluid_statics), and puts out 0-5 volts, perfect for the arduino.

pressure = rho * g * h

(there are many assumptions and generalizations included in this derivation, check the wiki for more info, but these are acceptable generalizations to make in shallow water, and if your results can have loose tolerances, i.e. +- 1 foot error)

where rho is the density of a fluid (1022 kg/m^3 for salt water)
g is the gravitational constant (9.81m/s^2 on earth)
and h is the depth in meters

As for the Arduino ...

This has not been tested, but should be close.  I tried to explain the constants that I arrived at by the commented out code before the constants.  If you use the general idea of getting a digital value from the analog in, and interpolating to find pressure, then using the hydrostatic formula to find depth, and read the data sheet, you should be good to go.

void setup()  {
//initialize serial port (defined in help menu) at 9600 baud
Serial.begin(9600);
}

void loop()  {
//Analog pin 0 as input

//double volt=digital/[(dig_max-dig-min)/(volt_max-volt-min)]
double volt=aCalc/204.8;

//pressure=[{(press_max-press_min)/(volt_range_max-volt_range_min)}
//{(dig_max-dig_min)/(volt_max-volt_min)}] * (digital-dig_offset)
double pressure=0.037711935*(aCalc-41);

//print to screen
Serial.print("Digital: ");
Serial.println(aValue);
Serial.print(" Volts: ");
Serial.println(volt);
Serial.print("Pressure: ");
Serial.println(pressure);

//delay
delay(1);
}

Good Luck,
MIT Sea Perch

Correct me if I'm wrong, but I think the depth range is less than 24.8 m since this sensor measures absolute pressure, so p = rho*g*h + p_atm.

While 36 psi does correspond 24.8 m of depth, we have to consider atmospheric pressure as well, which is an additional 15 psi. So the max pressure depth is 36-15 = 21 psi, which corresponds to 14.7 m.