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

Arduino-Controlled Soil Moisture Monitoring and Water Pump System with Solar Charging

View and Edit Project In Cirkit DesignerImage of Arduino-Controlled Soil Moisture Monitoring and Water Pump System with Solar Charging

Circuit Documentation

Summary

This circuit is designed to monitor soil moisture levels and automatically water plants when the moisture level falls below a certain threshold. The system uses an Arduino UNO as the main controller, which reads the moisture level from a SparkFun Soil Moisture Sensor and controls a 5V relay module to power a mini water pump. The relay module acts as an electronic switch to turn the pump on and off. The power for the circuit is provided by a series of solar panels connected to a SunnyBuddy-v13 charge controller, which charges a Polymer Lithium Ion Battery. The battery provides a stable power supply to the Arduino and the relay module.

Component List

Arduino UNO

1 Channel 5V Relay Module

SparkFun Soil Moisture Sensor

5V Mini Water Pump

Solar Panels

SunnyBuddy-v13

Polymer Lithium Ion Battery - Generic

Wiring Details

Arduino UNO

1 Channel 5V Relay Module

SparkFun Soil Moisture Sensor

5V Mini Water Pump

Solar Panels

SunnyBuddy-v13

Polymer Lithium Ion Battery - Generic

Documented Code

// sketch.ino
const int moistureSensorPin = A0; // Analog pin connected to the moisture sensor
const int relayPin = 7;           // Digital pin connected to the relay module
const int threshold = 400;        // Threshold value for soil moisture

void setup() {
  pinMode(relayPin, OUTPUT);      // Set the relay pin as an output
  digitalWrite(relayPin, HIGH);   // Initialize the relay to be OFF
  Serial.begin(9600);             // Start serial communication at 9600 baud
}

void loop() {
  int moistureLevel = analogRead(moistureSensorPin); // Read moisture level
  Serial.print("Moisture Level: ");
  Serial.println(moistureLevel);

  if (moistureLevel < threshold) {
    // If the moisture level is below the threshold, turn on the pump
    digitalWrite(relayPin, LOW);
    Serial.println("Pump ON");
  } else {
    // Otherwise, turn off the pump
    digitalWrite(relayPin, HIGH);
    Serial.println("Pump OFF");
  }

  delay(2000); // Wait for 2 seconds before reading again
}

This code is designed to run on the Arduino UNO. It reads the moisture level from the soil moisture sensor and turns on the water pump via the relay when the soil is too dry. The pump is turned off when the soil moisture is above the threshold. Serial communication is used for debugging purposes, allowing the user to monitor the moisture level readings.