Community project

Automated Mini Greenhouse

Photo of Automated Mini Greenhouse
Generated with AI

Ivan Ilaw

Published November 28, 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, air temperature and humidity, light levels, and water tank status, then automatically waters the plant and activates cooling as needed. A 16x2 LCD display shows real-time sensor readings, while a traffic light and buzzer provide status indicators.

Builders will receive a complete wiring diagram showing how to connect the soil moisture sensor, DHT11 module, photoresistor, water level sensor, relay module, submersible pump, and display to the Arduino. The guide includes a full parts list, step-by-step assembly instructions for the breadboard layout, and calibrated firmware ready to upload. Once assembled and calibrated, the greenhouse runs autonomously, watering when soil dries out and managing humidity and temperature through relay-controlled loads.

Wiring diagram

Wiring diagram for Automated Mini Greenhouse
Loading diagram…

Gather all the parts

QtyComponent
1

DFRobot SEN0308 IP65 Capacitive Soil Moisture Sensor

SEN0308 supply 3.3-5.5V; analog output 0-2.9V goes directly to Uno ADC input, not a digital logic input. No level shifter is needed. Powered here from 3.3V.

1

DFRobot DFR0067 DHT11 module

5V Gravity DHT11 module; connect marked signal, positive and negative terminals.

1

Photo Cell (CdS Photoresistor)

Nonpolar resistive light divider; terminal 2 is the A1 analog sensing junction.

1

Water Level Sensor

Low-current module with switched D7 supply; verify current below 20mA.

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

1N4007 Diode

Reverse-biased flyback diode across the load, not a series voltage-drop diode. Stripe toward load positive.

1

1N4007 Diode

Reverse-biased flyback diode across the load, not a series voltage-drop diode. Stripe toward load positive.

1

Traffic Light

Three-channel red/yellow/green traffic-light LED module. Common Arduino modules expose one shared ground and three digital control pins; many boards include current-limiting resistors, while discrete-LED builds should still use one resistor per LED.

1

SparkFun microB USB Breakout (power-only use)

BOB-12035 used only for 5V USB power; D-, D+ and ID intentionally unconnected.

1

Resistor

1k ohm

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

1

Resistor

1k ohm

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

1

Resistor

1k ohm

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

1

Resistor

10k ohm

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

1

Resistor

10k ohm

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

1

Resistor

10k ohm

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

1

Resistor

220 ohm

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

1

ShillehTek 2-channel 5V active-LOW relay module

Leave JD-VCC/VCC jumper fitted. LOW energizes relay. About 70mA per coil.

1

Mini submersible 3–5V DC water pump

Two-wire 5V load. Connect marked positive and negative leads; never power from GPIO. Verify polarity and rated current before use.

1

4010 5V two-wire brushless fan

Two-wire 5V load. Connect marked positive and negative leads; never power from GPIO. Verify polarity and rated current before use.

1

ES-CD28 dual USB-A wall charger (5V, 2A total)

Sealed wall charger. Port 1 powers USB breakout; port 2 powers Uno through its USB socket during standalone use. 2A combined limit. Never open charger.

Assemble it in 11 steps

1. Prepare your long breadboard

Use the breadboard for signal wiring and sensor power only. With all power unplugged, use one side's red rail for Uno 5V and blue rail for ground. Connect Uno 5V to red and Uno GND to blue. Breadboard rows connect in groups of five; the centre gap separates them. If the long power rails are split halfway, bridge red to red and blue to blue. Do not join opposite red rails unless you have confirmed their purpose.

  • Check rail continuity with a meter; board lengths and rail layouts vary.

2. Wire the soil and air sensors

Soil VCC to Uno 3.3V pin (not the red 5V rail), GND to ground, AOUT to A0 (soil reading). DHT module VCC to 5V, GND to ground, DATA to D2 (temperature and humidity). Follow the printed terminal labels, not wire colours. Insert only the soil probe's sensing end into soil.

3. Make the light divider

With power unplugged, insert the photoresistor legs into I56 and I57. Connect J56 to the Uno 5V rail. Connect J57 to A1 (light reading). Insert one leg of the 10k resistor into H57 and its other leg into H58; connect J58 to the ground rail. On a standard breadboard F through J of each numbered row are connected, so I57, J57 and H57 share the light-reading junction. Rows 56, 57 and 58 must be otherwise unused. Photoresistor and resistor have no polarity. Higher readings mean brighter light.

4. Wire the switched water sensor

Sensor + to D7 (power only during readings), - to ground, S to A2 (water reading). Keep the electronics above water; only immerse the marked sensing traces.

  • Use this low-current sensor only; D7 is not a general power supply. Verify sensor current stays below 20mA. Corrosion can cause incorrect readings; inspect regularly.

5. Connect the display

LCD VCC to 5V, GND to ground, SDA to A4 (data), SCL to A5 (clock). Adjust the small contrast screw until letters appear. Firmware checks the common addresses 0x27 and 0x3F.

6. Connect the traffic light and buzzer

Traffic light GND to ground. D4 through its own 1k resistor to RED; D5 through a second 1k resistor to YELLOW; D6 through a third 1k resistor to GREEN. D3 through the 220 ohm resistor to buzzer SIG; buzzer GND to ground. Red indicates low water or sensor fault, yellow indicates an active pump or fan, green indicates normal idle operation.

7. Connect relay control signals

Relay IN1 to D8 (pump control), IN2 to D9 (fan control), and GND to common ground. Connect one 10k resistor between IN1 and Uno 5V, and the other between IN2 and Uno 5V. Leave the relay's JD-VCC/VCC jumper fitted if present. LOW turns these relays on. Relay VCC gets the separate load supply, not the Uno 5V rail.

8. Prepare the separate load supply

With the charger unplugged, connect the breakout VCC to relay VCC and both COM terminals using secure direct wiring. Connect breakout GND to relay GND and Uno GND. Leave breakout D+, D- and ID disconnected. Charger USB port 1 connects to the breakout using a USB cable. In standalone use port 2 connects to the Uno USB socket. For Deploy, use the computer cable in the Uno socket instead.

  • Never connect breakout VCC to Uno 5V: keep positive supplies separate. Never open the wall charger. Its 2A limit is shared between both ports.

9. Connect the pump and its diode

Relay NO1 to pump positive. Pump negative directly to breakout GND. Put one 1N4007 across the pump: striped end (cathode) to positive, unstriped end (anode) to negative. Leave NC1 unused. Use secure terminals or insulated solder joints, not breadboard contacts, for load wiring.

  • A reversed diode shorts the supply when the relay turns on. Keep the submersible pump underwater while running and keep connections dry.

10. Connect the fan and its diode

Relay NO2 to fan positive. Fan negative directly to breakout GND. Put the second 1N4007 across the fan: stripe to positive, unstriped end to negative. Leave NC2 unused. Keep motor-current paths out of the breadboard.

  • Check pump and fan rated and startup currents; combined load plus Uno and relay coils must stay below the charger's 2A total rating. The 800mA project estimate is not a measured rating.

11. Calibrate and test safely

Initially disconnect pump positive. Check serial readings with the soil sensor in dry and wet soil, and the water sensor at an empty and safely filled reservoir. Adjust SOIL_DRY, SOIL_WET and WATER_MIN in firmware using those readings. Dry soil should read higher than wet soil. Reconnect the pump only after testing the low-water cutoff. Default watering is a 3-second pulse with at least 60 seconds of rest; fan starts at 30 degrees C and stops at 27. Light is monitored only, not controlled.

  • Do not leave this prototype unattended until calibration, watering volume and low-water cutoff have been tested. Sensor failure can still cause flooding or dry running. Keep the charger, Uno and breadboard outside the wet area.

Review all connections

1. Connections between "soil" and "Arduino"

FunctionsoilArduino
powerVCC3V3
groundGNDGND
analogAOUTGPIO 14

2. Connections between "dht" and "Arduino"

FunctiondhtArduino
powerVCC5V
groundGNDGND
dataDATAGPIO 2

3. Connections between "lcd" and "Arduino"

FunctionlcdArduino
powerVCC5V
groundGNDGND
i2cSDAGPIO 18
i2cSCLGPIO 19

4. Connections between "light" and "Arduino"

FunctionlightArduino
powerTerminal 1 → Photoresistor leg at I56; J56 jumper to Uno 5V rail.5V
passiveTerminal 2 → Photoresistor leg at I57; J57 jumper to A1.GPIO 15
passiveTerminal 2 → Resistor P1EXT

5. Connections between "ldrR" and "Arduino"

FunctionldrRArduino
groundP2 → Other resistor leg at H58; J58 jumper to ground rail.GND

6. Connections between "water" and "Arduino"

FunctionwaterArduino
analogSGPIO 16
digital+GPIO 7
ground-GND

7. Connections between "buzzer" and "Arduino"

FunctionbuzzerArduino
pwmSIG → Resistor P2EXT
groundGNDGND

8. Connections between "buzzR" and "Arduino"

FunctionbuzzRArduino
digitalP1GPIO 3

9. Connections between "traffic" and "Arduino"

FunctiontrafficArduino
groundGNDGND

10. Connections between "rr" and "Arduino"

FunctionrrArduino
digitalP1GPIO 4
digitalP2 → Traffic Light REDEXT

11. Connections between "ry" and "Arduino"

FunctionryArduino
digitalP1GPIO 5
digitalP2 → Traffic Light YELLOWEXT

12. Connections between "rg" and "Arduino"

FunctionrgArduino
digitalP1GPIO 6
digitalP2 → Traffic Light GREENEXT

13. Connections between "charger" and "Arduino"

FunctionchargerArduino
powerUSB1_5V → SparkFun microB USB Breakout (power-only use) VCCEXT
groundUSB1_GND → SparkFun microB USB Breakout (power-only use) GNDEXT

14. Connections between "usb" and "Arduino"

FunctionusbArduino
powerVCC5V
groundGNDGND

15. Connections between "relay" and "Arduino"

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

16. Connections between "pull1" and "Arduino"

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

17. Connections between "pull2" and "Arduino"

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

18. Connections between "pump" and "Arduino"

FunctionpumpArduino
ground-GND

19. Connections between "dp" and "Arduino"

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

20. Connections between "fan" and "Arduino"

FunctionfanArduino
ground-GND

21. Connections between "df" and "Arduino"

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

Deploy the firmware

// Wiring reviewed: photoresistor I56/I57 placement only; A1 divider unchanged.
// Water sensor D7 switched power unchanged; load diodes remain across separate 5V loads.
#include <Arduino.h>
#include <Wire.h>
#include <DHT.h>
#include <LiquidCrystal_I2C.h>
DHT dht(2,DHT11);
LiquidCrystal_I2C lcd(0x27,16,2);
// Wiring verified: SEN0308 analog output to A0, supply to 3V3.
// Calibrate these using Serial readings before unattended use.
const int SOIL_DRY=520, SOIL_WET=350, WATER_MIN=250;
const unsigned long PULSE=3000, REST=60000;
bool pumping=false, fanOn=false, waterOK=false, climateOK=false;
unsigned long pumpStart=0,lastStop=0,lastSample=0;
int soil=0,light=0,water=0; float temp=NAN,humidity=NAN;
char previous[2][17]={{0},{0}};
void row(uint8_t r,const char* text){
 char padded[17]; memset(padded,' ',16); padded[16]=0;
 memcpy(padded,text,min((size_t)16,strlen(text)));
 if(strcmp(padded,previous[r])){lcd.setCursor(0,r);lcd.print(padded);strcpy(previous[r],padded);}
}
void setup(){
 // Set inactive levels before enabling relay outputs.
 digitalWrite(8,HIGH);digitalWrite(9,HIGH);pinMode(8,OUTPUT);pinMode(9,OUTPUT);
 digitalWrite(7,LOW);pinMode(7,OUTPUT);
 for(int p=4;p<=6;p++){digitalWrite(p,LOW);pinMode(p,OUTPUT);}
 Serial.begin(9600);dht.begin();Wire.begin();
 // Common backpacks use 0x27 or 0x3F; detect either.
 Wire.beginTransmission(0x27);
 if(Wire.endTransmission()!=0) lcd=LiquidCrystal_I2C(0x3F,16,2);
 lcd.init();lcd.backlight();row(0,"Greenhouse");row(1,"Calibrate first");
 lastStop=millis();
}
void loop(){
 unsigned long now=millis();
 if(pumping && now-pumpStart>=PULSE){pumping=false;lastStop=now;digitalWrite(8,HIGH);}
 if(now-lastSample<2000)return;
 lastSample=now;soil=analogRead(A0);light=analogRead(A1);
 digitalWrite(7,HIGH);delay(10);water=analogRead(A2);digitalWrite(7,LOW);
 waterOK=water>=WATER_MIN;
 temp=dht.readTemperature();humidity=dht.readHumidity();climateOK=!isnan(temp)&&!isnan(humidity);
 if(!climateOK)fanOn=false;
 else if(temp>=30)fanOn=true;
 else if(temp<=27)fanOn=false;
 digitalWrite(9,fanOn?LOW:HIGH);
 if(pumping && (!waterOK || soil<=SOIL_WET)){pumping=false;lastStop=now;digitalWrite(8,HIGH);}
 if(!pumping && waterOK && soil>=SOIL_DRY && now-lastStop>=REST){pumping=true;pumpStart=now;digitalWrite(8,LOW);}
 bool alarm=!waterOK||!climateOK;
 digitalWrite(4,alarm);digitalWrite(5,!alarm&&(pumping||fanOn));digitalWrite(6,!alarm&&!pumping&&!fanOn);
 if(alarm)tone(3,2000,100);else noTone(3);
 char line[17];
 if(climateOK)snprintf(line,sizeof(line),"T:%dC H:%d%%",(int)temp,(int)humidity);
 else snprintf(line,sizeof(line),"DHT sensor error");
 row(0,line);
 if(!waterOK)row(1,"LOW WATER: OFF");
 else {snprintf(line,sizeof(line),"S:%d P:%d F:%d",soil,pumping,fanOn);row(1,line);}
 Serial.print(F("soil="));Serial.print(soil);Serial.print(F(" light="));Serial.print(light);
 Serial.print(F(" water="));Serial.print(water);Serial.print(F(" temp="));Serial.print(temp);
 Serial.print(F(" humidity="));Serial.println(humidity);
}

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