Interface Water Level Sensor with Arduino
Arduino

Water Level Sensor


Description

In this article, we will discuss the water level sensor, which is also known as a leak detection sensor. We will cover wiring diagrams, code examples, pinouts, and technical data. The sensor is connected to an analog input pin and provides an integer value between 0 and 500 to indicate the water level. When connected to a digital pin and a pull-up resistor, it can detect the presence of water but not its depth.


Sensor Details

The water level sensor/leak detection sensor is a 3-pin module that outputs an analog signal (generally 0 to 500) indicating the approximate water submersion depth.  When used in conjunction with a pull-up resistor, it can be used as a digital device to indicate the presence of water.

Tech Specs for the Water Level Sensor module: 

  •  Operating Voltage: +5V
  • Working Current: <20mA
  • Sensor Type: Analog or Digital
  • Water Detection Area :. 1.58in X .63in (40mm X 16mm)
  • Mounting Hole Size : .12in (3mm)
  • Operating Humidity: 10% to 90% (non-condensating)
  • Working Temperature: -22f to 122f (-30c to 50c)
  • Weight :. 3 grams
  • Product Dimensions : 2.56in X .79in (65mm x 20mm)

Wiring Details

To connect the Water Level Sensor to an Arduino, follow these steps:
- Connect the GND pin of the sensor to the GND pin of the Arduino.
- Connect the Signal pin of the sensor to PIN A5 on the Arduino.
- Connect the Vcc+ pin of the sensor to the 5V pin of the Arduino.


Circuit Image
Circuit Code
                                        
                                            

int resval = 0;  // holds the value
int respin = A5; // sensor pin used
 
void setup() {
 
// start the serial console
Serial.begin(9600);
}

void loop() {
 
resval = analogRead(respin); //Read data from analog pin and store it to resval variable
 
if (resval <= 100) {
Serial.println("Water Level: Empty");

}
else if (resval > 100 && resval <= 300) {
Serial.println("Water Level: Low");
}

else if (resval > 300 && resval <= 330) {
Serial.println("Water Level: Medium");
}
else if (resval > 330) {
Serial.println("Water Level: High");
}

delay(1000);
}