Skip to main content

Water Level Detection Device

Introduction

In this project, we will learn how to make a water level detection device, which uses a water level sensor to monitor water level changes in real time and converts these data into the rotation angle of the servo to intuitively reflect the current water level.

Teaching objectives

Understand how to use the water level sensor

Master the basic programming skills of using micro:bit to control the rotation angle of the servo.

Teaching preparation

Before starting the teaching, please make sure you have prepared the following necessary materials:

PictureNameNumberNote
Smart Life Kit1
USB Cable1
micro:bit1Prepare Yourself
PC1Prepare Yourself

These materials will provide you with a complete experience, ensuring that you can smoothly carry out subsequent operations and learning. If you are ready for the above, we can proceed to the next step.

Course Introduction

Water level monitoring devices are essential to ensure the rational use, protection and management of water resources. Can we make a simple water level detection device by ourselves?

Project Production

Hardware Connection

Connect the water level sensor to the P1 interface of the Wukong expansion board, connect the 180° servo to the S1 interface of the Wukong expansion board, and insert the OLED display into the IIC interface of the Wukong expansion board.

Programming platform

We usually use graphical programming platform makecode to program micro:bit

Programming platform entrance: https://makecode.microbit.org/

Create a new project

Open https://makecode.microbit.org/

New Project

Enter a project name and click Create.

Add software library

Click Extensions in the Toolbox of the MakeCode programming interface.

Search for iot-environment-kit on the pop-up page and click to select the iot-environment-kit software library.

Search for wukong on the pop-up page and click to select the wukong software library.

Write a program

Sample program: https://makecode.microbit.org/_4uRc4hUcAWXx

You can also download the program directly from the following web page.

How to download the program to micro:bit?

Use a USB cable to connect PC and micro:bit V2.

After the connection is successful, a drive named MICROBIT will be recognized on the computer.

Click in the lower left corner and select Connect Device.

Click

Click

In the pop-up window, select BBC micro:bit CMSIS-DAP, and then select Connect. At this point, our micro:bit has been successfully connected.

Click Downloader.

Result

After turning on, the OLED displays the current water level value, and the current water level situation is more intuitively reflected through the rotation angle of the servo.

For demonstration purposes, materials not included in the set were used in the result display, such as wooden houses, water cups, etc.

Extended knowledge

Why do we need a water level monitoring device?

Water level monitoring devices are essential to ensure the rational use, protection and management of water resources. They play an important role in many fields, including but not limited to:

Water resource management: Water level monitoring devices can help monitor reservoirs, rivers, lakes and groundwater levels, ensure the effective management and scheduling of water resources, prevent the waste of water resources, and provide important data support under extreme weather conditions such as droughts or floods.

Agricultural irrigation: In the agricultural field, water level monitoring devices can ensure that farmland is properly irrigated, improve irrigation efficiency, reduce water waste, and contribute to the healthy growth of crops.

Environmental monitoring: Water level monitoring devices play an important role in monitoring environmental changes, such as the impact of climate change on water levels, water pollution, etc. They can provide important data on the health of water bodies and help environmental protection and ecological research.

Industrial applications: In the industrial field, water level monitoring devices are used to monitor the liquid water level in industrial processes to ensure the safety and efficiency of production processes, such as chemical, petroleum and water treatment plants.

Flood control and disaster warning: Water level monitoring devices can monitor water level changes in real time, provide data for flood warning systems, and help relevant departments take timely measures to reduce the impact of natural disasters such as floods.

Urban drainage systems: In urban infrastructure, water level monitoring devices can monitor the water level of drainage pipes, promptly detect and deal with problems such as poor drainage, and ensure the normal operation of urban drainage systems.

Hydropower station and dam safety: Water level monitoring devices are essential for the operation management of hydropower stations and the safety monitoring of dams. They can monitor the water level changes in reservoirs and ensure the power generation efficiency of hydropower stations and the safety of dam structures.

Scientific research and education: In the field of scientific research and education, water level monitoring devices can be used as research tools to help students and researchers better understand knowledge in fields such as hydrology, environmental science and ecology.

In summary, water level monitoring devices are widely used. They not only help improve the utilization efficiency of water resources, but also play an important role in environmental protection, disaster prevention and industrial production. With the development of technology, the accuracy and reliability of water level monitoring devices will be further improved, providing stronger support for the sustainable management and protection of water resources.