Rain Sensor Module (SN-RAIN-MOD)



The rain sensor module (Product code: SN-RAIN-MOD) is used to detect the amount of water present on the sensor and with a controller, it can further control output. The rain sensor module consist of two parts, that is the sensor probes and the module board. If you are interested with the specification of the sensor, you can download the getting started guide.
In this tutorial, I am going to show you how to make a simple rain alert system using the rain sensor module.

Hardware required

Software required

Working concept

The sensor board is exposed in open space where not roof blocking the rain. When the sensor detect water droplets on it, it will changes the analog voltage that is being read by the controller, in this case the Arduino. Arduino will further activate the buzzer to alert that there is rain. In addition, the sensor can be digital (present or absence of water droplets) or analog(how much water droplets on the sensor).


Basically, the connection is looks like this.

* Buzzer can connect directly to Arduino output pin.
* Remember that if you want to have PWM output (almost like analog output), the buzzer should connect only to either pin 3, 5, 6, 10, or 11.
* More water will result in lower analog voltage.


[sourcecode language=”cpp” wraplines=”true”]
int sensorpin=A0;   //setting the sensor pin
int outputpin=3;   //setting the output pin
int water;  //the variable to control
int loudness;

void setup(){
Serial.begin(9600);         //must begin to use serial monitor
pinMode(sensorpin,INPUT);    //setting sensor pin to be input
pinMode(outputpin,OUTPUT);   //setting output pin to be output

void loop(){
water=analogRead(sensorpin);  //read the value from sensor pin
Serial.println(water);  //show the value receive in serial monitor

loudness=((1023-water)/1023)*255;    //the range of sensor value is from 0-1023
//the range of Arduino output pin is from 0-255
//by this formula, more water, buzzer louder

Do check out the working concept of rain sensor:



Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

Gas Detector Using The MQ2 Sensor on Maker NANO
Control NeoPixel RGB LED Color Code Using Keypad and Maker Nano
Audio Doorbell Using M5GO IoT Starter Kit
Monitor Temperature Humidity via SMS Using M5Stack and SIM800L
Add text in STL file using Fusion360
Scroll to Top