GreenhouseAgent is a greenhouse monitoring and control stack that combines Arduino sensor ingestion, a FastAPI control service, a lightweight dashboard, and model-driven recommendations.
It keeps the operating loop in one place. Read sensor data. Pull weather context. Suggest or issue control actions. Keep an operator-visible log of what happened.
- Arduino firmware reads temperature, humidity, and light
server/serial_relay.pybridges the serial stream into the APIserver/main.pytracks live state, weather context, and actuator commandsweb/provides the operator dashboard- Online mode uses an OpenAI prompt path and local mode falls back to a Random Forest model
arduino/firmware for the sensor and actuator loopserver/main.pyAPI server and greenhouse state managerserver/serial_relay.pyserial bridge between the Arduino and the APIserver/rf_recommendation.pyoffline recommendation pathweb/dashboard for readings, actuator state, weather, and recommendationsdata/sample readings and the shipped local model artifact
- Install dependencies
python3 -m pip install -r requirements.txt-
Flash
arduino/greenhouse_uno/greenhouse_uno.inoto the Arduino -
Create a
.envfile with the keys below
OPENAI_API_KEY=sk-...
SUPABASE_URL=https://...
SUPABASE_KEY=...
SERIAL_PORT=/dev/ttyUSB0- Start the API server
python3 server/main.py- Start the serial relay
python3 server/serial_relay.py- Open
http://127.0.0.1:8000
- A live reading becomes the current greenhouse state
- Weather data is fetched for the configured coordinates
- Online mode builds a recommendation from sensor state and forecast context
- Local mode uses
data/rf_model.joblibfor offline fallback - Commands are normalized before they are sent to the actuator queue
- Arduino Uno or compatible board
- DHT temperature and humidity sensor
- Analog light sensor
- Two servos for vent and shade control
- This is a single-greenhouse prototype
- Operator review still matters for watering and hardware safety
- The default weather coordinates point to Boston until changed in the dashboard