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

Arduino-Controlled Solar-Powered Automated Watering System

View and Edit Project In Cirkit DesignerImage of Arduino-Controlled Solar-Powered Automated Watering System

Circuit Documentation

Summary

This circuit is designed to control a water pump based on soil moisture and rain detection. It uses an Arduino Mega 2560 to read data from a humidity sensor (YL-69) and a rain sensor, and then controls a 12V water pump through a single-channel relay. The system is powered by a 12V 7Ah battery, which is charged by a solar panel through a solar charge controller. A step-down buck converter is used to regulate the voltage to the Arduino Mega 2560.

Component List

12v 7ah Battery

Solar Charge Controller

Arduino Mega 2560

Step down Buck Converter

Solar Panel

12V Single Channel Relay

Water Pump

Rain Sensor

Humidity Sensor (YL-69)

Wiring Details

12v 7ah Battery

Solar Charge Controller

Arduino Mega 2560

Step down Buck Converter

Solar Panel

12V Single Channel Relay

Water Pump

Rain Sensor

Humidity Sensor (YL-69)

Documented Code

int moiSensorPin = A0;
int rainSensorPin = 2;
int pump = 13;

void setup() {
    Serial.begin(9600);
    pinMode(moiSensorPin, INPUT);
    pinMode(rainSensorPin, INPUT);
    pinMode(pump, OUTPUT);
}

void loop() {
    int moiSensorData = analogRead(moiSensorPin);
    Serial.print(moiSensorData);
    int rainData = digitalRead(rainSensorPin);
    Serial.print(rainData);
    
    if (moiSensorData > 950) {
        Serial.println("soil is dry");
        if (rainData < 400) {
            digitalWrite(pump, LOW);
        }
        digitalWrite(pump, HIGH);
    } else if (moiSensorData >= 400 && moiSensorData <= 950) {
        Serial.println("mois medium");
    } else if (moiSensorData < 400) {
        digitalWrite(pump, LOW);
        Serial.println("soil is wet, water pump off");
    }
}

This code snippet is responsible for reading the moisture level from the humidity sensor and the rain detection from the rain sensor. It then controls the water pump through the relay based on the soil moisture and rain conditions. The pump is turned on when the soil is dry and there is no rain detected. The serial prints are used for debugging purposes to monitor sensor readings.