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

Arduino UNO-Based Automated Plant Watering System with Soil Moisture Sensor and UV-C Tube

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Automated Plant Watering System with Soil Moisture Sensor and UV-C Tube

Circuit Documentation

Summary

This circuit is designed to automate the watering of plants based on soil moisture levels. It uses an Arduino UNO to read the soil moisture sensor and control a water pump via a relay. Additionally, a UV-C tube is included, which can be controlled by the Arduino.

Component List

  1. Arduino UNO

    • Description: A microcontroller board based on the ATmega328P.
    • 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
  2. Water Pump

    • Description: A small water pump used to water plants.
    • Pins: VCC, GND
  3. Soil Moisture Sensor

    • Description: A sensor to measure the moisture level in the soil.
    • Pins: VCC, GND, SIG
  4. 1-Channel Relay (5V 10A)

    • Description: A relay module to control high-power devices.
    • Pins: NC, signal, C, power, NO, ground
  5. UV-C Tube

    • Description: A UV-C light tube for sterilization purposes.
    • Pins: +, -
  6. 12v Battery

    • Description: A 12V battery to power the water pump.
    • Pins: -, +

Wiring Details

Arduino UNO

Water Pump

Soil Moisture Sensor

1-Channel Relay (5V 10A)

UV-C Tube

12v Battery

Code Documentation

Arduino Code

// Define pins
const int soilMoisturePin = A0;  // Analog pin for soil moisture sensor
const int ledPin = 13;            // Pin for LED
const int relayPin = 2;          // Pin for relay module

// Threshold for soil moisture (you may need to calibrate this)
int soilMoistureValue = 0;  // Variable to store the sensor reading
int threshold = 500;         // Change this value based on your soil's moisture level (adjust as needed)

void setup() {
  // Initialize the LED and relay pins
  pinMode(ledPin, OUTPUT);    
  pinMode(relayPin, OUTPUT);
  
  // Initialize Serial Monitor for debugging
  Serial.begin(9600);
}

void loop() {
  // Read the analog value from the soil moisture sensor
  soilMoistureValue = analogRead(soilMoisturePin);
  
  // Print the soil moisture value to the Serial Monitor (optional)
  Serial.print("Soil Moisture Value: ");
  Serial.println(soilMoistureValue);
  
  // If the soil is wet (moisture detected), turn on LED
  if (soilMoistureValue > threshold) {
    digitalWrite(ledPin, HIGH);   // Turn on the LED
    digitalWrite(relayPin, LOW);  // Turn off the water pump (relay OFF)
  }
  // If the soil is dry (moisture not detected), turn on water pump
  else {
    digitalWrite(ledPin, LOW);    // Turn off the LED
    digitalWrite(relayPin, HIGH); // Turn on the water pump (relay ON)
  }
  
  // Wait a moment before taking another reading
  delay(1000);  // 1 second delay (adjustable)
}

This code reads the soil moisture level and controls the water pump and UV-C tube based on the moisture level. The LED on pin 13 is used to indicate the status of the soil moisture. If the soil is dry, the water pump is turned on; otherwise, it is turned off.