Skip to main content

How to use The Raindrops Detetion Sensor Module

The raindrops detection sensor module is a sensor that detects water drops with a voltage limit from 3.3V-5V. In this guide, we will be using the Raindrops Detection Sensor Module from our store.

Part

Wiring Guide

Step 1: First of all, connect the sensor module to the sensor

Step 2: Connect the sensor pins with the Arduino

SensorArduino
VCC5V
GNDGND
A0A0

Programming

Step 1: Define your pins and values

#define rainfall A0
int value;
int set = 10; //set value to compare to value

Step 2: Start the serial monitor and activate the pin

void setup(){
Serial.begin(9600);
pinMode(rainfall,INPUT);
}

Step 3: In loop(), read the value of the sensor and map it out for a new value to compare to set

value = analogRead(rainfall);
value = map(value,0,1023,225,0);

Step 4: Add a if/else statement to tell what the serial monitor should print when water is detected

if(value >= set){
Serial.println("rain detected");
}else{
Serial.println("no rain detected");
}
delay(200);

Full Code

#define rainfall A0
int value;
int set = 10;

void setup(){
Serial.begin(9600);
pinMode(rainfall,INPUT);
}

void loop(){
value = analogRead(rainfall);
value = map(value,0,1023,225,0);

if(value >= set){
Serial.println("rain detected");
}else{
Serial.println("no rain detected");
}

delay(200);
}

Output

Wiring

Serial Monitor