Introduction
Modern agriculture requires precise control of environmental conditions to improve crop yield and quality. A Smart Greenhouse System uses IoT, sensors, and automation to monitor and control temperature, humidity, soil moisture, and light intensity automatically.
This system reduces human effort, saves water, and ensures optimal plant growth.
Objective of the Project
- To monitor greenhouse environmental parameters
- To automate irrigation and ventilation
- To improve crop yield and quality
- To reduce water and energy wastage
Working Principle
- Sensors measure temperature, humidity, soil moisture, and light
- Microcontroller analyzes sensor data
- Actuators (fan, pump, light) are controlled automatically
- Data is sent to cloud for remote monitoring
- Alerts are generated if conditions exceed limits
Components Required
- ESP32 / NodeMCU (ESP8266)
- DHT11 / DHT22 Sensor
- Soil Moisture Sensor
- LDR
- Relay Module
- Water Pump
- Fan
- LED Grow Light
- Power Supply
- IoT Platform (ThingSpeak / Blynk / Firebase)
Block Diagram
Temp/Humidity + Soil + Light Sensors
↓
ESP32 / NodeMCU
↓
Relay → Pump / Fan / Light
↓
Wi-Fi
↓
Cloud Platform
Circuit Connections (ESP32 Example)
DHT11 Sensor
DATA → GPIO4
VCC → 5V
GND → GND
Soil Moisture Sensor
AO → GPIO34
VCC → 5V
GND → GND
LDR
LDR → GPIO35 (Voltage Divider)
Relay Module
Pump Relay → GPIO25
Fan Relay → GPIO26
Light Relay→ GPIO27
IoT Arduino Code (Smart Greenhouse System)
#include <WiFi.h>
#include "ThingSpeak.h"
#include "DHT.h"
#define DHTPIN 4
#define DHTTYPE DHT11
#define soilPin 34
#define ldrPin 35
#define pumpRelay 25
#define fanRelay 26
#define lightRelay 27
DHT dht(DHTPIN, DHTTYPE);
WiFiClient client;
const char* ssid = "Your_WiFi";
const char* password = "Your_Password";
unsigned long channelID = 123456;
const char* writeAPIKey = "YOUR_API_KEY";
void setup() {
Serial.begin(9600);
dht.begin();
pinMode(pumpRelay, OUTPUT);
pinMode(fanRelay, OUTPUT);
pinMode(lightRelay, OUTPUT);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
ThingSpeak.begin(client);
}
void loop() {
float temp = dht.readTemperature();
float humidity = dht.readHumidity();
int soil = analogRead(soilPin);
int light = analogRead(ldrPin);
// Soil moisture control
if (soil > 2500) {
digitalWrite(pumpRelay, HIGH);
} else {
digitalWrite(pumpRelay, LOW);
}
// Temperature control
if (temp > 35) {
digitalWrite(fanRelay, HIGH);
} else {
digitalWrite(fanRelay, LOW);
}
// Light control
if (light < 1500) {
digitalWrite(lightRelay, HIGH);
} else {
digitalWrite(lightRelay, LOW);
}
ThingSpeak.setField(1, temp);
ThingSpeak.setField(2, humidity);
ThingSpeak.setField(3, soil);
ThingSpeak.setField(4, light);
ThingSpeak.writeFields(channelID, writeAPIKey);
delay(15000);
}
Code Explanation
- Sensors continuously monitor environment
- ESP32 controls pump, fan, and lights automatically
- Data is uploaded to cloud for monitoring
- System ensures optimal plant growth
Advantages
- Increases crop productivity
- Saves water and energy
- Reduces manual labor
- Remote monitoring
Applications
- Greenhouses
- Smart agriculture
- Nurseries
- Research farms
Future Enhancements
- AI-based crop health analysis
- Mobile app control
- Weather-based automation
- Solar-powered greenhouse
Conclusion
The Smart Greenhouse System is a powerful application of IoT in agriculture. By automating environmental control and enabling remote monitoring, it supports sustainable and efficient farming.
