depth sensor

Other than control. (Navigation, Sonar, Ect.)
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: depth sensor

Post by rossrov »

Cool. Responding to your post got me thinking :o , so I went out and bought an Arduino and cut open a fish finder I've had in storage for years. Also had to repair my ancient oscilloscope - must have a scope to see whats going on in the fish finder. If I get any worthwhile results will post.
User avatar
ROVER3D
Posts: 128
Joined: Nov 9th, 2012, 7:45 pm
Location: Wuppertal, Germany

Re: depth sensor

Post by ROVER3D »

i use an industrial (absolute) pressure sensor with 4-20mA output and 250ohm resistor. So you can easily read 1-5V voltage at ADC. ;)
berossm
Posts: 5
Joined: Jul 12th, 2013, 11:54 pm

Re: depth sensor

Post by berossm »

Just found another option.

http://www.omega.com/pptst/PX180B.html

Rated to 500psi for anyone looking at deeper operating depth. It is in psig so that should make the calculations fairly straight forward.

This is probably what I'll end up using as I'm designing a AUV with a working depth of 500ft and trying to engineer it for 1000ft crush depth. Still very early but I'm focusing on the electronics side of things first and will then work on the hull.
rovdude
Posts: 83
Joined: Sep 17th, 2012, 10:28 pm
Location: Baltimore, USA

Re: depth sensor

Post by rovdude »

This is what I ended up doing, and it worked great:
viewtopic.php?f=16&t=879
fefelegal
Posts: 1
Joined: Jul 8th, 2014, 9:26 am

Re: depth sensor

Post by fefelegal »

Hi guys, I'm also building a ROV and searching for depth sensors I came to this thread. Here is what I can add to the discussion:

I didn't want to buy a pressure sensor so I borrowed one from my teacher. The sensor is MPXHZ6400A (http://cache.freescale.com/files/sensor ... Z6400A.pdf) and ranges from 3 to 58 psi. It can be easily found on eBay or any of these chinese sites (dx, alibaba, etc).

Starting with how deep can it measure? 58psi is almost 4ATM, so in worst case scenario, when you are using your ROV at sea level, you already have 1ATM pressure from air, remaining 3ATM of pressure to go under water. Every 10m you go down in the water, the pressure is increased 1ATM, therefore the maximum depth of this sensor is 30m, which should be enough for most ROVs here, including mine.

This sensor outputs a voltage that linearly increases with pressure, so there are no confusing protocols to read data, just a plain and simple ADC read from your microcontroller. The thing is that, since this sensor requires a 5V VCC, it outputs in a 0.2~4.8 range, which is unsuitable for my microcontroller (TivaC), which only accepts 0~3.3V as an input. I used some resistors to lower this voltage, connecting three 10K resistors in series between VOUT and GND, and getting the read to the ADC between the first two counting from the VOUT. This way a 2/3 factor is applied to VOUT limiting the maximum output to (2/3)*4.8, which results in 3.2V max, right below our ADC max. Now just read the value from the ADC and map it to the actual voltage.

Code: Select all

float voltage = map(sensorValue, 0, 4095, 0, 328);
This is how map works: http://energia.nu/reference/map/ . I used 4095 because TivaC ADC is 12bits [(2^12) - 1)] and used 328 because that is what my TivaC outputs in the 3.3V rail (I measured 3.28 with a VOM). I tried using 3.28 in the map function but it didn't work out, so I just used 328 and then divided by 100. You can map again to 0.2~4.8V, which is the actual output from the sensor, but it isn't necessary. Now, reading the datasheet, we have a formula (which gives us the pressure in kPa):

Code: Select all

VOUT = VS x (0.002421 x P - 0.00842)
VOUT is the voltage I have read, mapped between 0 and 3.28; VS is the supply voltage to the sensor, in this case I measured the supply with a VOM (4.97V) and applied the 2/3 correction factor, giving me 3.31V. Made the changes to the formula and ended up with:

Code: Select all

float pressure = ((voltage/3.31)+0.00842)/0.002421;
This gave me a pressure in kPa which is only 0.1% different from the pressure from a nearby weather station. So this sensor is very accurate.

Now that I have a precise pressure, I'll start doing the math to calculate the depth based on the pressure. I've read some guys saying that you should calibrate the sensor when you're diving your ROV to compensate altitude differences betweek your house and a lake for example. From what I though, it can be automated in the code. In the setup() of your arduino (or msp430 or tivac) just make a few reads (10 for example) and store the mean value in a variable called pressureOffset. This will be done only once when you power your ROV, which happens before putting it into the water. This way it will get a correct read of the current air pressure. When it is underwater, just subtract the offset from the pressure reading and you will get only the pressure applied by the water, making it easy to calculate the depth. This way you can use your ROV at the beach or at Titicaca lake without the need to manually change your code to compensate the altitude.

Having the absolute water pressure and knowing that the pressure linearly increase with depth (1.4psi each 1m deep), just use the map function again to get a precise depth value (with cm precision).

If you have any questions left, feel free to ask :)
Post Reply