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

Arduino UNO-Based Automated Water Level Control System with LED Indicator

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Automated Water Level Control System with LED Indicator

Circuit Documentation

Summary

This circuit is designed to monitor water levels using a water level sensor and control a water pump via a relay. Additionally, it includes a potentiometer for adjustable settings and an LED indicator. The circuit is controlled by an Arduino UNO microcontroller.

Component List

  1. Arduino UNO

    • Description: A microcontroller board based on the ATmega328P.
    • Pins: SDA, AREF, GND, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, A5, A4, A3, A2, A1, A0, Vin, 5V, 3.3V, RESET, IOREF, SCL
  2. Water Level Sensor

    • Description: A sensor to detect water levels.
    • Pins: SIG, VCC, GND
  3. Water Pump

    • Description: A pump to move water.
    • Pins: VCC, GND
  4. 1-Channel Relay (5V 10A)

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

    • Description: Provides power to the circuit.
    • Pins: +, -
  6. Potentiometer

    • Description: A variable resistor for adjustable settings.
    • Pins: GND, Output, VCC
  7. LED: Two Pin (red)

    • Description: A red LED for visual indication.
    • Pins: cathode, anode
  8. Resistor

    • Description: A resistor to limit current.
    • Pins: pin1, pin2
    • Properties: Resistance: 200 Ohms

Wiring Details

Arduino UNO

Water Level Sensor

Water Pump

1-Channel Relay (5V 10A)

Power Supply

Potentiometer

LED: Two Pin (red)

Resistor

Code Documentation

// Pin definitions
const int potPin = A0;          // Potentiometer connected to analog pin A0
const int waterLevelPin = 2;    // Water level sensor connected to digital pin D2
const int relayPin = 3;         // Relay module connected to digital pin D3
const int ledPin = 4;           // LED connected to digital pin D4

void setup() {
    // Initialize serial communication for debugging
    Serial.begin(9600);
    
    // Set pin modes
    pinMode(waterLevelPin, INPUT);
    pinMode(relayPin, OUTPUT);
    pinMode(ledPin, OUTPUT);
    
    // Initial state of relay and LED
    digitalWrite(relayPin, LOW); // Ensure the relay is off initially
    digitalWrite(ledPin, LOW);   // Ensure the LED is off initially
}

void loop() {
    // Read the potentiometer value
    int potValue = analogRead(potPin);
    
    // Read the water level sensor value
    int waterLevel = digitalRead(waterLevelPin);
    
    // Print the sensor values to the serial monitor
    Serial.print("Potentiometer Value: ");
    Serial.println(potValue);
    Serial.print("Water Level: ");
    Serial.println(waterLevel);
    
    // Control the relay and LED based on the water level sensor
    if (waterLevel == HIGH) {
        digitalWrite(relayPin, HIGH);  // Turn on the relay (activate the water pump)
        digitalWrite(ledPin, HIGH);    // Turn on the LED
    } else {
        digitalWrite(relayPin, LOW);   // Turn off the relay (deactivate the water pump)
        digitalWrite(ledPin, LOW);     // Turn off the LED
    }
    
    // Wait for 1 second before repeating the loop
    delay(1000);
}

This code initializes the pins for the potentiometer, water level sensor, relay, and LED. It reads the values from the potentiometer and water level sensor, prints them to the serial monitor, and controls the relay and LED based on the water level sensor's readings.