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

Gather all the parts
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"
2. Connections between "dht" and "Arduino"
3. Connections between "lcd" and "Arduino"
4. Connections between "light" and "Arduino"
5. Connections between "ldrR" and "Arduino"
6. Connections between "water" and "Arduino"
7. Connections between "buzzer" and "Arduino"
8. Connections between "buzzR" and "Arduino"
9. Connections between "traffic" and "Arduino"
10. Connections between "rr" and "Arduino"
11. Connections between "ry" and "Arduino"
12. Connections between "rg" and "Arduino"
13. Connections between "charger" and "Arduino"
14. Connections between "usb" and "Arduino"
15. Connections between "relay" and "Arduino"
16. Connections between "pull1" and "Arduino"
17. Connections between "pull2" and "Arduino"
18. Connections between "pump" and "Arduino"
19. Connections between "dp" and "Arduino"
20. Connections between "fan" and "Arduino"
21. Connections between "df" and "Arduino"
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.




