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

Arduino Nano-Based Automated Water Pump Controller with Humidity Monitoring and LCD Display

Image of Arduino Nano-Based Automated Water Pump Controller with Humidity Monitoring and LCD Display

Circuit Documentation

Summary

This circuit is designed to control a mini diaphragm water pump based on humidity levels detected by a DHT11 sensor and a YL-69 soil moisture sensor. The system uses an Arduino Nano as the central microcontroller to process sensor data, control a relay module that powers the water pump, and display readings on an LCD I2C display. The circuit is powered by a 18650 Li-Ion battery.

Component List

Arduino Nano

  • Microcontroller board based on the ATmega328P
  • Offers a variety of digital and analog I/O pins
  • Can be powered via USB or an external power source

Relay Module 1 Channel

  • An electrically operated switch that allows you to control a high power circuit with a low power signal
  • Typically used to control devices like motors, lights, etc.

DHT11

  • A basic, ultra low-cost digital temperature and humidity sensor
  • Provides digital signal output with calibrated humidity and temperature readings

LCD I2C Display

  • An alphanumeric liquid crystal display that uses the I2C communication protocol
  • Allows for displaying text on multiple lines

Humidity YL-69 Sensor

  • A soil moisture sensor that measures the volumetric content of water in the soil
  • Outputs an analog signal that can be read by the microcontroller

Mini Diaphragm Water Pump

  • A small electric pump used for moving water
  • Typically used in DIY projects for irrigation or water features

18650 Li-Ion Battery

  • A rechargeable battery commonly used in portable electronics
  • Provides a reliable power source for the circuit

Wiring Details

Arduino Nano

  • D2 connected to DHT11 signal pin
  • D3 connected to Relay module signal pin
  • A0 connected to Humidity YL-69 sensor analog output
  • A4 (SDA) connected to LCD I2C Display SDA pin
  • A5 (SCL) connected to LCD I2C Display SCL pin
  • 5V connected to 5V pins of Relay module, DHT11, LCD I2C Display, and Humidity YL-69 sensor
  • GND connected to ground pins of Relay module, DHT11, LCD I2C Display, and Humidity YL-69 sensor
  • VIN connected to the positive terminal of the 18650 Li-Ion battery

Relay Module 1 Channel

  • S (Signal) connected to Arduino Nano D3
  • 5V and GND connected to Arduino Nano 5V and GND respectively
  • COM (Common) connected to the negative terminal of the 18650 Li-Ion battery
  • NO (Normally Open) connected to the negative terminal of the Mini Diaphragm Water Pump

DHT11

  • S (Signal) connected to Arduino Nano D2
  • 5V and GND connected to Arduino Nano 5V and GND respectively

LCD I2C Display

  • SDA connected to Arduino Nano A4
  • SCL connected to Arduino Nano A5
  • VCC connected to Arduino Nano 5V
  • GND connected to Arduino Nano GND

Humidity YL-69 Sensor

  • A0 (Analog Output) connected to Arduino Nano A0
  • VCC connected to Arduino Nano 5V
  • GND connected to Arduino Nano GND

Mini Diaphragm Water Pump

  • Positive (+) connected to the positive terminal of the 18650 Li-Ion battery
  • Negative (-) connected to the NO pin of the Relay module

18650 Li-Ion Battery

  • Positive connected to Arduino Nano VIN and Mini Diaphragm Water Pump Positive (+)
  • Negative connected to the COM pin of the Relay module

Documented Code

/*
 * Arduino Sketch for controlling a water pump based on humidity levels
 * and displaying sensor data on an LCD.
 *
 * Components:
 * - Arduino Nano
 * - Relay module 1 channel
 * - DHT11 sensor
 * - LCD I2C Display
 * - Humidity YL-69 sensor
 * - Mini Diaphragm Water Pump
 * - 18650 Li-Ion battery
 */

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

// Pin definitions
#define DHTPIN 2
#define RELAY_PIN 3
#define HUMIDITY_SENSOR_PIN A0

// DHT sensor type
#define DHTTYPE DHT11

// Initialize DHT sensor
DHT dht(DHTPIN, DHTTYPE);

// Initialize LCD
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  // Start serial communication
  Serial.begin(9600);
  
  // Initialize DHT sensor
  dht.begin();
  
  // Initialize LCD
  lcd.init();
  lcd.backlight();
  
  // Set relay pin as output
  pinMode(RELAY_PIN, OUTPUT);
  
  // Set initial state of relay
  digitalWrite(RELAY_PIN, LOW);
}

void loop() {
  // Read humidity and temperature from DHT11
  float humidity = dht.readHumidity();
  float temperature = dht.readTemperature();
  
  // Read soil moisture level
  int soilMoisture = analogRead(HUMIDITY_SENSOR_PIN);
  
  // Display data on LCD
  lcd.setCursor(0, 0);
  lcd.print("Temp: ");
  lcd.print(temperature);
  lcd.print(" C");
  lcd.setCursor(0, 1);
  lcd.print("Humidity: ");
  lcd.print(humidity);
  lcd.print(" %");
  
  // Control relay based on soil moisture level
  if (soilMoisture < 500) { // Adjust threshold as needed
    digitalWrite(RELAY_PIN, HIGH); // Turn on pump
  } else {
    digitalWrite(RELAY_PIN, LOW); // Turn off pump
  }
  
  // Print data to serial monitor
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.print(" C, Humidity: ");
  Serial.print(humidity);
  Serial.print(" %, Soil Moisture: ");
  Serial.println(soilMoisture);
  
  // Wait before next loop
  delay(2000);
}

This code is responsible for reading temperature and humidity data from the DHT11 sensor, soil moisture from the YL-69 sensor, controlling the relay to power the water pump, and displaying the sensor data on the LCD. The relay is activated when the soil moisture level falls below a predefined threshold, indicating that the soil is dry and the plant requires watering.