Smart Water Scarcity Predictor
Overview
Build and prototype a smart water scarcity predictor using the Raspberry Pi Pico 2 W and MicroPython.
This expert project is designed as an open-ended research and prototype challenge. Learners should use the concept, suggested components, and starter code as a guide, then conduct further research, improve the design, and build a working prototype.
The final result should demonstrate a working embedded system prototype with clear documentation, testing evidence, and a short presentation of design decisions.
Required Components
![]() Raspberry Pi Pico 2 W |
![]() Rainfall sensor |
![]() Reservoir level sensor |
Water consumption sensor |
![]() Breadboard |
![]() Jumper wires |
Circuit Connections
| Component Pin | Connects To | Pico GPIO / Physical Pin Number | Notes |
|---|---|---|---|
| Sensor power | 3.3V | Physical pin 36 | Use 3.3V-compatible modules |
| Sensor GND | GND | Physical pin 38 | Use a common ground for low-voltage modules |
| Signal pins | Selected GPIO pins | As defined in your design | Document your selected pin numbers |
| Actuators | Driver/relay module | GPIO control pin | Do not power actuator directly from GPIO |
Step-by-Step Assembly
Plan the system architecture and list each subsystem.
Wire one input sensor first and test it.
Add output or actuator modules one at a time.
Verify all 3.3V and GND connections before running the code.
Document final pin choices and design changes.
Testing Individual Components
Before running the full project, test each subsystem separately. This makes it easier to find wiring, code, or logic problems.
Test each sensor reading in the Thonny Shell.
Test each actuator using a safe low-power test.
Verify communication between system layers.
Record results and adjust the prototype before final integration.
Full Project Code
After completing and checking the circuit connections, open Thonny IDE, copy and paste this code into a new file or upload the project file to the Raspberry Pi Pico 2 W, then run it from Thonny.
| # Starter code placeholder from machine import Pin import time print("Expert project ready") while True: # Add your system logic here time.sleep(1) |
|---|
How the Code Works
| Code Section | What It Does | Why It Matters |
|---|---|---|
| Pin setup | Creates input and output objects | The Pico needs to know how each GPIO pin will be used |
| Main loop | Runs the system repeatedly | Embedded systems usually monitor and respond continuously |
Expected Result
The system should collect data, process it, control the required outputs, and show clear evidence that the prototype solves the intended problem.
Troubleshooting
| Problem | Possible Cause | Solution |
|---|---|---|
| No readings appear in Thonny | Incorrect wiring, wrong pins, or missing library | Recheck the circuit, confirm pin numbers, and test each module separately |
| Import error appears | Library file is missing or saved in the wrong location | Check the Pico file structure and save libraries exactly as instructed |
| Actuator does not respond | Relay/driver wiring or external power issue | Verify driver input, external power, and shared ground where required |
| Results are unstable | Sensor noise, loose wiring, or poor calibration | Secure the wiring and add calibration or averaging in code |
| Prototype works only sometimes | System is too complex to test all at once | Return to subsystem testing and integrate one part at a time |




