Water Level Monitoring Sensor

by s72580 in Circuits > Raspberry Pi

324 Views, 2 Favorites, 0 Comments

Water Level Monitoring Sensor

2B6339E0-AB45-4014-91A0-D995E0A91288.jpeg
EBBA4FC5-4E0F-409C-ACF3-359D53D6A0DB.jpeg
2E7D879C-003E-4E85-9A0C-B82AF5B17CE0.jpeg

This project focuses on the design and implementation of an IoT-based Environmental Water Monitoring System using the Raspberry Pi Pico W. The system is developed to monitor water-related and environmental conditions in real time by integrating multiple sensors and transmitting data wirelessly using the MQTT protocol.


Unlike basic water-level monitoring systems, this project measures three core environmental parameters. The collected data is periodically sent to an MQTT broker over WiFi, enabling remote monitoring and analysis. The system is designed with emphasis on robust physical deployment, low-power operation, and reliable wireless communication, making it suitable for outdoor or semi-outdoor environments such as drains, rivers, or water storage areas.


The hardware platform used is the Raspberry Pi Pico W, which provides built-in WiFi connectivity and is aligned with the lecturer’s recommended microcontroller for this course. A waterproof enclosure and external power source are used to ensure durability and continuous operation during deployment.

Supplies

2.1 Microcontroller

1. Raspberry Pi Pico W

• Acts as the main controller of the system

• Handles sensor data acquisition, WiFi connectivity, and MQTT communication

• Chosen based on lecturer recommendation and built-in wireless capability

https://my.shp.ee/QcjRGw8

2.2 Sensors

2. AJ-SR04M Waterproof Ultrasonic Sensor

• Function: Measures water level (cm)

• Advantage: Waterproof and suitable for outdoor water monitoring

https://my.shp.ee/Lx1jYoG

3. DS18B20 Waterproof Temperature Sensor

• Function: Measures water temperature (°C)

• Advantage: High accuracy and waterproof probe

https://my.shp.ee/HmYjrVM

4. DHT22 Temperature and Humidity Sensor

• Function: Measures air temperature (°C) and humidity (%)

• Advantage: Stable readings and suitable for environmental monitoring

https://my.shp.ee/2yjciRF


2.3 Power Supply

5. 20,000mAh USB Power Bank

• Supplies power to the Raspberry Pi Pico W

• Supports long-term deployment (≥ 7 days)

• Easy plug-and-play via USB

https://my.shp.ee/BUKfoLx


2.4 Supporting Electronic Components

6. Voltage Divider Resistors (e.g., 1kΩ & 2kΩ)

• Used to step down the ultrasonic sensor Echo signal from 5V to 3.3V

• Protects the Raspberry Pi Pico W GPIO pins

https://my.shp.ee/UtB7FJR

7. Breadboard

• Used for sensor wiring and testing

https://my.shp.ee/SorGmww

8. Jumper Wires (Male-to-Male / Male-to-Female)

• Used for electrical connections between components

https://my.shp.ee/gbLAdfw


2.5 Enclosure & Mechanical Components

9. IP65 Waterproof Electrical Junction Box

• Protects electronic components from water and dust

• Suitable for outdoor installation

https://my.shp.ee/WPYBz4D

10. Cable Glands

• Provides waterproof cable entry for sensors

• Improves physical robustness

https://my.shp.ee/CbveJj8

Prepare the Components

CFFD8075-B511-4FCE-A840-08FAA560C9CE.jpeg

Ensure all required hardware components are available:

• Raspberry Pi Pico W

• AJ-SR04M Waterproof Ultrasonic Sensor

• DS18B20 Waterproof Temperature Sensor

• DHT22 Sensor

• Voltage divider resistors (e.g., 1kΩ and 2kΩ)

• Breadboard and jumper wires

• 20,000mAh USB power bank

• IP65 waterproof junction box and cable glands


Set Up the Raspberry Pi Pico W

B9ECBCF2-4612-44DC-B133-B0B2D830991B.jpeg

1. Connect the Raspberry Pi Pico W to a computer using a USB cable.

2. Flash MicroPython firmware onto the Pico W (if not already installed).

3. Verify that the Pico W is powered on and detected by the system.


Connect the AJ-SR04M Ultrasonic Sensor (Water Level)

4CE54BA3-0F60-4075-B7E9-FB638B9F1465.jpeg

1. Connect VCC of the AJ-SR04M to 5V (VBUS) from the Pico W.

2. Connect GND to the Pico W GND pin.

3. Connect the TRIG pin directly to a GPIO pin on the Pico W.

4. Connect the ECHO pin through a voltage divider before connecting it to a Pico W GPIO pin to reduce the signal from 5V to 3.3V.

5. Mount the ultrasonic sensor facing downward toward the water surface.

Connect the DS18B20 Waterproof Temperature Sensor (Water Temperature)

02023ADF-C515-4007-921F-49332D3A35B0.jpeg

1. Connect the VCC wire to 3.3V on the Pico W.

2. Connect the GND wire to GND.

3. Connect the DATA wire to a GPIO pin.

4. Add a 4.7kΩ pull-up resistor between DATA and 3.3V.

5. Place the probe into the water to measure water temperature.

Connect the DHT22 Sensor (Air Temperature & Humidity)

1. Connect VCC to 3.3V on the Pico W.

2. Connect GND to GND.

3. Connect DATA to a GPIO pin.

4. Position the sensor outside the enclosure to measure ambient air conditions.

Assemble the Circuit on Breadboard

A169B416-2692-4EF8-AD21-C1D260BEE0EC.jpeg
AA87D03A-8680-4925-B429-E961625FB00B.jpeg

1. Arrange all sensors and resistors neatly on the breadboard.

2. Double-check wiring connections to avoid short circuits.

3. Label sensor connections for easier troubleshooting.

Enclosure Installation

1D020276-1B83-4E07-81BE-E7B3D27853B3.jpeg
DF1D7A80-9839-4F34-B042-CAACC2A5C2BC.jpeg

1. Place the Raspberry Pi Pico W and breadboard inside the IP65 waterproof junction box.

2. Drill holes for:

• Ultrasonic sensor heads

• DS18B20 cable

• DHT22 sensor placement

3. Use cable glands to seal all cable entry points.

4. Apply silicone sealant if necessary to improve waterproofing.

Power System Setup

972C4F5E-885E-4AB2-BE90-CB6605CAFC37.jpeg

1. Connect the Raspberry Pi Pico W to the USB power bank.

2. Ensure the power bank is fully charged.

3. Secure the power bank inside or near the enclosure.

Initial Testing

1. Power on the system.

2. Verify that:

• Ultrasonic sensor reads distance values

• DS18B20 returns water temperature

• DHT22 returns air temperature and humidity

3. Fix any wiring or sensor issues before deployment.

Deployment Preparation

3416850E-90BE-46F4-A7C5-B25801255DD0.jpeg
F3FC4479-1F34-4E32-8225-B0682BDB821B.jpeg
CB56C0ED-E997-49B6-967E-2AEDCC28958A.jpeg
772D3321-EDA4-4892-8487-C23EE1AA57CA.jpeg

1. Mount the enclosure at the monitoring location.

2. Ensure sensors are correctly positioned and not obstructed.

3. Confirm that WiFi signal is available at the deployment site.

Data Monitoring and Visualization

9D64157F-0F10-4357-8F98-2F1A0E8A38F8.jpeg

1. Configure the system to transmit sensor data to the MQTT broker at 30-minute intervals.

2. Set up an IoT dashboard (e.g., Node-RED Dashboard or MQTT-based web dashboard) to subscribe to the published topics.

3. Display real-time and historical data including:

• Water level (cm)

• Water temperature (°C)

• Air temperature (°C)

• Humidity (%)

4. Monitor the sensor readings remotely through the dashboard to observe environmental changes over time.

5. Verify that data is updated correctly every 30 minutes and stored or logged for further analysis.