

A water sensor is an electronic component designed to detect the presence of water or moisture in an environment. It is commonly used in applications such as leak detection, irrigation systems, flood monitoring, and water level measurement. The sensor typically outputs an analog or digital signal that can be processed by a microcontroller or other electronic systems to trigger alerts or automate actions.
Water sensors are valued for their simplicity, low cost, and versatility, making them a popular choice for both hobbyist and industrial projects.








| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power supply pin. Connect to 3.3V or 5V DC. |
| 2 | GND | Ground pin. Connect to the ground of the power supply. |
| 3 | DO (Digital Out) | Digital output pin. Outputs HIGH or LOW based on water detection. |
| 4 | AO (Analog Out) | Analog output pin. Outputs a voltage proportional to the water level detected. |
The following code demonstrates how to use a water sensor with an Arduino UNO to detect water and display the results in the Serial Monitor.
// Define pin connections
const int digitalPin = 2; // Digital output pin from the sensor
const int analogPin = A0; // Analog output pin from the sensor
void setup() {
pinMode(digitalPin, INPUT); // Set digital pin as input
Serial.begin(9600); // Initialize serial communication
}
void loop() {
// Read digital output
int digitalValue = digitalRead(digitalPin);
// Read analog output
int analogValue = analogRead(analogPin);
// Print the results to the Serial Monitor
Serial.print("Digital Output: ");
Serial.println(digitalValue); // HIGH or LOW based on water detection
Serial.print("Analog Output: ");
Serial.println(analogValue); // Proportional to water level
// Add a delay for readability
delay(500);
}
No Output Signal:
Unstable Readings:
Sensor Not Detecting Water:
Analog Output Always Zero:
Can the water sensor detect other liquids?
Yes, but the sensor is calibrated for water. Detection accuracy may vary with other liquids.
Is the sensor waterproof?
Only the detection area is designed to come into contact with water. The rest of the sensor should remain dry.
Can I use the sensor with a 3.3V microcontroller?
Yes, the sensor operates at both 3.3V and 5V.
What is the maximum water level the sensor can detect?
The detection area determines the maximum water level. For higher levels, consider using a float sensor or multiple water sensors.