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

Arduino UNO Controlled Water Level Indicator with Multicolor LED Feedback

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled Water Level Indicator with Multicolor LED Feedback

Circuit Documentation

Summary

The circuit in question is designed to monitor water levels using a sensor and indicate the level through a series of LEDs. An Arduino UNO microcontroller serves as the central processing unit, reading the sensor data and controlling the LEDs. The circuit includes three LEDs (red, green, and white), each with a corresponding resistor to limit current. The water level sensor provides an analog signal to the Arduino, which then lights up the appropriate LED based on the water level.

Component List

LEDs

Resistors

Microcontroller

Sensor

Wiring Details

LED (Red)

LED (Green)

LED (White)

Resistor (200 Ohms)

Arduino UNO

Water Level Sensor

Documented Code

// Code for Arduino UNO to monitor water level and control LEDs
int level;
const int analog_0 = 0;
int l1 = 13; // Red LED
int l2 = 12; // Green LED
int l3 = 11; // White LED
int l4 = 10; // Unused LED

void setup() {
  Serial.begin(9600);
  pinMode(l1, OUTPUT);
  pinMode(l2, OUTPUT);
  pinMode(l3, OUTPUT);
  pinMode(l4, OUTPUT);
  pinMode(8, OUTPUT); // Unused pin
}

void loop() {
  level = analogRead(analog_0); // Read the water level
  Serial.println(level); // Print the level to the serial monitor

  // Control LEDs based on water level
  if (level > 500 && level < 550) {
    digitalWrite(l1, HIGH); // Red LED on
    digitalWrite(l2, LOW);  // Green LED off
    digitalWrite(l3, LOW);  // White LED off
    digitalWrite(l4, LOW);  // Unused LED off
  } else if (level > 600 && level < 620) {
    digitalWrite(l1, LOW);  // Red LED off
    digitalWrite(l2, HIGH); // Green LED on
    digitalWrite(l3, LOW);  // White LED off
    digitalWrite(l4, LOW);  // Unused LED off
  } else if (level > 620 && level < 630) {
    digitalWrite(l1, LOW);  // Red LED off
    digitalWrite(l2, LOW);  // Green LED off
    digitalWrite(l3, HIGH); // White LED on
    digitalWrite(l4, LOW);  // Unused LED off
  } else if (level > 630 && level < 650) {
    digitalWrite(l1, LOW);  // Red LED off
    digitalWrite(l2, LOW);  // Green LED off
    digitalWrite(l3, LOW);  // White LED off
    digitalWrite(l4, HIGH); // Unused LED on
    digitalWrite(8, HIGH);  // Unused pin on
  }
}

This code is designed to read the water level from the sensor and light up the corresponding LED based on predefined level thresholds. The serial communication is initiated for debugging purposes, and the digital pins are configured as outputs to control the LEDs. The loop function continuously reads the sensor and updates the LED states accordingly.