SmartGreenhouse aims to create an intelligent greenhouse that captures internal and external environmental conditions using a variety of sensors. The collected data is stored in a database for later analysis. Additionally, the project utilizes collected rainwater to ensure an independent water supply. A central component of the greenhouse is the FarmBot, which fully autonomously tends to the plants from sowing to harvest.
- Features
- Technologies
- Installation
- Hardware Components
- Usage
- API Endpoints
- Contributing
- Authors
- License
- Diagrams
- Data Collection: Comprehensive monitoring of environmental conditions both inside and outside the greenhouse.
- Water Recycling: Independence from external water supply through the use of rainwater.
- Autonomous Plant Care: Use of a FarmBot for fully automatic care of the plants.
- Backend: Flask (Python)
- Database: SQLAlchemy
- Automation: Integration of FarmBot
-
Clone the Repository:
git clone https://github.com/ETCE-LAB/ETCE-Farmbot-Smart-Greenhouse.git cd ETCE-Farmbot-Smart-Greenhouse
-
Create and Activate a Virtual Environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install Required Dependencies:
pip install -r requirements.txt
-
- Provides the primary electricity supply at 230V, converted to necessary operational voltages: 5V for Raspberry Pis and 12V for pumps and lighting systems.
-
- Features a USB Type-C docking station connected to a monitor, supporting both power charging and data transmission. Required voltage: 5V.
- Includes a notebook wall mount for an ergonomic and space-efficient setup.
-
- Controls various sensors and hosts the backend system. Required voltage: 5V.
-
Temperature and Humidity Sensor
- Monitors and maintains optimal climate conditions within the greenhouse using the DHT22 AM2302 sensor.
-
Greenhouse Surveillance Camera
- Enhances security and operational oversight through high-resolution visual monitoring with the RASP CAM 3.
-
- Ensures accurate water levels in tanks with the HC-SR04 sensor, supporting precise irrigation management.
-
- Automates garden management from sowing to harvesting. Required voltage: 12V.
-
- Provides waterproof sockets and cables for reliable connections and power supply to all system components.
-
- Delivers pressurized water to the FarmBot, ensuring adequate water flow. Required voltage: 12V.
-
- Converts 230V to 12V, providing the pump with the necessary amperage.
-
- Enables control over power sockets via Raspberry Pi, facilitating the management of the pump and other accessories.
-
- Provides a non-lethal barrier against snails, protecting plants from damage.
-
- Features quick connectors and a 3/4-inch hose for seamless integration with the rain barrel and FarmBot systems.
-
- Collects and stores rainwater for efficient irrigation use.
-
- Automatically tracks the water level in the rain barrel, preventing the pump from running dry.
Start the backend with:
python main.py
The Flask endpoints can be accessed via the provided Swagger UI at http://localhost:5000/swagger
.
- Description: Endpoints for controlling and monitoring the FarmBot.
- Endpoints:
- GET
/farmbot/move/<float:x>/<float:y>/<float:z>
: Moves the FarmBot to the specified coordinates. - GET
/farmbot/action/waterField
: Activates the irrigation function of the FarmBot. - GET
/farmbot/measure/measureSoilMoisture
: Measures soil moisture.
- GET
- Description: Endpoints for capturing and processing weather station data.
- Endpoints:
- GET
/station/data/<date>
: Displays weather data for a specific date.- Response:
{ "id": 101, "measurement_value": 22.5, "measurement_type": "Temperature", "received_at": "2024-07-12T15:30:00Z" }
- Response:
- GET
/station/data/range/<start_date>/<end_date>
: Retrieves weather data for a specified date range.- Response:
[ { "id": 102, "measurement_value": 21.5, "measurement_type": "Temperature", "received_at": "2024-07-11T15:30:00Z" }, { "id": 103, "measurement_value": 23.0, "measurement_type": "Temperature", "received_at": "2024-07-12T15:30:00Z" } ]
- Response:
- POST
/station/data
: Creates new weather station data. For developer debugging only; must be removed in production release.
- GET
- Description: Endpoints for querying weather forecasts.
- Endpoints:
- GET
/forecast/<date>
: Retrieves weather forecast data for a specific date.- Response:
{ "id": 202, "date": "2024-07-13", "max_temperature": 25.0, "min_temperature": 15.0, "sunshine_duration_minutes": 320, "precipitation_mm": 5.0 }
- Response:
- GET
/forecast/range/<start_date>/<end_date>
: Retrieves weather forecast data for a specified date range.- Response:
[ { "id": 203, "date": "2024-07-14", "max_temperature": 24.0, "min_temperature": 14.0, "sunshine_duration_minutes": 300, "precipitation_mm": 2.0 }, { "id": 204, "date": "2024-07-15", "max_temperature": 26.0, "min_temperature": 16.0, "sunshine_duration_minutes": 340, "precipitation_mm": 8.0 } ]
- Response:
- POST
/forecast
: Creates new forecast data. For developer debugging only; must be removed in production release.
- GET
- Description: Endpoints for managing water consumption and storage.
- Endpoints:
- GET
/water/volume/<date>
: Displays water volume on a specific date.- Response:
{ "id": 303, "date": "2024-07-12", "volume": 1500.0 }
- Response:
- GET
/water/volume/range/<start_date>/<end_date>
: Displays water volume data for a specified date range.- Response:
[ { "id": 304, "date": "2024-07-10", "volume": 1480.0 }, { "id": 305, "date": "2024-07-11", "volume": 1495.0 } ]
- Response:
- POST
/water/volume
: Creates new water volume data. For developer debugging only; must be removed in production release.
- GET
- Description: Endpoints for monitoring and managing conditions within the greenhouse.
- Endpoints:
- GET
/greenhouse/data/<date>
: Displays all environmental data for a specific date.- Response:
{ "id": 404, "date": "2024-07-12", "temperature": 22.5, "humidity": 48.0 }
- Response:
- GET
/greenhouse/data/range/<start_date>/<end_date>
: Displays environmental data for a specified date range.- Response:
[ { "id": 405, "date": "2024-07-10", "temperature": 21.0, "humidity": 50.0 }, { "id": 406, "date": "2024-07-11", "temperature": 23.0, "humidity": 46.0 } ]
- Response:
- POST
/greenhouse/data
: Creates new environmental data. For developer debugging only; must be removed in production release.
- GET
Contributions are welcome! Please read our CONTRIBUTING.md for details on the process for submitting pull requests.
- Benjamin Leiding - Product Owner
- Johannes Mayer - Scrum Master
- Mattes Knigge - Head Developer
- Izzeldeen Alzeer - Developer
This project is licensed under the XYZ License - see the LICENSE.md file for details.
This diagram provides an overview of the main components and workflow of the SmartGreenhouse.
This diagram details the deployment architecture of the SmartGreenhouse software and hardware components.
This diagram presents the domain model of the SmartGreenhouse, illustrating the main entities and their relationships.
This diagram shows the electrical layout of the SmartGreenhouse, detailing the wiring and connections for automation.
Developers can add new tasks to the SchedulerService
to automate additional functionalities as needed. Here’s how to add a new task:
-
Import the Scheduler Service:
from Scheduler.SchedulerClass import SchedulerService
-
Create a Scheduler Instance (if not already created):
scheduler_service = SchedulerService()
-
Define the Task Function:
def custom_task(): print("Performing a custom scheduled task.")
-
Schedule the New Task:
scheduler_service.add_job(custom_task, 'interval', hours=1) # Runs every hour
-
Start the Scheduler (if not already started):
scheduler_service.start()
This allows for flexible task scheduling based on the specific needs of the greenhouse, enhancing automation and efficiency.