GadhaGod
Published © GPL3+

Fully Automatic Plant Watering System

Let your plants take care of themselves!

BeginnerFull instructions provided53,592
Fully Automatic Plant Watering System

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
capacitive soil moisture sensor
×1
5V DC Water Pump
×1
Relay Module (Generic)
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

automatic_plant_waterer_v2_av2X0UOI9J.png

Code

Arduino Plant Waterer

C/C++
// if the soil is dryer than this number, then start watering
const int dry = 270;

const int pumpPin = 12;
const int soilSensor = A4;

void setup() {
  pinMode(pumpPin, OUTPUT);
  pinMode(soilSensor, INPUT);
  Serial.begin(9600);
  digitalWrite(pumpPin, HIGH);
  delay(5000);
}

void loop() {
  // read current moisture
  int moisture = analogRead(soilSensor);
  Serial.println(moisture);
  delay(5000);
  
  if (moisture >= dry) {
    // the soil is too dry, water!
    Serial.println("Watering starts now..moisture is " + String(moisture));
    digitalWrite(pumpPin, LOW);

    // keep watering for 5 sec
    delay(5000);

    // turn off water
    digitalWrite(pumpPin, HIGH);
    Serial.println("Done watering.");
  } else {
    Serial.println("Moisture is adequate. No watering needed " + String(moisture));
  }
}

Credits

GadhaGod

GadhaGod

17 projects • 20 followers

Comments