Built to order

Autonomous Greenhouse Agent with ESP32 and Local LLM Reasoning

This project builds an autonomous greenhouse agent: an ESP32 senses soil moisture, temperature and humidity, while a local LLM planner running on the student's laptop reasons over the readings and issues irrigation and ventilation commands over MQTT. Every plan arrives with a plain-language explanation, and a live dashboard shows telemetry, actuator states and the agent's decision log. Hard safety cut-offs stay on the ESP32, so the planner is supervisory, never real-time control. Suitable for B.E./B.Tech final-year projects in IoT, Embedded Systems and Electronics.

IoT & Embedded Capacitive soil-moisture probeHTML · CSS · JavaScript dashboardMQTT · MosquittoESP32 · Arduino C++Local LLM plannerDHT22 climate sensorRelay module · pump · fanOllama-class local modelsHybrid
ESP32 greenhouse agent prototype with soil moisture sensor, DHT22, relay module and water pump on breadboard
More project photos (2)

The problem

Greenhouse growers water on fixed timers or gut feeling: too much water drowns roots, too little stresses the crop, and nobody records why each decision was made. Rule-based automation improves on this but hides its logic in threshold code that is hard for a student to explain in a viva. This project takes a different approach — an agentic IoT design where an ESP32 handles sensing and actuation while a local large language model acts as a supervisory planner, reasoning over soil moisture, temperature and humidity and publishing a plan with a human-readable explanation for every action it takes. The architecture is honest about physics and computing: the planner runs on the student's laptop (not on the microcontroller), its decisions take a few seconds per cycle over MQTT, and all safety interlocks — maximum pump run-time, temperature failsafe — execute on the ESP32 itself, independent of the planner. The student learns the full modern edge-to-agent pipeline: capacitive soil sensing, DHT22 climate sensing, relay-driven actuation, MQTT telemetry, prompt-structured LLM planning, and a real-time dashboard.

SYSTEM FLOW

8 components 9 connections

Live flow
Drag to explore
100%
sensorSoil Probe

Capacitive soil-moisture probe in the demo bed.

Follow the working sequence

How it works

  1. The capacitive soil probe, DHT22 and LDR continuously measure soil moisture, canopy temperature/humidity and light; the ESP32 publishes the readings over Wi-Fi to MQTT topics every few seconds.
  2. A local LLM planner on the student's laptop subscribes to the telemetry topic and, on each cycle, reasons over the readings against the configured thresholds (e.g. soil low 35%, ventilation above 32 °C).
  3. When a condition needs action, the planner publishes a structured plan: which actuator, for how long, and a plain-language explanation of why this action and not another.
  4. The ESP32 receives the plan, validates it against its hard safety limits (max 90 s pump run, temperature failsafe), executes it, and publishes the resulting actuator state.
  5. The dashboard renders live telemetry, actuator states, the moisture trend chart and the rolling explanation log; the operator can edit thresholds, which take effect on the next planner cycle.
  6. Safety interlocks run entirely on the ESP32: if MQTT or the laptop goes down, the failsafes still protect the plant and the pump.

Tech stack:

  • ESP32 devkit (Arduino C++ firmware)
  • MQTT broker (Mosquitto on the student's laptop)
  • Local LLM planner (Ollama-class model, structured prompting)
  • Web dashboard (single-file HTML/CSS/JS)
  • DHT22 · capacitive soil probe · LDR
  • Relay module · 5 V mini pump · 12 V fan
Parameter Value
Controller ESP32 devkit (Wi-Fi)
Sensors Capacitive soil-moisture probe; DHT22 (±0.5 °C, ±2 %RH, datasheet); LDR
Actuators 5 V mini water pump via relay; 12 V ventilation fan via relay
Planner host Student's laptop, local LLM over MQTT (supervisory)
Decision latency Typically a few seconds per cycle (expected — not real-time control)
Pump safety cap 90 s maximum per run in ESP32 firmware (configurable)
Telemetry interval Every few seconds (configurable)
Dashboard Single-file web app; 60-sample trend buffer; works on the local network
Soil reading 0–100% after the student's two-point calibration (no factory accuracy claim)

Project features

  • [ESP32 sensor node] A capacitive soil-moisture probe, DHT22 temperature/humidity sensor and an LDR light sensor wired to an ESP32 devkit on a breadboard — the full sensing front-end the dashboard is built around.
  • [Relay-driven actuation] Single-channel relay module switches a 5 V mini water pump and a 12 V ventilation fan, so the agent can physically irrigate and ventilate the demo bed.
  • [Supervisory LLM planner] A local LLM on the student's laptop subscribes to the MQTT telemetry topics, reasons over the readings against configurable thresholds, and publishes structured plans (action, duration, explanation) to the actuation topic.
  • [Explanation log] Every decision the planner makes is stored with its reasoning in plain language — strong viva material, because the student can narrate exactly why the agent watered or ventilated at each moment.
  • [Live dashboard] Real-time web dashboard showing soil moisture, temperature, humidity, actuator states, a 60-sample telemetry trend chart and the rolling agent-plan log, with editable planner thresholds.
  • [Hard safety cut-offs on the ESP32] Maximum pump run-time (90 s per run, configurable), temperature failsafe and manual override run in the ESP32 firmware and cannot be overridden by the planner.
  • [Two-point soil calibration procedure] The student calibrates the capacitive probe against dry and saturated soil references and enters the mapping, so reported moisture percentages come from their own calibration, not a guess.
  • [MQTT topic architecture] Clean retained topics for telemetry, plans, status and configuration — the student can demonstrate each message on an MQTT client during the demo.

What is included

  • Working ESP32 greenhouse prototype: sensors, relay module, mini pump, fan, breadboard wiring
  • ESP32 firmware (sensing, MQTT, actuation, safety interlocks, calibration routine)
  • Local LLM planner integration on the laptop with structured prompts and threshold configuration
  • Live single-file dashboard with telemetry, trend chart and agent-plan log
  • Wiring diagram and two-point soil calibration procedure
  • Project report PDF (architecture, MQTT design, planner prompting, safety analysis)
  • PPT presentation for final review
  • Viva Q&A preparation document (agentic IoT, MQTT, ESP32 vs planner responsibilities, LLM latency honesty)

Timeline

  • Built-to-order assembly, calibration and testing typically takes 2–3 weeks after order confirmation (expected timeline, confirmed at quotation).
  • The planner setup and dashboard are configured in the same window; the report, PPT and viva kit ship with the prototype.

Support

  • Remote guidance for setting up the laptop-side MQTT broker and local LLM planner.
  • A walkthrough of the agent-plan logic and the explanation log so the student can present it confidently.
  • Viva preparation support covering MQTT, ESP32 firmware limits and the supervisory-planner design.

Limitations & prerequisites

  • The LLM planner is supervisory: decisions take a few seconds per cycle (expected) and it is never used for real-time safety control — failsafes live on the ESP32.
  • The planner needs the student's laptop running with a local LLM; it does not run on the microcontroller.
  • Soil-moisture percentages depend on the student's own two-point calibration — uncalibrated readings are approximate only.
  • The DHT22 is accurate to about ±0.5 °C / ±2 %RH per its datasheet and is slow to respond to fast changes — not a precision instrument.
  • This is a demonstration-scale bed, not a production greenhouse; no crop-yield improvement is claimed or measured.
  • Wi-Fi range limits where the ESP32 node can sit relative to the laptop; MQTT over the internet is an optional extension.

Frequently Asked Questions

Is this project suitable for a final-year project?

Yes — for Electronics, IoT and Embedded programs. It demonstrates capacitive soil sensing, ESP32 firmware, MQTT telemetry, relay actuation, agentic LLM planning with explainability, and a live dashboard — a complete edge-to-agent pipeline.

Does the AI run on the ESP32?

No, and the page states that honestly. The ESP32 senses, actuates and enforces safety; the LLM planner runs on the student's laptop and issues supervisory commands over MQTT. This split is a deliberate design decision the student can defend in the viva.

Why not just use fixed thresholds in code?

Threshold code works, but its logic is buried in firmware. The agent approach adds readable explanations for every decision, configurable behaviour without reflashing, and a modern agentic-IoT architecture — while the ESP32 keeps the hard safety cut-offs.

What if the laptop or Wi-Fi disconnects?

The ESP32's safety interlocks keep running independently: the pump cannot exceed its maximum run-time and the temperature failsafe stays active. Only new plans stop arriving; nothing unsafe happens.

Can sensors or actuators be added?

Yes — realistic extensions include a pH sensor, a second relay channel for a grow light, a water-level float switch for the reservoir, or an MQTT-over-internet bridge for remote monitoring.

What will I receive with the project?

The working prototype, firmware, planner setup, dashboard, wiring diagram, calibration procedure, report PDF, PPT and viva Q&A — the complete built-to-order kit listed under "What's included". Suitable for B.E./B.Tech final-year projects in IoT, Embedded Systems and Electronics.

Components & software requirements
  • ESP32 devkit (Arduino C++ firmware)
  • MQTT broker (Mosquitto on the student's laptop)
  • Local LLM planner (Ollama-class model, structured prompting)
  • Web dashboard (single-file HTML/CSS/JS)
  • DHT22 · capacitive soil probe · LDR
  • Relay module · 5 V mini pump · 12 V fan
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download free synopsis (PDF)

Enter your name and email — the synopsis PDF downloads immediately. We may send occasional project updates; no spam, unsubscribe anytime.

Get a quotation