Water Sensor With Arduino

by shirshir0619 in Circuits > Arduino

450 Views, 3 Favorites, 0 Comments

Water Sensor With Arduino

IMG_5163.jpg

This is an example of ultrasonic sensor with LED in the use of detecting water level.

Most of the people put water beside their working table, and this machine can remind and warn the user about the water level.

This machine will detect the water level in the bottle. Whenever the water level is higher than 2/3 of the bottle, green LED will shine. When the water level is about 2/3 of the bottle, green and yellow LED will shine. When the water level is less than 1/3 of the bottle, all three LEDs will shine, include the red one.

Supplies

1. 1 Ultrasonic sensor

2. 1 Arduino

3. 1 cable (connecting line for Arduino and computer)

4. 1 breadboard

5. a box (20x14x10cm) - for covering Arduino

6. a bottle of water (bottle and water)

7. 3 yellow resister

8. 3 LEDs (1 red, 1 yellow, 1 green)

9. wires

10. removable mounting putty

11. acrylic foam tape

Prepare Materials

螢幕快照 2020-05-27 下午9.21.19.png

Prepare all the materials mentioned in "supplies."

The material picture above is what you need for building a circuit. (you need wires too)

Build the Circuit

IMG_5127.jpg
螢幕快照 2020-05-27 下午9.40.14.png

1. Connect positive charge with 5V and negative charge with GND.

2. Add three LEDs.

Connect wires on all legs of LEDs. Connect one leg of the yellow resister with the shorter leg of the LED (on the same line) and another leg of the yellow resister on a negative charge. As for the longer leg of the LED, connect it with a wire and on digital 13 for red light, digital 12 for yellow light, digital 11 for green light (optional for which digital, but the code provided in the next step would use these three).

3. Add the sensor.

Connect wires on all four legs of the sensor. Connect Vcc with positive charge, Trig with digital 7, Echo with digital 6, and Gnd with negative charge.

Upload the Code

Link: https://create.arduino.cc/editor/shirshir0619/b49f...

This link is the code of this project. You can change the code with the help of the remarks beside the code which start with // in gray color.

Test

After building the circuit correctly and adding the code, test the project by uploading the code onto Arduino. If it doesn't work, check your circuit and code if there is something connect wrong (things to check such as if the code's digital work with the circuit or any negative and positive connect wrong).

Build and Decorate

IMG_5130.jpg
IMG_5133.jpg
IMG_5151.jpg
IMG_5134.jpg

1. Put Arduino inside the box

2. Use utility knife to cut three little holes, just about the size of LED, on the cover of the box, and stick the LED from inside to outside.

3. Stick the LED onto the cover of the box, use removable mounting putty to stick it from inside.

4. Cut off of the wings at the cover of the box.

5. Cut a little hole at the side of the box, about the size of the cable, so the cable can connect Arduino with the computer.

6. Stick the bottle on the top of the box using the acrylic foam tape.

7. Cut a little hole just beside the bottle for the use of letting the wires of the sensor out. You don't need to make the hole too big, just big enough to let the sensor out.

8. Stick the sensor using removable mounting putty at the edge of the bottle. You will want to stick at the opposite side of where you will pour the water so the sensor won't get wet.

Congratulation! You're Finished.

IMG_5152.jpg

View the video and see if your project looks the same.

The video have some explanation about the machine (in Chinese).