Arduino Mega with Water Level Sensor Module (Leak Sensor).



, ,


Water level sensor modules, commonly known as leak sensors, are essential for detecting water leaks and preventing potential damage. In this blog, we will explore how to use a Water Level Sensor Module with an Arduino Mega. We’ll cover its working principle, the components required, wiring, provide example code, and offer insights into integrating this module into your projects.


A Water Level Sensor Module utilizes a set of exposed conductive pads to detect the presence of water. When water bridges the gap between these pads, it completes an electrical circuit, allowing current to flow through the sensor. The Arduino Mega can monitor this current flow to determine if there is water present.

Components Required

To get started, gather the following components:

  1. Arduino Mega
  2. Water Level Sensor Module (Leak Sensor)
  3. Jumper Wires


Connect the Water Level Sensor Module to the Arduino Mega as follows:

  1. Connect the sensor’s VCC (Power) pin to the 5V pin on the Arduino Mega.
  2. Connect the sensor’s GND (Ground) pin to one of the GND pins on the Arduino Mega.
  3. Connect the sensor’s OUT (Signal) pin to digital pin 2 on the Arduino Mega.

Ensure that the wiring is secure and correctly connected.

Code Example

Here’s a basic Arduino code example to detect the presence of water using the Water Level Sensor Module:

int waterSensorPin = 2; // Water Level Sensor Module connected to digital pin 2

void setup() {

  pinMode(waterSensorPin, INPUT);



void loop() {

  int waterState = digitalRead(waterSensorPin);

  if (waterState == LOW) {

    Serial.println("Water detected! Leak detected!");

    // You can add actions to perform when a leak is detected here.


  delay(100); // Adjust the delay as needed for your application.



Water level sensor modules, also known as leak sensors, are invaluable for detecting water leaks and preventing damage to your home or equipment. By interfacing them with an Arduino Mega, you can create systems that respond to water presence with appropriate actions, such as alarms or notifications.


  1. Can I use this water level sensor for other liquids besides water?
  • These sensors are primarily designed for detecting water. While they may respond to other liquids to some extent, their accuracy might vary. It’s best to consult the sensor’s datasheet or specifications for details.
  1. Can I extend the sensor’s reach with longer wires?
  • Yes, you can use longer wires to extend the reach of the sensor. However, using longer wires may introduce resistance, affecting the sensor’s sensitivity. Be cautious when using extended wiring and test the sensor’s performance accordingly.

Troubleshooting Q&A

  1. The sensor is always reporting water presence. What could be the issue?
  • Check the wiring connections, ensuring that they are secure and correctly connected. Also, confirm that the sensor is not in direct contact with water when in its default state.
  1. The sensor is not detecting water when it should. What should I check?
  • Ensure that the sensor is placed in an area where it can come into contact with water if a leak occurs. Additionally, verify that the sensor is functional by testing it with known water sources.

Leave a Reply

Your email address will not be published. Required fields are marked *

Explore our other blogs.

  • 8-bit vs. 32-bit Microcontrollers in Today’s Projects

  • Nintendo Sues Creators of Popular Switch Emulator Yuzu, Citing Piracy Concerns

  • Raspberry Pi CPU Temperature Range – Everything You Need to Know

  • image of tunnel

    Reverse Tunneling with Raspberry Pi: A Comprehensive Guide