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

Arduino Nano-Based Automated Soil Moisture Monitoring and Watering System

Image of Arduino Nano-Based Automated Soil Moisture Monitoring and Watering System

Automated Plant Watering System Documentation

Summary

This document describes an automated plant watering system designed to monitor soil moisture levels and automatically water plants when the soil becomes too dry. The system uses an Arduino Nano as the main controller, interfaced with a soil moisture sensor, a DHT11 temperature and humidity sensor, and a 5V relay module to control a water pump. The system is powered by a 9V battery and includes an ESP32 microcontroller for potential wireless communication capabilities.

Component List

Arduino Nano

  • Microcontroller board based on the ATmega328P
  • It has digital and analog I/O pins, and it is used as the main controller for the system.

Soil Moisture Sensor

  • Sensor that measures the volumetric content of water in the soil
  • It provides an analog output that correlates with the moisture level.

1 Channel 5V Relay Module

  • Electromechanical switch used to control the water pump
  • It allows the Arduino Nano to control high-power devices like the pump.

Water Pump

  • Electric pump used for watering the plants
  • It is activated by the relay module when the soil moisture level is below the threshold.

DHT11

  • Sensor for measuring temperature and humidity
  • It provides digital output data and is used to monitor environmental conditions.

9V Battery

  • Power source for the system
  • It provides the necessary voltage to power the Arduino Nano and other components.

ESP32 (30 pin)

  • Microcontroller with Wi-Fi and Bluetooth capabilities
  • It is included for potential wireless communication and remote monitoring.

Wiring Details

Arduino Nano

  • GND connected to the common ground net.
  • D2 connected to ESP32 TX0 for serial communication.
  • D3 connected to ESP32 RX0 for serial communication.
  • D6 connected to DHT11 DATA for temperature and humidity readings.
  • D7 connected to Relay Module IN for controlling the water pump.
  • 5V connected to Relay Module VCC+, Soil Moisture Sensor VCC, and DHT11 VCC for power.
  • A0 connected to Soil Moisture Sensor SIG for moisture level readings.
  • 3V3 connected to ESP32 Vin for power.

Soil Moisture Sensor

  • VCC connected to Arduino Nano 5V.
  • GND connected to the common ground net.
  • SIG connected to Arduino Nano A0.

1 Channel 5V Relay Module

  • VCC+ connected to Arduino Nano 5V.
  • VCC- (GND) connected to the common ground net.
  • IN connected to Arduino Nano D7.
  • N.O. connected to Water Pump VCC.
  • COM connected to 9V Battery +.

Water Pump

  • VCC connected to Relay Module N.O.
  • GND connected to 9V Battery -.

DHT11

  • DATA connected to Arduino Nano D6.
  • GND connected to the common ground net.
  • VCC connected to Arduino Nano 5V.

9V Battery

  • + connected to Relay Module COM.
  • - connected to Water Pump GND.

ESP32 (30 pin)

  • GND connected to the common ground net.
  • TX0 connected to Arduino Nano D2.
  • RX0 connected to Arduino Nano D3.
  • Vin connected to Arduino Nano 3V3.

Documented Code

Arduino Nano Code (sketch.ino)

#include <DHT.h>

#define DHTPIN 6           // DHT11 data pin connected to pin D6
#define DHTTYPE DHT11      // DHT11 sensor
#define RELAY_PIN 7        // Relay control pin
#define MOISTURE_SENSOR A0 // Soil moisture sensor analog pin

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  pinMode(RELAY_PIN, OUTPUT);
  pinMode(MOISTURE_SENSOR, INPUT);

  Serial.begin(9600);
  dht.begin();
}

void loop() {
  int moistureLevel = analogRead(MOISTURE_SENSOR);  // Read soil moisture level
  float humidity = dht.readHumidity();              // Read humidity
  float temperature = dht.readTemperature();        // Read temperature

  int threshold = 500;  // Moisture threshold

  // Print sensor data to Serial Monitor
  Serial.print("Soil Moisture Level: ");
  Serial.println(moistureLevel);
  Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.println("%");
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println("°C");

  // Check if soil is dry, activate water pump
  if (moistureLevel < threshold) {
    digitalWrite(RELAY_PIN, HIGH);  // Turn on water pump
    Serial.println("Watering the plants...");
  } else {
    digitalWrite(RELAY_PIN, LOW);   // Turn off water pump
    Serial.println("Soil moisture is sufficient.");
  }

  delay(2000);  // Wait before taking next reading
}

This code is responsible for reading the soil moisture level, temperature, and humidity, and controlling the water pump based on the soil moisture threshold. It also provides serial output for monitoring the sensor values.