An autonomous, sensor-driven irrigation system built with MATLAB and the Grove Beginner Kit for Arduino. This project utilizes a finite-state machine logic to maintain soil moisture, with adaptive watering durations based on indoor air quality (
- Reactive Control: Automatically waters plants when soil is dry.
-
Air Quality Integration: Adjusts watering bursts based on
$eCO_2$ levels (using SGP30) to prevent fungal growth in high$CO_2$ environments. - Real-time Telemetry: Live animated graphs of moisture levels in MATLAB.
-
Data Logging: Automatically records moisture (V and %),
$eCO_2$ levels, and system status tomoisture_log.csv(seesample_moisture_log.csvfor an example). - Safety First: Dedicated physical Emergency Stop button.
- Calibration-Ready: Includes scripts for mapping sensor voltage to moisture percentages.
- Microcontroller: Arduino (Compatible with Grove Beginner Kit)
-
Sensors:
- Soil Moisture Sensor (Analog)
- SGP30 Gas Sensor (
$eCO_2/TVOC$ )
-
Actuators:
- Water Pump (via MOSFET board)
-
Interface:
- Physical Button (Emergency Stop)
| Component | Pin | type |
|---|---|---|
| Soil Moisture Sensor | A1 |
Analog |
| SGP30 Sensor | I2C |
I2C |
| Water Pump (MOSFET) | D2 |
Digital Out |
| Emergency Stop Button | D6 |
Digital In |
- MATLAB (R2021a or newer recommended)
- MATLAB Support Package for Arduino Hardware
- Connect your Arduino and sensors according to the pin table above.
- Ensure
sgp30.mandvolt2mois.mare in the same directory as the main script. - Open
PlantWateringSystem.min MATLAB. - Run the script. The system will initialize the Arduino connection and begin monitoring.
- Run
Testvolt2mois.mto verify the moisture conversion logic. - Use the calibration curve generated in the main script to adjust the
Dry_SoilandWet_Soilthresholds for your specific plant/soil type.
- SGP30 Library: The
sgp30.mclass was developed by Eric Prandovszky (prandov@yorku.ca), version 0.8.1. - Hardware: Developed using the Grove Beginner Kit for Arduino.
This project is licensed under the MIT License - see the LICENSE file for details.



