Tech Gyan Set
Published © MIT

ESP32 Smart Plant Watering System (Automatic Irrigation)

An ESP32-based smart irrigation system that automatically waters plants when the soil becomes dry. πŸŒ±πŸ’§

BeginnerFull instructions provided8 hours1,246
ESP32 Smart Plant Watering System (Automatic Irrigation)

Things used in this project

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

🌱 ESP32 Smart Plant Watering System Complete ESP32 Code

C/C++
// -------------------------------
// Smart Plant Watering System
// Using ESP32 + Soil Moisture Sensor
// -------------------------------

// Pin Configuration
#define MOISTURE_SENSOR 34
#define RELAY_PIN 26

// Moisture Threshold
int drySoil = 2500;   // Adjust according to sensor

int moistureValue;

// -------------------------------
void setup()
{
  Serial.begin(115200);

  pinMode(RELAY_PIN, OUTPUT);

  // Pump OFF initially
  digitalWrite(RELAY_PIN, HIGH);

  Serial.println("Smart Plant Watering System Started");
}

// -------------------------------
void loop()
{

  // Read soil moisture
  moistureValue = analogRead(MOISTURE_SENSOR);

  Serial.print("Soil Moisture Value: ");
  Serial.println(moistureValue);

  // Check soil condition
  if(moistureValue > drySoil)
  {
    // Soil is dry β†’ Pump ON
    Serial.println("Soil Dry - Pump ON");

    digitalWrite(RELAY_PIN, LOW);
  }
  else
  {
    // Soil is wet β†’ Pump OFF
    Serial.println("Soil Wet - Pump OFF");

    digitalWrite(RELAY_PIN, HIGH);
  }

  delay(3000);
}

Credits

Tech Gyan Set
28 projects β€’ 12 followers
Tech Gyan Set | IoT & Embedded Systems Creator | Arduino, ESP32, GSM & NodeMCU Projects | Smart Home & Real-Life Automation Tutorials
Thanks to Tech Gyan Set .

Comments