Water Level Indicator

Published: January 15, 2026

A water level indicator that lights up a series of LEDs based on how much water the sensor is submerged in β€” the more water, the more LEDs turn on.


πŸ“Έ Preview

Water Level Indicator Thumbnail

βš™οΈ How It Works:


πŸ“¦ Components Used:

ComponentPurpose
Arduino UNOMain controller
Water Level SensorDetects water depth
8 LEDsDisplay water level visually
8x 220Ξ© ResistorsLimit current for LEDs
Breadboard + jumper wiresConnections
Passive BuzzerFor tone alert when full

Disclaimer: Some Amazon links may be affiliate links. This means I may earn a small commission at no extra cost to you.


πŸ”Œ Wiring Instructions

🌊 Water Level Sensor

Sensor PinConnect To
VCC5V
GNDGND
A0A0 on Arduino

πŸ”Š Passive Buzzer

ComponentConnect to
Buzzer +D10
Buzzer –GND

πŸ’‘ LEDs (x8)

LED #ColorPinNote
1GreenD2Lowest water level
2GreenD3
3GreenD4
4YellowD5Mid-level
5YellowD6
6YellowD7
7RedD8Warning level
8RedD9Tank full

Each LED's anode (long leg) connects to Arduino via a 220Ξ© resistor. Each cathode (short leg) β†’ GND rail.


βœ… Code

Language: C++


const int sensorPin = A0;  // Water level sensor analog output

// LED pins from D2 to D9
const int ledPins[] = {2, 3, 4, 5, 6, 7, 8, 9};
const int numLEDs = 8;
const int buzzerPin = 10;

void setup() {
  pinMode(buzzerPin, OUTPUT);

  for (int i = 0; i < numLEDs; i++) {
    pinMode(ledPins[i], OUTPUT);
  }
  Serial.begin(9600); // For debugging water level
}

void loop() {
  int sensorValue = analogRead(sensorPin); // Read water level (0–1023)
  Serial.println(sensorValue);             // Optional: view sensor output

  // Map sensor value to number of LEDs (0–8)
  int level = map(sensorValue, 100, 350, 0, numLEDs);
  level = constrain(level, 0, numLEDs); // Keep within LED range

  // Light up LEDs based on water level
  for (int i = 0; i < numLEDs; i++) {
    digitalWrite(ledPins[i], i < level ? HIGH : LOW);
  }

  // Turn on buzzer if water level is too high
  if (level >= 8) { // Top 2 LEDs lit
    tone(buzzerPin, 1000);  // 1kHz beep
  } else {
    noTone(buzzerPin);
  }

  delay(100);
}

πŸš€ Uploading the Code

← Back to Projects