Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino and ESP32 Powered Smart Plant Monitoring System with Wi-Fi Connectivity

View and Edit Project In Cirkit DesignerImage of Arduino and ESP32 Powered Smart Plant Monitoring System with Wi-Fi Connectivity

Circuit Documentation

Summary

This circuit is designed to monitor and control environmental parameters for applications such as smart plant systems. It includes sensors for measuring temperature, humidity, soil moisture, and motion detection. The system uses an Arduino UNO as the primary microcontroller for sensor data acquisition and control logic, interfacing with an LCD display for real-time data output. An ESP32 microcontroller is included for wireless communication capabilities, potentially to interface with IoT platforms like Blynk for remote monitoring. A battery case provides power to the system, ensuring portability and ease of deployment.

Component List

Arduino UNO

ESP32 (30 pin)

LCD Display 16x2

My battery case

KY-015 DHT11

Soil Moisture Sensor

PIR Sensor

LDR (Light Dependent Resistor)

Wiring Details

Arduino UNO

ESP32 (30 pin)

LCD Display 16x2

KY-015 DHT11

Soil Moisture Sensor

PIR Sensor

LDR

Documented Code

Arduino UNO Code

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>

#define DHTPIN 2      // Pin where DHT11 is connected
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);

#define soilMoisturePin A0
#define relayPin 8
#define pirPin 3

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  lcd.begin();
  lcd.backlight();
  
  pinMode(relayPin, OUTPUT);
  pinMode(pirPin, INPUT);
  
  dht.begin();
  lcd.setCursor(0, 0);
  lcd.print("Smart Plant");
  delay(2000);
}

void loop() {
  float temp = dht.readTemperature();
  float humidity = dht.readHumidity();
  int soilMoistureValue = analogRead(soilMoisturePin);
  int motionDetected = digitalRead(pirPin);

  // Display sensor data on LCD
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("T:"); lcd.print(temp); lcd.print("C");
  lcd.setCursor(0, 1);
  lcd.print("H:"); lcd.print(humidity); lcd.print("%");
  lcd.setCursor(8, 1);
  lcd.print("M:"); lcd.print(soilMoistureValue);

  // Control water pump based on soil moisture
  if (soilMoistureValue < 400) {   // Adjust threshold as needed
    digitalWrite(relayPin, LOW);  // Activate pump (LOW because relay is active LOW)
  } else {
    digitalWrite(relayPin, HIGH);  // Deactivate pump
  }

  delay(2000);  // Wait for 2 seconds before repeating
}

ESP32 Code

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "YourBlynkAuthToken";
char ssid[] = "YourWiFiSSID";
char pass[] = "YourWiFiPassword";

BlynkTimer timer;

void sendSensorData() {
  // Send sensor data to Blynk
  Blynk.virtualWrite(V1, dht.readTemperature());
  Blynk.virtualWrite(V2, dht.readHumidity());
  Blynk.virtualWrite(V3, analogRead(soilMoisturePin));
  Blynk.virtualWrite(V4, digitalRead(pirPin));
}

void setup() {
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);

  timer.setInterval(2000L, sendSensorData);
}

void loop() {
  Blynk.run();
  timer.run();
}

(Note: The ESP32 code references variables and functions such as dht.readTemperature() and analogRead(soilMoisturePin) which are not defined within the provided code snippet. These would typically be defined in the same manner as in the Arduino UNO code, or the ESP32 would need to be programmed to receive this data from the Arduino UNO via serial communication or another protocol.)