A real-world IoT automation system designed to manage irrigation for a ~70 mΒ² home garden using sensor-driven logic, weather integration, and a Raspberry Pi backend.
This project combines:
- Software engineering
- Electronics & wiring
- IoT communication
- Data logging & future ML experimentation
- Automation logic design
It is both a functional irrigation system and an evolving engineering project.
Location: Designed for a ~70 mΒ² residential garden in Central Europe.
Infrastructure:
7 raised beds
Greenhouse
Fruit trees
Mediterranean herb patch
Pots & strawberry section
The system supports seasonal vegetable production (salads, tomatoes, onions, garlic, broccoli, potatoes, etc.) with controlled and automated irrigation.
Sensor-based moisture monitoring
Multi-zone watering control
Web interface for monitoring & manual control
Weather integration
Historical logging in SQLite
Reliable data ingest from ESP32 nodes
Improve communication reliability
Health monitoring of nodes
Better scheduling & fault tolerance
Expand to 6 watering zones
Use historical moisture, weather, and watering events
Optimize watering duration
Improve water efficiency
Extend architecture to controlled environments (e.g., mushroom chambers)
The system is currently in an active development and stabilization phase.
Working components:
- Sensor β Raspberry Pi data pipeline
- SQLite data storage
- Watering decision engine (dry-run mode)
- Web UI for monitoring and manual triggering
- Weather data integration
Ongoing work:
- Backend refactoring (modular architecture)
- Improved reliability and error handling
- Preparation for real valve control (currently disabled)
The system has completed a multi-week real-world test cycle in a home garden environment.
Raspberry Pi 4B
Raspberry Pi OS (64-bit)
Python 3
Flask backend
SQLite database
Arduino Nano ESP32
Wi-Fi communication (HTTP POST β Flask)
DFRobot Waterproof Soil Moisture Sensor v2.0 (capacitive)
24V AC solenoid valves (Hunter / RainBird β TBD)
Relay module control
Planned expansion: up to 6 zones
Current test stage: 2β3 zones, 4β6 sensors
Mains β 24V AC for valves
Mains β 5V DC for Raspberry Pi & ESP32
Relay isolation for valve actuation
- Reliability over complexity
- Fail-safe behavior (no watering on missing data)
- Incremental automation (manual β assisted β autonomous)
- Real-world testing before full deployment
Backend: Python + Flask
Database: SQLite
Communication: HTTP POST (future: MQTT)
Weather API: Open-Meteo
Scheduler: standalone Python process (morning execution window)
Plant configuration: JSON-based profiles
Automation engine: custom watering logic module
Planned: ML pipeline for predictive irrigation
GardenHUB logs time-series events in SQLite to support traceability and future analytics:
- sensor_readings (timestamp, node_id, zone, moisture, temp/humidity optional)
- watering_events (timestamp, zone, duration, reason/manual/auto)
- weather_snapshots (timestamp, forecast/rain probability/temp)
- system_health (node last_seen, error counts β planned)
This data model supports:
- historical trend analysis
- watering effectiveness evaluation
- future ML features (predictive duration / anomaly detection)
.
βββ app.py # Flask entrypoint
βββ db.py # SQLite connection handler
βββ db_schema.py # Database schema definitions
βββ db_init.py # Table initialization
βββ repositories.py # Data access layer
βββ watering_engine.py # Core watering decision engine
βββ watering_decision.py # Threshold & decision logic
βββ garden_logic.py # Moisture interpretation logic
βββ get_weather_new.py # Weather ingestion
βββ historic_weather.py # Weather history queries
βββ python_receiver.py # Sensor ingest endpoint
βββ plants/ # Plant configuration (JSON)
βββ templates/ # Flask templates
βββ static/ # CSS
βββ dev_tests/ # Experimental scripts (no secrets)
βββ arduino_secrets.example.h
Secrets are not stored in the repository.
Arduino credentials go in:
arduino_secrets.h
(ignored via .gitignore)
Template provided:
arduino_secrets.example.h
Python API keys should be stored in environment variables (.env not committed).
1οΈβ£ Install system dependencies
sudo apt update
sudo apt install -y git python3-venv python3-pip sqlite3
2οΈβ£ Clone the repository
git clone https://github.com/Katolux/Watering-System.git
cd Watering-System
3οΈβ£ Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
4οΈβ£ Run the application
python3 app.py
Access from another device on the same network:
http://<RASPBERRY_PI_IP>:5000
This is a physical irrigation system deployed in a real garden environment.
The system includes:
Live sensor ingestion
Backend decision logic
Historical data storage
Weather-based logic
Expandable hardware architecture
The project focuses on backend systems, automation logic, and applied IoT engineering.
-
Basic sensor ingest
-
Database logging
-
Web UI for monitoring
-
Manual watering trigger
-
Hardware valve control integration
-
MQTT-based communication
-
Node health monitoring
-
Predictive ML irrigation model
-
Mushroom growth chamber integration
Alfonso GΓ³mez-Jordana Switzerland π¨π
Background in operations and technical systems. Currently focused on backend development and IoT automation.
GitHub: @Katolux
If you'd like feedback, collaboration, or discussion around IoT architecture, automation logic, or applied ML in small-scale agriculture, feel free to connect.


