Community project

Automated Mini Greenhouse

Photo of Automated Mini Greenhouse
Generated with AI

Ivan Ilaw

Published November 17, 2026

This automated mini greenhouse uses an Arduino Uno to monitor and control growing conditions for seedlings or small plants. The system reads soil moisture, temperature, humidity, and light levels, then automatically waters the plants and activates ventilation based on configurable thresholds. An LCD display shows real-time sensor data, while LEDs and a buzzer provide status alerts.

The guide includes a complete wiring diagram, parts list with sensor calibration values, and step-by-step assembly instructions for building the greenhouse enclosure and integrating all components. The provided Arduino firmware handles sensor reading, relay control for the water pump and fan, and display management, so builders can customize watering schedules and climate targets for their specific plants.

Wiring diagram

Loading diagram…

Gather all the parts

QtyComponent
1

DFRobot SEN0308 capacitive soil sensor

SEN0308 supply 3.3–5.5V, output 0–2.9V analog; no MCU output drives this sensor.

1

DFRobot DFR0067 DHT11 module

DFR0067 manufacturer datasheet specifies 3–5.5V supply and single-bus data. Powered at 5V with 5V pull-up.

1

Photo Cell (CdS Photoresistor)

CdS light-dependent resistor. Resistance decreases as light increases. Adafruit product 161 currently specifies approximately 1 kΩ in light and 10 kΩ in dark. Use either symmetric lead in a voltage divider and read the divider with an analog input.

1

Water Level Sensor (switched power)

Catalog analog sensor; + supplied by D7 only during 10ms readings, per catalog example.

1

LCD 16x2 I2C

16x2 character LCD display with I2C backpack

1

Piezo Buzzer

Small passive piezo buzzer (TDK PS1240) for beeps, tones and alerts. It has no built-in oscillator, so drive one lead with a 3-30 V square wave from a microcontroller pin using tone() or PWM and connect the other lead to ground. It is loudest around 4 kHz and works from about 2 to 10 kHz; driving both leads in antiphase roughly doubles the volume.

1

USB-C 5V Adapter

USB-C wall adapter delivering regulated 5 V to the board's USB or VBUS rail. Default wired power source for desktop / stationary projects.

1

1N4007 Diode

General-purpose silicon rectifier diode in DO-204AL (DO-41) axial through-hole package. Rated 1A average forward current and 1000V peak reverse voltage (VRRM). Forward voltage drop ~0.7V at typical load (up to 1.1V at full 1A). Used here in series with LM7805 Vout for reverse polarity protection: anode to LM7805 output, cathode to 5V rail, resulting in ~4.3V on the output rail. Not suitable for high-frequency switching (reverse recovery ~2µs–30µs); intended for DC or 50/60Hz rectification only.

1

1N4007 Diode

General-purpose silicon rectifier diode in DO-204AL (DO-41) axial through-hole package. Rated 1A average forward current and 1000V peak reverse voltage (VRRM). Forward voltage drop ~0.7V at typical load (up to 1.1V at full 1A). Used here in series with LM7805 Vout for reverse polarity protection: anode to LM7805 output, cathode to 5V rail, resulting in ~4.3V on the output rail. Not suitable for high-frequency switching (reverse recovery ~2µs–30µs); intended for DC or 50/60Hz rectification only.

1

Resistor

10 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

10 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

10 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

10 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

330 Ω

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

330 Ω

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

330 Ω

Through-hole resistor (current-limiting in series with an LED)

1

LED

green

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

LED

red

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

LED

yellow

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

ShillehTek 2-channel 5V active-LOW relay module

Leave JD-VCC jumper installed. HIGH off, LOW on; normally-open contacts switch external 5V loads.

1

Mini submersible 3–5V DC water pump

Two-wire pump, 100–200 mA nominal at 5V; operate submerged only. Match tubing to outlet.

1

4010 5V two-wire brushless fan

40x40x10 mm fan, 0.14A nominal; red positive, black ground.

Assemble it in 7 steps

1. Build the miniature house

Make a house frame from popsicle sticks or cardboard and cover it with clear plastic. Leave an inlet opening opposite the fan. Put the garden bed in a waterproof tray. Mount all electronics outside the wet area and above the tank.

2. Connect sensors and screen

Follow the wiring view. Soil AOUT → A0 measures moisture. DHT DATA → D2 measures temperature and humidity; use its 10k pull-up to 5V. Soil sensor uses 5V (its specified supply range is 3.3–5.5V). LDR and 10k resistor form a light divider read at A1. Tank S → A2 measures water; + → D7 powers it briefly. LCD SDA → A4 is data, SCL → A5 is clock. Adjust the LCD contrast screw if text is invisible.

3. Connect status lights and sound

Green on D5 means watering, red on D6 means a sensor fault or low water, yellow on D8 means low light. Each LED has its own 330-ohm series resistor; short leg goes to ground. Passive piezo SIG → D9, other lead → ground.

4. Wire the relay and loads

Use the active-LOW two-channel module. IN1 → D3 controls pump; IN2 → D4 controls fan. Fit 10k pull-ups on both inputs. Keep JD-VCC jumper installed. External 5V goes to relay VCC and both COM terminals. NO1 goes to pump positive, NO2 to fan positive. Negative wires go to shared ground. Add a diode across each load: striped cathode to positive, anode to negative. Leave NC terminals unused.

  • Switch only 5V DC. Never connect household mains to the relays.

5. Keep power sources separate

Use a regulated 5V 2A adapter for the load rail, relay, pump and fan. Power the Uno and sensors by USB. Join adapter ground to Uno ground, but NEVER join adapter positive to Uno 5V or VIN. Use secure terminal connections for motor current, not loose breadboard contacts.

  • Unplug both sources before wiring. Keep adapter and electronics dry.

6. Install water and ventilation

Submerge the pump and attach matching tubing to the bed. Keep the tank below the tubing outlet to prevent siphoning after the pump stops. Mount the fan blowing outward with a guard. Put the tank sensor at the minimum safe water height above the pump intake; never immerse its connector. Soil probe goes into soil away from the water outlet.

7. Calibrate before automatic watering

Initially leave the pump disconnected. Read soilRaw and tankRaw in the serial monitor. Set SOIL_DRY from dry soil and SOIL_WET from watered, drained soil in the firmware. Adjust WATER_LOW and WATER_OK so the pump locks out before its inlet is exposed. Light is relative brightness, not lux. Test low water and relay switching before connecting the submerged pump. Default watering is 2 seconds followed by at least 60 seconds soaking; reduce pulse time if too much water flows.

  • A corroded or stuck-wet tank sensor cannot guarantee dry-run protection. Inspect it frequently and never leave this demonstration unattended. Sensor disconnection is not reliably detectable in every case.

Review all connections

1. Connections between "soil" and "Arduino"

FunctionsoilArduino
powerVCC5V
groundGNDGND
analogAOUTGPIO 14

2. Connections between "climate" and "Arduino"

FunctionclimateArduino
powerVCC5V
groundGNDGND
dataDATAGPIO 2

3. Connections between "dhtPull" and "Arduino"

FunctiondhtPullArduino
powerP15V
digitalP2 → DFRobot DFR0067 DHT11 module DATAEXT

4. Connections between "light" and "Arduino"

FunctionlightArduino
powerTerminal 15V
passiveTerminal 2 → Resistor P1EXT

5. Connections between "lightR" and "Arduino"

FunctionlightRArduino
digitalP1GPIO 15
groundP2GND

6. Connections between "tank" and "Arduino"

FunctiontankArduino
digital+GPIO 7
ground-GND
analogSGPIO 16

7. Connections between "lcd" and "Arduino"

FunctionlcdArduino
powerVCC5V
groundGNDGND
i2cSDAGPIO 18
i2cSCLGPIO 19

8. Connections between "buzzer" and "Arduino"

FunctionbuzzerArduino
pwmSIGGPIO 9
groundGNDGND

9. Connections between "supply" and "Arduino"

FunctionsupplyArduino
power+5V5V
groundGNDGND

10. Connections between "relay" and "Arduino"

FunctionrelayArduino
powerVCC5V
groundGNDGND
digitalIN1GPIO 3
digitalIN2GPIO 4
powerCOM15V
powerCOM25V
powerNO1 → Mini submersible 3–5V DC water pump +EXT
powerNO2 → 4010 5V two-wire brushless fan +EXT

11. Connections between "pumpPull" and "Arduino"

FunctionpumpPullArduino
powerP15V
digitalP2 → ShillehTek 2-channel 5V active-LOW relay module IN1EXT

12. Connections between "fanPull" and "Arduino"

FunctionfanPullArduino
powerP15V
digitalP2 → ShillehTek 2-channel 5V active-LOW relay module IN2EXT

13. Connections between "pump" and "Arduino"

FunctionpumpArduino
ground-GND

14. Connections between "fan" and "Arduino"

FunctionfanArduino
ground-GND

15. Connections between "pumpDiode" and "Arduino"

FunctionpumpDiodeArduino
powerCathode → Mini submersible 3–5V DC water pump +EXT
powerAnode → Mini submersible 3–5V DC water pump -EXT

16. Connections between "fanDiode" and "Arduino"

FunctionfanDiodeArduino
powerCathode → 4010 5V two-wire brushless fan +EXT
powerAnode → 4010 5V two-wire brushless fan -EXT

17. Connections between "greenR" and "Arduino"

FunctiongreenRArduino
digitalP1GPIO 5
digitalP2 → LED ANODEEXT

18. Connections between "green" and "Arduino"

FunctiongreenArduino
groundGNDGND

19. Connections between "redR" and "Arduino"

FunctionredRArduino
digitalP1GPIO 6
digitalP2 → LED ANODEEXT

20. Connections between "red" and "Arduino"

FunctionredArduino
groundGNDGND

21. Connections between "yellowR" and "Arduino"

FunctionyellowRArduino
digitalP1GPIO 8
digitalP2 → LED ANODEEXT

22. Connections between "yellow" and "Arduino"

FunctionyellowArduino
groundGNDGND

Deploy the firmware

#include <Arduino.h>
#include <Wire.h>
#include <DHT.h>
#include <LiquidCrystal_I2C.h>
#include <avr/wdt.h>
DHT dht(2,DHT11);
LiquidCrystal_I2C lcd(0x27,16,2);
// Calibrate these raw ADC endpoints with the actual soil sensor.
const int SOIL_DRY=520, SOIL_WET=260;
const int WATER_LOW=180, WATER_OK=250, LIGHT_LOW=35;
const unsigned long PULSE=2000, SOAK=60000;
bool pumping=false, fan=false, water=false, soilFault=true, climateFault=true;
int moisture=0, lightPct=0, tankRaw=0, soilRaw=0;
float temperature=0, humidity=0;
unsigned long pumpStart=0,lastStop=0,lastAnalog=0,lastClimate=0;
char previous[2][17]={{0},{0}};
void stopPump(unsigned long now){pumping=false;digitalWrite(3,HIGH);lastStop=now;}
void row(byte r,const char* text){char out[17];memset(out,' ',16);out[16]=0;memcpy(out,text,min((size_t)16,strlen(text)));if(strcmp(out,previous[r])){lcd.setCursor(0,r);lcd.print(out);strcpy(previous[r],out);}}
void setup(){
 MCUSR=0;wdt_disable();
 digitalWrite(3,HIGH);pinMode(3,OUTPUT);digitalWrite(4,HIGH);pinMode(4,OUTPUT);
 for(byte p=5;p<=9;p++){pinMode(p,OUTPUT);digitalWrite(p,LOW);}
 Serial.begin(9600);Wire.begin();Wire.setWireTimeout(25000,true);lcd.init();lcd.backlight();dht.begin();
 lastStop=millis();wdt_enable(WDTO_8S);
}
void loop(){
 wdt_reset();unsigned long now=millis();
 if(pumping && now-pumpStart>=PULSE)stopPump(now);
 if(now-lastAnalog>=250){lastAnalog=now;
 digitalWrite(7,HIGH);delay(10);analogRead(A2);tankRaw=analogRead(A2);digitalWrite(7,LOW);
 if(tankRaw<WATER_LOW)water=false;else if(tankRaw>WATER_OK)water=true;
 analogRead(A0);soilRaw=analogRead(A0);soilFault=soilRaw<10||soilRaw>1000;
 moisture=constrain(map(soilRaw,SOIL_DRY,SOIL_WET,0,100),0,100);
 analogRead(A1);lightPct=map(analogRead(A1),0,1023,0,100);
 if(pumping&&(!water||soilFault||moisture>=45))stopPump(now);
 }
 if(now-lastClimate>=2200){lastClimate=now;temperature=dht.readTemperature();humidity=dht.readHumidity();climateFault=isnan(temperature)||isnan(humidity);
 if(climateFault)fan=true;else if(temperature>=30||humidity>=80)fan=true;else if(temperature<=28&&humidity<=75)fan=false;
 digitalWrite(4,fan?LOW:HIGH);
 Serial.print(F("soilRaw="));Serial.print(soilRaw);Serial.print(F(" tankRaw="));Serial.print(tankRaw);Serial.print(F(" light%="));Serial.println(lightPct);
 }
 if(!pumping&&water&&!soilFault&&moisture<30&&now-lastStop>=SOAK){pumping=true;pumpStart=now;digitalWrite(3,LOW);}
 bool alert=!water||soilFault||climateFault;
 digitalWrite(5,pumping);digitalWrite(6,alert);digitalWrite(8,lightPct<LIGHT_LOW);
 if(alert && now%5000<150)tone(9,4000);else noTone(9);
 char line[17];
 if((now/3000)%2==0){if(climateFault)row(0,"Climate ERROR");else {snprintf(line,17,"T:%dC H:%d%%",(int)temperature,(int)humidity);row(0,line);}snprintf(line,17,"Soil:%d%% L:%d%%",moisture,lightPct);row(1,line);}
 else {snprintf(line,17,"Pump:%s Fan:%s",pumping?"ON":"OFF",fan?"ON":"OFF");row(0,line);row(1,!water?"LOW WATER LOCK":soilFault?"SOIL ERROR":climateFault?"CLIMATE ERROR":lightPct<LIGHT_LOW?"LOW LIGHT":pumping?"Watering...":"Monitoring");}
}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik