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

Arduino UNO-Based Smart Irrigation System with OLED Display and Soil Moisture Sensor

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Smart Irrigation System with OLED Display and Soil Moisture Sensor

Circuit Documentation

Summary

This circuit is designed to monitor soil moisture levels and display the readings on a 0.96" OLED display. It also controls a water pump based on the moisture levels. The circuit uses an Arduino UNO as the main microcontroller, interfacing with a soil moisture sensor, an OLED display, a motor driver, and a water pump. The circuit is powered by multiple 9V batteries and includes switches for controlling the power and the water pump.

Component List

  1. 0.96" OLED Display

    • Pins: GND, VDD, SCK, SDA
    • Description: A small OLED display used to show the soil moisture levels.
    • Purpose: Display soil moisture readings.
  2. Water Pump

    • Pins: VCC, GND
    • Description: A small water pump used to water plants.
    • Purpose: Water plants based on soil moisture levels.
  3. 9V Battery

    • Pins: -, +
    • Description: A 9V battery used to power various components in the circuit.
    • Purpose: Provide power to the circuit.
  4. Rocker Switch

    • Pins: 1, 2
    • Description: A switch used to control the power to the Arduino UNO.
    • Purpose: Turn the Arduino UNO on and off.
  5. L298N DC Motor Driver

    • Pins: OUT1, OUT2, 12V, GND, 5V, OUT3, OUT4, 5V-ENA-JMP-I, 5V-ENA-JMP-O, +5V-J1, +5V-J2, ENA, IN1, IN2, IN3, IN4, ENB
    • Description: A motor driver used to control the water pump.
    • Purpose: Control the water pump based on signals from the Arduino UNO.
  6. Soil Moisture Module

    • Pins: positive, negative, Analog, Digital, Ground, VCC
    • Description: A sensor used to measure soil moisture levels.
    • Purpose: Provide soil moisture readings to the Arduino UNO.
  7. Toggle Switch

    • Pins: L1, COM, L2
    • Description: A switch used to control the water pump.
    • Purpose: Manually control the water pump.
  8. Arduino UNO

    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
    • Description: A microcontroller used to read sensor data and control the display and water pump.
    • Purpose: Main control unit of the circuit.

Wiring Details

0.96" OLED Display

Water Pump (Instance 1)

Water Pump (Instance 2)

9V Battery (Instance 1)

9V Battery (Instance 2)

9V Battery (Instance 3)

Rocker Switch (Instance 1)

Rocker Switch (Instance 2)

L298N DC Motor Driver

Soil Moisture Module

Toggle Switch

Code Documentation

Arduino UNO Code

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_RESET 4
#define sensor A1

Adafruit_SSD1306 display(OLED_RESET);

void setup()
{
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // change the address (0x3C) as per need
  display.clearDisplay();
}

void loop() 
{ 
  int value = analogRead(sensor);
  int percent = map(value, 1024, 0, 0, 100);
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.println("MOISTURE");
  display.print(percent);
  display.print("%");
  display.display();
  display.clearDisplay();
}

This code initializes the OLED display and reads the soil moisture level from the sensor connected to pin A1. The moisture level is then displayed on the OLED screen as a percentage. The display is updated continuously in the loop function.