X
Home > Blog > STEM for Arduino > HOW to Make a Water Level Detection System with KidsIOT

HOW to Make a Water Level Detection System with KidsIOT

By r September 4th, 2024 46 views

Note: Do not allow water to overflow from sinks and soil troughs when using the device. Sprinkling water on other sensors will cause a short circuit and device failure. Sprinkling water on batteries will cause heating and explosion. Please be careful when using the device, especially when used by young children, it must be under the supervision of parents. To ensure safe operation of the device, please follow relevant usage guidelines and safety regulations.



Img

1. Description

This project introduces how to use a kidsIOT mainboard, a water level sensor, a passive buzzer and an OLED display to make an intelligent automatic water level detection system. It is able to monitor water level changes, detect problems in time and take measures to avoid disasters, and is widely used in water conservancy projects, urban drainage as well as environment monitoring.

2. Components

Img

Img

Img

Img

Img

kidsIOT Mainboard×1

Water Level Sensor×1

Passive Buzzer×1

GPIO Shield×1

Wire×2

Img

Img

Img

Img

USB Cable×1

Soil Moisture/Water Level/Automatic Irrigation System LEGO Pieces×1

F-F DuPont Wires

Sink×1

Img

3. Assembly Steps

It shares the same structural shape with Project 07. If the assembly parts of Project 07 have finished, there is no need to assemble it again.

4. Wiring Diagram

Module

GPIO Shield

kidsIOT Mainboard

Water Level Sensor

G→G,V→V,S→S4

No.4 port(control pin of S4 is io39)

Passive Buzzer

No.8 port(control pin is io5)

Connect the kidsIOT mainboard to your computer via USB cable.

Img

5. Read the value of water level sensor

Img

(1). Write the Program

① Set the baud rate to 15200.

Img

② Set the pin IO39 connected to the water level sensor to “input” mode.

Img

③ Define a “Water_level_sensor” global variable to store the analog value of the water level sensor.

Img

④ Store the read analog value of the water level sensor in the “Water_level_sensor” variable and print it on the serial port.

Img

⑤ Complete Program

Img

(2). Test Result

ClickImg to upload the above complete code to the kidsIOT mainboard. After powering up via the USB cable, click Img in the serial monitor and set the baud rate to 15200.

Insert the water level sensor in the water (or touch the sensor with wet hands), then the serial monitor will print the analog value of the sensor (range: 0~4095). The greater the water level, the greater the value!

Img

6. Water Level Detection System

Img

(1). Programming Steps
Step 1:Flow Chart

Img

Step 2:Add “passive buzzer”

Img

Step 3:Write the Program

① Set the pin IO39 connected to the water level sensor to “input” mode.

Img

② Initialize the width, height, I2C address, text size and color as well as background color of the OLED display.

Img

③ Define a “Water_level_sensor” global variable to store the analog value of the water level sensor.

Img

④ Store the read analog value of the sensor in the“Water_level_sensor” variable and display it on the OLED.

Img

⑤ Determine the analog value of the sensor. If it is greater than 2000, the buzzer will sound an alarm; otherwise, the buzzer will not sound.

Img

⑥ Complete Program

Img

(2). Test Result

ClickImg to upload the above complete code to the kidsIOT mainboard. After powering up via the USB cable, insert the water level sensor in the water (or touch the sensor with wet hands), when the sensor detects that the water level (or the moisture of your hands) is greater than the set threshold, the buzzer will sound an alarm.

Img

7. Common Problems

Q: Is the sensor waterproof?

A: The detection area of the sensor is waterproof. Exceeding the detection area will cause a short circuit.

HOW to Make A Soil Moisture Detection System with KidsIOT
Previous
HOW to Make A Soil Moisture Detection System with KidsIOT
Read More
HOW to Make a Track Alarm with KidsIOT
Next
HOW to Make a Track Alarm with KidsIOT
Read More
Message Us