Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

ESP8266-Based Smart Irrigation System with Soil Moisture and Environmental Monitoring

View and Edit Project In Cirkit DesignerImage of ESP8266-Based Smart Irrigation System with Soil Moisture and Environmental Monitoring

Circuit Documentation

Summary

This circuit is a crop monitoring system that utilizes various sensors to measure environmental parameters such as temperature, humidity, soil moisture, and air pressure. The system is controlled by an ESP8266 NodeMCU microcontroller, which processes the sensor data and controls a water pump via a relay module. The data is displayed on an I2C LCD screen.

Component List

  1. ESP8266 NodeMCU

    • Description: A microcontroller with built-in Wi-Fi capabilities.
    • Pins: D0, D1, D2, D3, D4, 3V3, GND, D5, D6, D7, D8, RX, TX, A0, RSV, SD3, SD2, SD1, CMD, SD0, CLK, EN, RST, VIN
  2. 7.4V Battery

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

    • Description: A DC-DC converter that steps down voltage from 7.4V to 5V.
    • Pins: IN+, IN-, OUT+, OUT-
  4. 5V Mini Water Pump

    • Description: A small water pump used for irrigation.
    • Pins: Positive pin, Negative pin
  5. 5V Relay

    • Description: A relay module used to control the water pump.
    • Pins: Normally Open, Common terminal, Normally Closed, In, GND, VCC
  6. 9V Battery

    • Description: An additional power source for the water pump.
    • Pins: -, +
  7. LDR Module 3 Pin

    • Description: A light-dependent resistor module.
    • Pins: VCC, GND, DO
  8. DHT11

    • Description: A temperature and humidity sensor.
    • Pins: VCC, GND, DATA
  9. ADS1115

    • Description: A 16-bit ADC for reading analog sensor data.
    • Pins: VDD, GND, SCL, SDA, ADDR, ALRT, A0, A1, A2, A3
  10. Soil Moisture Sensor

    • Description: A sensor to measure soil moisture levels.
    • Pins: VCC, GND, SIG
  11. BMP180

    • Description: A barometric pressure sensor.
    • Pins: 3.3, SDA, SCL, GND, VCC
  12. PIR Sensor

    • Description: A passive infrared sensor for motion detection.
    • Pins: VDD, SIG, GND
  13. MQ135

    • Description: A gas sensor for air quality monitoring.
    • Pins: VCC, GND, A0, D0
  14. I2C Module

    • Description: An I2C interface module for the LCD.
    • Pins: SCL, SDA, VCC, GND

Wiring Details

ESP8266 NodeMCU

7.4V Battery

Buck Converter

5V Mini Water Pump

5V Relay

9V Battery

LDR Module 3 Pin

DHT11

ADS1115

Soil Moisture Sensor

BMP180

PIR Sensor

MQ135

I2C Module

Code Documentation

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085.h> // Library for BMP180
#include <LiquidCrystal_I2C.h> // Library for I2C LCD
#include <DHT.h>              // Library for DHT11

// Pin definitions
#define DHTPIN D2          // Pin for DHT11 data
#define DHTTYPE DHT11      // DHT11 sensor type
#define RELAY_PIN D1       // Pin for relay module
#define MOISTURE_THRESHOLD 300 // Soil moisture threshold

// Initialize objects
DHT dht(DHTPIN, DHTTYPE);
Adafruit_BMP085 bmp; 
LiquidCrystal_I2C lcd(0x27, 16, 2); // Set LCD address and size

// Soil moisture sensor connected to ADS1115 A0
int soilMoisturePin =