Automatic Irrigation System
The project consists of an intelligent irrigation system for plants that constantly monitors essential parameters for optimal irrigation.
Author: Murarescu Carmen-Maria
GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-CarmenMaria17
Description
The project consists of an intelligent irrigation system for plants that constantly monitors three essential parameters for optimal irrigation:
Soil humidity - determines when plants need water
Reservoir level - checks water availability for irrigation
Light intensity - prevents irrigation during periods of strong light
When soil moisture drops below a preset threshold, the system checks if the reservoir contains enough water and if the light intensity is suitable. If all conditions are met, it automatically activates a mini-pump that irrigates the plants. The system includes a display to show levels (low, medium, high) for the 3 parameters.
Motivation
I chose to develop this automatic irrigation system because I wanted to solve a practical problem many plant owners face, that being the inconsistent watering due to busy schedules or forgetfulness. Second, this project allows me to apply embedded systems knowledge in a hands-on way, working with multiple sensors and including a display for easy reading of the parameters.
Architecture
The main architectural components are:
-
RTC Clock with Battery - a clock that keeps the microcontroller sleeping, it wakes it at intervals of 10 minutes and completes 20 measurements for accuracy and then puts it back to sleep
-
Humidity Sensor & Photoresistor & Float Sensor - measures the soil humidity and if it is too low, the light is not too strong and there is water in the reservoir then the realy module starts the water pump and it waters the plant
-
Display - shows all the parameters and messages for the start of the process etc.
-
Water Pump - used to water the plant when necessary
Architectural Diagram
Log
Week 5 - 11 May
- Connected the Hardware
- Tested the sensors
Week 12 - 18 May
- Almost completed the final arangements (I decided I want to put it all in a bigger box, with the display on top of it)
- Updated the Bill Of Materials
- Did the Kicad schematic again with the now used pins of the MCU
- Added photos here of the hardware, that I will probably update again before the fair if something changes
Week 19 - 25 May
- Completed the software implementation
- Completed the final design
- Finalized the documentation
Hardware Design
Sensors
-
Soil Hygrometer Humidity: A precision resistive humidity sensor that measures soil moisture.
-
Photoresistor: A light-dependent resistor that exhibits variable resistance inversely proportional to light intensity, enabling the system to monitor ambient light conditions for optimal plant growth.
-
Float Sensor: A mechanical sensor triggers when water levels reach predefined thresholds, preventing both reservoir depletion and overflow conditions.
Control and Timing Components
- RTC (Real-Time Clock) Module: Incorporates a DS3231 enabling programmed sleep cycles for the microcontrollers via interrupt-based wakeup, significantly reducing power consumption.
Actuation
-
NPN Transistor: A NPN Transistor that provides safe switching of the water pump circuit.
-
Water Pump: A submersible pump capable of delivering appropriate water volume for plant irrigation.
Display
- ST7735 LCD Display: A 1.8" TFT color display with SPI interface and embedded controller, providing visual representation of system status, sensor readings, and operational modes.
Schematics
Project Photos
Software Design
Description
- Design Patterns:
- Manager/Controller pattern (FloatSensorManager, RtcManager)
- State machine with protective logic
- Statistical sampling for accuracy
- Key Features:
- Smart protection mechanisms with conditional blocking
- Energy-efficient sleep/wake cycles
- Real-time status monitoring with visual feedback
- Robust sensor data processing with thresholds
Software Diagram
Bill of Materials
Hardware
Device | Usage | Price |
---|---|---|
2x Raspberry Pi Pico W | The microcontroller | 35 RON |
Humidity Sensor | Soil Humidity Measurement | 15 RON |
Photoresistor | Light Measurement | 2 RON |
Float Sensor | Checks Water Level | 20 RON |
RTC Clock with Battery | Sleep Mode for MCU | 20 RON |
NPN Transistor | Controls the Water Pump | 0.17 RON |
Water Pump | Waters the Plant | 24 RON |
LCD Screen ST7735 | Displays the measurements | 28 RON |
Power Source - 5V | Poweres the circuit | 5 RON |
[Others (wires, breadboards, pins etc)] | Used for connections | 10 RON |
Software
Library | Description | Usage |
---|---|---|
embassy-executor | Async/await runtime for embedded systems | Provides the core async runtime for concurrent task execution |
embassy-time | Time handling for embedded systems | Manages delays in sensor sampling, sleep cycle timing, and display transitions |
embassy-rp | Raspberry Pi Pico for Embassy | Hardware abstraction layer for GPIO (float sensor, pump control), I2C (RTC communication), and SPI (display interface) |
embedded-hal | Hardware abstraction layer traits | Core traits for peripheral access |
embassy-rp::adc | ADC module for Embassy RP | Reads analog values from light sensor and soil moisture sensor |
embassy-rp::gpio | GPIO control for Embassy RP | Controls float sensor input, water pump output, display control pins, and RTC interrupt |
embassy-rp::i2c | I2C communication for Embassy RP | Communicates with DS3231 RTC module for wake timer functionality and alarm management |
embassy-rp::spi | SPI communication for Embassy RP | Interfaces with ST7735s display at 32MHz for real-time status visualization |
mipidsi | Display driver for small TFT displays | Drives ST7735s display with custom orientation and color graphics rendering |
embedded-graphics | 2D graphics library for embedded devices | Renders text with multiple font styles and color-coded status information on display |
display-interface-spi | SPI display interface abstraction | Provides SPI interface abstraction for the display driver |
embassy-sync | Synchronization primitives for Embassy | Provides mutex for shared SPI bus access between display components |
heapless | Collections without heap allocation | Creates formatted strings for display output without dynamic allocation |
defmt | Efficient logging framework | Provides structured logging for sensor readings, system status, and debugging information |