# Share My Creation Measure water level with Ultrasonic range meter

Discussion in 'B4R Share Your Creations' started by Lahksman, Dec 9, 2016.

My first attemp at creating an arduino project. I developed it for myself to be able to measure the water level in my rain recuperation tank.
Basicly I know the dimensions of my underground tank (cube). By measuring the distance between the sensor and the water, I know the remaining distance to the bottom of the tank. With these variables I'm able to calculate the remaining volume of water.
I also know how much water I spend watering my lawn and plants (automated system). So each LED is equal to 1 watering turn. More then 5 available turns wil just light up all LED's.

My breadboard lay-out is created with a HC-SR04 (4-pin) sonic range meter. But my code (and actual setup) is made with a Parallax Ping)) 3-pin sonic range meter (didn't have the other components available in Fritzing). Basicly I have 1 pin for trigger and echo.

The code isn't perfect yet and is probably over complicated. So any tips for optimization are welcome.

A small video.

With special thanks to @Erel and @inakigarm for the tutorials that pointed me in the right direction.

#### Attached Files:

• ###### sonic_distance_meter.zip
File size:
1.6 KB
Views:
121
Last edited: Dec 9, 2016
jmon, Beja, sanjog shakya and 2 others like this.

How do you compensate for the distance between the tank (the cube) and the sensor? (not the distance between the sensor and the water).
I think your system is a special device that should always be at a pre-defined distance above the tank. May be it should be part of the tank and hanging above it,
attached to it by metal supports or something like that. You may want to think in a more general solution like in the attached image:
Your controller will send 2 light directional beams (IR, Laser..etc) but not Ultra-sonic)

Lahksman likes this.

I perform 1 control measurement on a empty tank to get the distance between the sensor and the bottom of the tank. This distance gets hard coded in my final code. With this value I can calculate the distance between the bottom of the tank and the water level.

For as far as my knowlegde goes, light beams aren't an option to get the water level because they penetrate clear water (correct me if I'm wrong). I could use one to get the total distance between the sensor and the bottom of the tank, but seeing as this project is a personal project, I don't see any advantage is doing this (the distance will always be the same for me).

My controller is integrated inside the tank (which is underground) as shown below.