Introduction: Acoustic Distance Meter HC-SR04 on the 7 Segment 4 Digit Display (measuring Water Depth)

In this instructable an instruction manual is given for building a distance meter with Arduino. The set up is used to measure the total amount of water in a reservoir which is put below the set up. The meter is made of the Arduino Acoustic sensor HC-SR04. The measurements are shown on the 7 segment 4 digit display. This instructable is divided into 10 steps, which shows all the steps of building the set up. The first three steps descripes how to build the Arduino sensor. The rest of the instruction manual gives an overview on how to build the set up and makes it working.

Supplies

Arduino sensor

- 1x Arduino Uno

- 1x Acoustic sensor HC-SR04

- 1x 7 segment 4 digit display

- 1x Breadboard

- 4x 220 ohm resistor

- 16x Jumber wire

- 1x holder for 6 AA batteries

- 6x AA battery

Building set up

- 1x bottle 1.5 liter (preferable flat egdes)

- 1x wooden plate 350x350mm

- 1x wooden plate 350x150mm

- 4x wooden plank 40x15x250mm

- 3x cardboard 350x250mm

- 1x styrofoam 250x125x40mm

- 1x circle of strong paper (no cardboard)

- 2x straw

- Tape/glue (to stick things together)

- 1 liter of water to test the set up

Step 1: Connect the Wires to the Sensor

As a first step the HC-SR04 sensor is connected to the Arduino Uno. The sensor has to be connected as follows:

- Gnd = Gnd

- Echo = A1

- Trig = A0

- Vcc = 5V

Step 2: Connect the Wires to the 7 Segment 4 Digits Display

The 7 Segment 4 Digits Display contains 12 pins in total. 6 wires are connected at the top of the display, 6 to the bottom side. 7 pins are used for the 7 segments of each digits, 1 pin is for the decimal and the last 4 pins are for each of the four digits.

The wires are connected as shown in the picture:

- Display = Arduino

- 1 = 6

- 2 = 5

- 3 = 4

- 4 = 3

- 5 = 7

- 6 = 13

- 7 = 2

- 8 = 12

- 9 = 11

- 10 = 8

- 11 = 9

- 12 = 10

The picture above shows the complete sensor.

Step 3: The Arduino Code

After the hardware is installed, the Arduino code has to be written. In the file the code can be find. This codes contains the equation:

distance = -(duration / 2) * 0.343 + x

This equation recalculates the incoming measurements and gives the distance as an output. The x in the equation can be used to calibrate the sensor, because the water level has to be set at a certain starting point.

Step 4: Drilling Holes in the Wooden Plate 350x350mm

The first step in building the set up is drilling the holes in the wooden plate. Three holes in total has to be made. Two for the acoustic sensor and one for the cap of the bottle. The position of the holes are indicated at the picture above. The position of the three holes together on the plate does not has te be precisely, but make sure the holes are on the same line (red line)

- The hole for the cap of the depends on the type of bottle

- The 2 holes for the sensor have the same diameter as the two sensors on top of the acoustic meter (make sure they have the right position relative to each other)

Step 5: Attach the Wooden Planks 40x15x250mm and Wooden Plate 350x150mm

After drillings the holes and the check if the sensor and the bottle cap is fitting into these holes, the 4 wooden planks can be attached to the bottom side of the plate as indicated in the picture above. The planks needs to be put completely in all four corners.

At the bottom side of the plate the wooden plate 350x150mm has to be attached. This plate seperates the hardware part from the place where the water is going into the reservoir. The plate is put on 2/3 of the length of the plate from the left.

Step 6: Attach the Bottle to the System

Next, the bottle is attached to the system. The bottle needs to be cut into two seperate parts. Make sure the bottom half has a minimum height of 130mm and maximum 160mm. The rest of the bottle can be used to collect the water on top of the system.

In the cap of the bottle a hole has to be drilled to make a hole for the straw. After drilling the hole the straw has to be cut to a good size as indicated in the picture above.

The second straw is attached to the bottom half of the bottle. It is important to stick this straw to the inside of the bottle to make sure it will be in the same position.

Step 7: Attach the 3x Cardboard 350x250mm on the System

To make sure the wind does not effect the measurements the system is at three sides closed. Attach the three cardboard plates to the three side of the set up as indicated in the picture above.

Step 8: Attach the Arduino System to the Set Up

As the set up is almost ready, the Arduino system can be attached. Make sure the acoustic sensor is put into the two holes. The display can be put on the vertical wall. The picture above shows an indication on how the Arduino can be attached.

Step 9: Make a Reference Plate

To make more accurate measurements a plate has to be build to act as the reference of the acoustic sensor. The reference needs to be out of the reservoir, because of the angle in the acoustic sensor.

From styrofoam two circles can be made, which has to be some smaller than the inner diameter of the bottle. On top the these two circles the circle of strong paper can be attached. The diameter of this circle needs to be 40 mm bigger as the diameter of the bottle.

After putting some water into the reservoir the reference plate can put into the bottle as shown in the picture above.

Step 10: Test the System

Now the set up is ready, water can be put into the upper half of the bottle. As it works well, the display will indicate the amount of water (mm) that is put into the reservoir.