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

Arduino UNO Based Water Level Indicator with Multicolor LED Alert and Buzzer

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based Water Level Indicator with Multicolor LED Alert and Buzzer

Circuit Documentation

Summary

This circuit is designed to monitor water levels using a water level sensor and provide visual indicators through LEDs and an audible alert using a buzzer. The Arduino UNO serves as the central processing unit, reading the sensor data and controlling the outputs based on predefined thresholds. The water level sensor's signal is read by the Arduino's analog input. Depending on the sensor value, different LEDs will light up, and the buzzer may sound an alert.

Component List

Arduino UNO

Water Level Sensor

LED: Two Pin (red)

LED: Two Pin (green)

LED: Two Pin (yellow)

Buzzer

Wiring Details

Arduino UNO

Water Level Sensor

LED: Two Pin (red)

LED: Two Pin (green)

LED: Two Pin (yellow)

Buzzer

Documented Code

const int analogInPin = A0;
int sensorValue = 0;

void setup() {
  // declare pin to be an output:
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  sensorValue = analogRead(analogInPin);
  Serial.print("sensor = ");
  Serial.print(sensorValue);
  Serial.print("\n");
  delay(2);
  if ((sensorValue >= 100) && (sensorValue <= 600)) {
    digitalWrite(2, HIGH);
    delay(100);
  }
  else if ((sensorValue >= 601) && (sensorValue <= 625)) {
    digitalWrite(3, HIGH);
    delay(100);
  }
  else if ((sensorValue >= 626) && (sensorValue <= 700)) {
    digitalWrite(4, HIGH);
    digitalWrite(5, HIGH);
  }
  else {
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
    delay(100);
  }
}

Filename: sketch.ino

This code continuously reads the analog value from the water level sensor and outputs to the serial monitor. Depending on the value read, it will turn on the green LED for values between 100 and 600, the yellow LED for values between 601 and 625, and both the red LED and the buzzer for values between 626 and 700. If the value is outside these ranges, all outputs are turned off.