
Control Systems · Electronics Integration · 3D-Printed Mechanical Design
Greenhouse control system
A Raspberry Pi-based climate controller that monitors temperature, humidity, water level, and light — replacing intermittent human attention with a system that responds continuously and doesn't need to be checked.


The goal
I wanted a greenhouse that looks after itself. Temperature, humidity, airflow, water level and light are all managed from live sensor readings, so nobody has to remember to check on it. The target was simple: keep conditions good for the plants without constant attention.
The hardware
Everything runs off a Raspberry Pi 4B. It reads the sensors, switches four relays and drives the stepper motor for the vent.
Sensing
An HDC1080 inside the greenhouse reports temperature and humidity. A three-pin analog water level sensor sits in the reservoir.
What the relays switch
Four relays handle the water pump that feeds the humidifier, the humidifier itself, the LED grow light and the fan. The fan runs inside the greenhouse so moisture and air spread out evenly instead of pooling around the humidifier.
The vent
When humidity climbs past the upper limit, a stepper motor opens a 3D-printed PLA vent to let the extra moisture out. A pinion on the motor drives a rack that slides the vent panel open. Once humidity settles, it closes again.
The software
The control code is Python, split into three jobs: reading the sensors, deciding what to do, and testing it all without live hardware.
Reading the sensors
The Pi talks to the HDC1080 over I2C. A loop reads temperature and humidity at regular intervals and logs every reading, and the control logic works from those values.
Deciding what to do
Humidity: below 80%, the humidifier turns on and the fan spreads the vapor. Above the upper threshold, the vent opens until humidity settles.
Water: when the level sensor says the reservoir is running low, the pump refills it. That keeps the humidifier from running dry and the humidity steady.
Light: the grow light follows a fixed daily schedule, 12 hours on and 12 off.
Testing without the hardware
I simulated the whole control system in a Jupyter notebook first. It feeds the code fake sensor readings, using wave functions to make temperature and humidity rise and fall, so I could check the logic before touching live hardware.
What building it taught me
Most of the components were hobby-grade or pulled from earlier builds. Running them at high uptime in a genuinely humid environment pushed them in ways normal use wouldn't. HDC1080 sensors drifted. Water level sensors gave inconsistent readings. Ultrasonic misters failed.
Each failure forced a response. Humidity sensor drift led to averaging logic that smooths transient readings before they trigger an actuator. Water level sensor inaccuracy pushed the pump trigger earlier and more conservatively, which turns out to be a safer operating mode anyway. The system that came out of those failures handles component degradation more gracefully than one tested under ideal conditions.
How it turned out
It held the conditions I set. The two pumps, the sensors and the relays work together, so humidity, airflow and light all regulate themselves.
The design isn't tied to this one greenhouse. A second climate zone means more sensors and relay channels, not a rewrite. A different crop means different thresholds, not different logic.
A greenhouse that runs itself isn't a complicated idea. Most implementations just don't account for what happens when the hardware misbehaves.
Sunfish Labs designs custom parts, devices and systems for founders and practitioners who need something built for real-world conditions. If your problem sits at the intersection of hardware and software, that's where we work.