Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino-Controlled Automatic Plant Watering System with Soil Moisture Sensing

Image of Arduino-Controlled Automatic Plant Watering System with Soil Moisture Sensing

Circuit Documentation

Summary of the Circuit

This circuit is designed to create an automatic plant watering system. It utilizes a soil moisture sensor to determine when the soil is dry and then activates a relay to turn on a water pump for irrigation. The system is powered by two 3.7V batteries connected in parallel, with a step-up boost power converter to increase the voltage to 5V required by the relay and the water pump. An Arduino UNO microcontroller is used to control the relay and monitor the moisture sensor.

Component List

5V Relay

  • Description: A relay is an electrically operated switch that allows you to control a high-power circuit with a low-power signal.
  • Pins: Normally Open, Common terminal, Normally Closed, In, GND, VCC

3.7V Battery

  • Description: A power source for the circuit.
  • Pins: +, -

Step Up Boost Power Converter, Adjustable Voltage Regulator

  • Description: This component steps up the voltage from the batteries to a higher voltage required by other components in the circuit.
  • Pins: VOUT+, VOUT-, VIN+, VIN-

Humidity Sensor (YL-69)

  • Description: A sensor that detects the moisture level in the soil.
  • Pins: A0, D0, GND, VCC

Arduino UNO

  • Description: A microcontroller board based on the ATmega328P used for controlling the components of the circuit.
  • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13

5V Mini Water Pump

  • Description: A pump used for watering the plant when the soil moisture level is below a certain threshold.
  • Pins: Positive pin, Negative pin

Wiring Details

5V Relay

  • Normally Open: Connected to the positive pin of the 5V mini water pump.
  • Common terminal: Connected to the A0 pin of the Humidity Sensor (YL-69).
  • Normally Closed: Not connected.
  • In: Controlled by the D5 pin of the Arduino UNO.
  • GND: Connected to the GND pin of the Arduino UNO.
  • VCC: Connected to the VOUT- of the Step Up Boost Power Converter.

3.7V Batteries

  • Both batteries are connected in parallel to increase the capacity while maintaining the same voltage.
  • Positive (+): One battery's positive is connected to the VIN+ of the Step Up Boost Power Converter, and the other battery's positive is connected to the VOUT- of the Step Up Boost Power Converter.
  • Negative (-): Both batteries are connected together.

Step Up Boost Power Converter, Adjustable Voltage Regulator

  • VOUT+: Connected to the VCC pin of the 5V relay and the positive pin of the 5V mini water pump.
  • VOUT-: Connected to the VCC pin of the 5V relay.
  • VIN+: Connected to the positive pin of one of the 3.7V batteries.
  • VIN-: Connected to the negative pin of the same battery.

Humidity Sensor (YL-69)

  • A0: Connected to the Common terminal of the 5V relay.
  • D0: Not connected.
  • GND: Connected to the GND pin of the Arduino UNO.
  • VCC: Connected to the VOUT- of the Step Up Boost Power Converter.

Arduino UNO

  • A0: Used to read the analog value from the Humidity Sensor (YL-69).
  • D1: Connected to the Normally Open pin of the 5V relay and the positive pin of the 5V mini water pump.
  • D5: Controls the In pin of the 5V relay.
  • GND: Common ground for the circuit.

5V Mini Water Pump

  • Positive pin: Connected to the Normally Open pin of the 5V relay and the D1 pin of the Arduino UNO.
  • Negative pin: Connected to the VOUT+ of the Step Up Boost Power Converter.

Documented Code

Arduino UNO Code

/*
 * Automatic Plant Watering System
 * This system uses a soil moisture sensor to monitor the moisture level of the soil.
 * When the soil is dry, the Arduino UNO activates a relay to turn on a water pump,
 * which irrigates the plant. The system includes a boost converter to step up the
 * voltage from the batteries to power the components.
 */

// Pin definitions
const int soilMoisturePin = A0; // Analog pin connected to soil moisture sensor
const int relayPin = 7;         // Digital pin connected to relay
const int pumpPin = 1;          // Digital pin connected to water pump

void setup() {
  // Initialize serial communication
  Serial.begin(9600);
  // Set pin modes
  pinMode(soilMoisturePin, INPUT);
  pinMode(relayPin, OUTPUT);
  pinMode(pumpPin, OUTPUT);
  // Initialize relay and pump to off
  digitalWrite(relayPin, LOW);
  digitalWrite(pumpPin, LOW);
}

void loop() {
  // Read the soil moisture level
  int soilMoistureValue = analogRead(soilMoisturePin);
  // Print the soil moisture value to the serial monitor
  Serial.print("Soil Moisture: ");
  Serial.println(soilMoistureValue);
  // Check if the soil is dry
  if (soilMoistureValue < 500) { // Threshold value for dry soil
    // Turn on the relay and pump
    digitalWrite(relayPin, HIGH);
    digitalWrite(pumpPin, HIGH);
  } else {
    // Turn off the relay and pump
    digitalWrite(relayPin, LOW);
    digitalWrite(pumpPin, LOW);
  }
  // Wait for an hour before the next reading
  delay(3600000); // 1 hour delay in milliseconds
}

This code is responsible for reading the moisture level from the soil moisture sensor and controlling the relay and water pump accordingly. The relay and pump are turned on when the soil is dry and turned off when the soil moisture is adequate.