← Projects
electronics intermediate 16 days ago ◑ 20 views ◯ 5 min read

Build an ESP32 Greenhouse Climate Controller: Automated Venting, Shading, and Irrigation

Build time: 2 weekends
Tools needed: Soldering iron, wire strippers, a drill for mounting actuators and enclosures, basic hand tools for the vent/shade linkage, a multimeter for checking wiring before powering up, a laptop with the Arduino IDE or ESPHome/PlatformIO for firmware
ESP32greenhouseclimate controlautomationirrigationhome assistantgardeningautomated venting
Parts List

A backyard greenhouse without automation is a second job: someone has to open the vents on hot mornings, close them before an evening cold snap, pull the shade cloth during a heat wave, and keep the watering schedule consistent through a week when nobody's home to do it. This project builds a standalone ESP32 controller that handles all three — automated roof/side vent opening, a motorized shade cloth roller, and zoned drip irrigation — driven by temperature, humidity, and soil moisture sensors, with everything exposed to Home Assistant for logging, alerts, and manual override.

This is a meaningfully bigger-scope build than a soil-moisture drip irrigation controller on its own: a full-size greenhouse structure has real thermal mass and real failure modes (an actuator jamming on a stuck vent track, a frozen irrigation line in a cold snap) that a small indoor planter setup doesn't, so the control logic and the mechanical linkage both need more attention than a simple "water when dry" sketch.

What's Being Automated

SubsystemActuatorTrigger logic
Roof/side vents12V linear actuator, geared for enough force to overcome wind load on the vent panelOpens progressively as interior temperature climbs past a setpoint; closes on falling temperature or detected high wind (if you add an anemometer later)
Shade clothLow-RPM 12V gear motor driving a roller tubeDeploys based on a light sensor and temperature combination, so it doesn't shade on a cool-but-bright spring day
Irrigation zones12V solenoid valves on a timed/zoned drip manifoldSoil moisture threshold per zone, with a scheduled time-of-day window to avoid midday watering losses to evaporation

Sensor Placement

Mount the temperature/humidity sensor at plant canopy height, shaded from direct sun with a simple radiation shield (a small louvered 3D-printed or PVC housing) — an unshaded sensor in direct greenhouse sun will read 10-15°F hotter than the actual air temperature and your vent logic will open far too aggressively. Put one soil moisture sensor per irrigation zone, inserted to root depth rather than near the surface, since surface soil dries out and rewets much faster than the zone that actually matters for plant health.

Vent Actuator Linkage

The mechanical linkage between the actuator and the vent panel matters as much as the electronics — a linear actuator pushing directly on a hinged vent needs to handle the full range of motion without binding at either extreme, and needs a travel limit (either the actuator's built-in limit switches, if it has them, or software-enforced limits based on timed travel) so a software fault can't drive the vent past its physical range and strip the linkage.

Firmware and Control Logic

ESPHome is the fastest path to a reliable, Home-Assistant-integrated controller here — define the sensors, the relay/motor outputs, and a handful of automations directly in ESPHome's YAML rather than hand-rolling everything in raw Arduino code, since you get OTA updates, a web dashboard, and Home Assistant integration essentially for free. The core control automations:

  1. Vent control: a PID or simple hysteresis loop (open further as temperature rises past setpoint, close as it falls back below setpoint minus a deadband) rather than a hard on/off threshold, to avoid the actuator hunting back and forth on a borderline day.
  2. Shade control: a combined light-level and temperature condition, since shade should deploy on hot, bright days and stay retracted on hot-but-overcast days when plants need the light more than the shade.
  3. Irrigation scheduling: per-zone soil moisture thresholds, gated to only run within an early-morning or evening time window, with a safety cutoff that won't run a zone that's already below freezing (a frozen line that bursts mid-winter is a much worse problem than one dry day).

Weatherproofing and Power

Everything inside the greenhouse lives in a genuinely humid, occasionally very hot, occasionally condensing environment — mount the ESP32 and relay board in a sealed IP65 enclosure, run cable glands for every wire penetration rather than drilled holes, and keep the enclosure itself out of direct splash from the irrigation system. Power the actuators and valves from a 12V supply sized with margin for the combined peak draw (vent actuator and a few solenoids firing briefly together is the worst case), and fuse each major branch separately so a shorted valve solenoid doesn't take down vent control with it.

Failure Modes to Design Around

FailureDesign response
Wi-Fi drops outController should keep running its local temperature/moisture automations independently of Home Assistant connectivity — don't make routine climate control depend on a network round-trip
Vent actuator jamsSoftware travel-time limits that cut power if a move takes meaningfully longer than expected, rather than stalling the motor against a jam indefinitely
Soil sensor fails or reads stuckA maximum daily watering cap per zone regardless of sensor reading, so a stuck-dry sensor reading can't trigger all-day watering
Power loss during a heat eventVents should fail in a safe default position (partially open) rather than fully closed, via a normally-open relay wiring choice where practical

Once the core three subsystems are running reliably, this is an easy platform to extend — add a rain sensor to skip scheduled irrigation after a storm, a second temperature zone for a propagation bench that needs different setpoints than the main growing area, or a simple webcam feed so you can eyeball plant health without walking out to the greenhouse.