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

Arduino UNO Water Level Sensor with LED Indicator

View and Edit Project In Cirkit DesignerImage of Arduino UNO Water Level Sensor with LED Indicator

Circuit Documentation

Summary

This circuit is designed to monitor water levels using a water sensor and an Arduino UNO. When the water level falls below a predefined threshold, an LED will blink to indicate the low water level. The circuit includes a water sensor, an LED, a resistor, and an Arduino UNO microcontroller.

Component List

LED: Two Pin (red)

Arduino UNO

Water Sensor

Resistor

Wiring Details

LED: Two Pin (red)

Arduino UNO

Water Sensor

Resistor

Code Documentation

#define POWER_PIN  7
#define METER_PIN  8
#define SIGNAL_PIN A5
#define LED_DELAY 250
#define WATER_LEVEL_MIN 30
int value = 0; // variable to store the sensor value

void setup() {
  Serial.begin(9600);
  pinMode(POWER_PIN, OUTPUT);   // configure D7 pin as an OUTPUT
  pinMode(METER_PIN, OUTPUT);
  digitalWrite(POWER_PIN, LOW); // turn the sensor OFF
}

void loop() {
  digitalWrite(POWER_PIN, HIGH);  // turn the sensor ON
  delay(10);                      // wait 10 milliseconds
  value = analogRead(SIGNAL_PIN); // read the analog value from sensor
  digitalWrite(POWER_PIN, LOW);   // turn the sensor OFF

  Serial.print("Sensor value: ");
  Serial.println(value);

  if (value < WATER_LEVEL_MIN) 
  {
    digitalWrite(METER_PIN, HIGH);
    delay(LED_DELAY);
    digitalWrite(METER_PIN, LOW);
    delay(LED_DELAY);
  }
  else {
    digitalWrite(METER_PIN, LOW);
  }

  delay(1000);
}

Code Explanation

Setup Function:

Loop Function: