Author Options:

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.


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


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

void loop()  {
  //Analog pin 0 as input
  int aValue=analogRead(0);

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

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

  //print to screen
  Serial.print("Digital: ");
  Serial.print(" Volts: ");
  Serial.print("Pressure: ");

Good Luck,
MIT Sea Perch

Hi excuse me, can i use a piezoelectric (buzzer) like a depth sensor? Thank U so much!

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.

Allright, sweet. Thanks. I think that'll be perfect.

@MITSeaPerch Excellent algorithm. One question though. How would you water proof it? It seems that the sensor is inside the spout which would make it not read if you placed it inside a balloon or something. This is an old post, but I was wondering if anyone had any thoughts.

Pressure would be an excellent method. 14 PSI/32 ft nice range too.