Skip to content

3.1. Smart Greenhouse Controller

Description In this project, learners will build a Smart Greenhouse Controller that monitors environmental conditions and automatically responds to changes. The system uses a soil moisture sensor to monitor soil conditions, an LDR to measure light intensity, an LCD to display environmental data, and a buzzer to alert the user when plant conditions become unfavorable. This project introduces environmental automation and demonstrates how technology can improve agricultural productivity.
Use case This project demonstrates how multiple sensors can work together to monitor plant health. It reflects real-world applications such as smart farms, greenhouses, and automated agricultural facilities.

Components (Things You will need)

Arduino Uno Arduino USB Cable Bread Board Jumper Wires LCD Display Buzzer Soil Moisture Sensor LDR Sensor

Building the circuit

Things Needed:

  • Arduino Uno = 1
  • Arduino USB cable = 1
  • Jumper Wires
  • Breadboard
  • LDR Module
  • 12C LCD Display
  • Buzzer
  • Soil Moisture Sensor

Mounting the component on the breadboard and wiring the circuit

Step 1: Place the LDR Module and Soil Moisture Sensor on the breadboard. - Connect the Soil Moisture Sensor by connecting the VCC pin to the 5V pin on the Arduino Uno, the GND pin to GND, and the AO pin to Analog Pin A1.

  • Connect the LDR Module by connecting the positive (+) pin to Digital Pin 8 and the negative (–) pin to the GND pin on the Arduino Uno.

  • Connect the LCD Module by connecting the VCC pin to 5V, the GND pin to GND, the SDA pin to Analog Pin A4, and the SCL pin to Analog Pin A5.

  • Connect the buzzer by connecting its positive (+) pin to the specified digital pin on the Arduino Uno and its negative (–) pin to GND.

  • Ensure all components share a common 5V and GND connection, then verify all wiring before connecting the Arduino Uno to your computer using the USB cable.

Components on breadboard

Make sure to connect the Arduino USB cable to the Arduino board.

PROGRAMMING

Step 1: Open your Arduino IDE. See how to set up here: Getting Started.

Step 2: Write the complete program implementing the system logic with appropriate pin definitions, setup configuration, and the main control loop.


// Include LCD libraries
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Create LCD object
LiquidCrystal_I2C lcd(0x27,16,2);
// Sensor pins
int moisturePin = A0;
int lightPin = A1;
// Buzzer pin
int buzzerPin = 8;
void setup() {
 // Initialize LCD
 lcd.init();
 lcd.backlight();
 // Configure buzzer pin
 pinMode(buzzerPin, OUTPUT);
}
void loop() {
 // Read moisture sensor
 int moisture = analogRead(moisturePin);
 // Read light sensor
 int light = analogRead(lightPin);
 // Display moisture level
 lcd.setCursor(0,0);
 lcd.print("M:");
 lcd.print(moisture);
 // Display light level
 lcd.print(" L:");
 lcd.print(light);
 // Check plant conditions
 if(moisture < 300 || light < 250){
   // Alert user
   digitalWrite(buzzerPin,HIGH);
   lcd.setCursor(0,1);
   lcd.print("Check Plants! ");
 }
 else{
   digitalWrite(buzzerPin,LOW);
   lcd.setCursor(0,1);
   lcd.print("Conditions OK ");
 }
 delay(500);
}

Step 3: Save your code. See the Getting Started section

Step 4: Select the arduino board and port _See the Getting Started.

Step 5: Upload your code.

CONCLUSION

When the program is running, the system continuously monitors the soil moisture and light intensity. If either reading falls below the predefined threshold, the LCD displays a warning message and the buzzer sounds to alert the user to check the plants. When both readings are within the acceptable range, the LCD indicates that conditions are suitable, and the buzzer remains off. This demonstrates how the Smart Greenhouse Controller can automatically monitor environmental conditions and provide timely feedback to support healthy plant growth.