Grove - Water Sensor

The Water Sensor module is part of the Grove system. It indicates whether the sensor is dry, damp or completely immersed in water by measuring conductivity. The sensor traces have a weak pull-up resistor of 1 MΩ. The resistor will pull the sensor trace value high until a drop of water shorts the sensor trace to the grounded trace. Believe it or not this circuit will work with the digital I/O pins of your Arduino or you can use it with the analog pins to detect the amount of water induced contact between the grounded and sensor traces.


  • Grove compatible interface
  • Low power consumption
  • 2.0cm x 2.0cm Grove module
  • High sensitivity


More details about Grove modules please refer to Grove System

Applications Ideas

  • Rainfall detecting
  • Liquid leakage
  • Tank overflow detector


This device is for educational and hobby applications only. It is not intended to be used in applications where its malfunction could result in damage to property or human safety.


Item Min Typical Max Unit
Working Voltage 4.75 5.0 5.25 V
Current <20 mA
Working Temperature 10 - 30
Working Humidity (without condensation) 10 - 90  %

Platforms Supported

Arduino Raspberry Pi BeagleBone Wio LinkIt ONE


The platforms mentioned above as supported is/are an indication of the module's hardware or theoritical compatibility. We only provide software library or code examples for Arduino platform in most cases. It is not possible to provide software library / demo code for all possible MCU platforms. Hence, users have to write their own software library.

Getting Started

With Arduino

Connect the module to the Basic board using any of the digital pin. You can gain the value of the signal pin. When there is water on the bare conducting wires, the value is LOW. Otherwise, it will be HIGH.

The following sketch demonstrates a simple application of using the Water sensor to control the buzzer. As the picture on the below indicates, the Water sensor is connected to digital port 8 of the Grove - Base Shield and the Buzzer is connected to digital port 12. When there is water on the bare conducting wires, the SIG pin output a LOW voltage. Then the Buzzer sounds. The hardware installation is as follows:

  • Then connect Arduino to PC by using a USB cable.
  • Copy and paste code below to a new Arduino sketch.
/*macro definition of water sensor and the buzzer*/
#define WATER_SENSOR 8
#define BUZZER 12

void setup()
void loop()

void pins_init()
    pinMode(BUZZER, OUTPUT);

/*Function: When the sensor is exposed to the water, the buzzer sounds  */
/*          for 2 seconds.                                              */
void soundAlarm()
    for(uint8_t i = 0;i < 20;i ++)
        digitalWrite(BUZZER, HIGH);
        digitalWrite(BUZZER, LOW);

/*Function: Determine whether the sensor is exposed to the water        */
/*Parameter:-void                                                       */
/*Return:   -boolean,if it is exposed to the water,it will return true. */
boolean isExposedToWater()
    if(digitalRead(WATER_SENSOR) == LOW)
    return true;
    else return false;
  • Upload the code.

  • The buzzer sounds when the sensor is damp or completely immersed in water. Have a try!

With Raspberry Pi

1.You should have a raspberry pi and a grovepi or grovepi+.

2.You should have completed configuring the development enviroment, otherwise follow here.


  • Plug the sensor to grovepi socket D2 by using a grove cable.

4.Navigate to the demos' directory:

cd yourpath/GrovePi/Software/Python/

  • To see the code
    nano grove_water_sensor.py   # "Ctrl+x" to exit #
    import time
    import grovepi
    # Connect the Grove Water Sensor to digital port D2
    water_sensor = 2
    while True:
            print grovepi.digitalRead(water_sensor)
        except IOError:
            print "Error"

5.Run the demo.

sudo python grove_water_sensor.py


Tech Support

Please do not hesitate to contact techsupport@seeed.cc if you have any technical issue. Or submit the issue into our forum.