A rain sensor, as the name implies, allows sensing or detecting if it’s raining. This can be particularly helpful for projects where you need to take action (or not take action) based on the presence or absence of rain. It could be as simple as turning on an LED when rain is detected.
Rain Sensor Components
The Rain Sensor has two main components:
- Sensor pad.
- Sensor circuit board.
The sensor pad is what will make contact with the rain in order to detect it, while the sensor circuit board will process the sensor pad’s signal and output it through the analog output pin. The circuit board will also generate a digital output which generates a HIGH or LOW depending on the potentiometer setting.

Rain Sensor Size
The sensor pad is approximately 2 inches x 1.5 inches (50mm x 38mm).

Sensor Pins
VCC – Connected to Arduino UNO 5V output.
GND – Connected to Arduino GND.
DO – Digital Output
AO – Analog Output
Connection pins from probe to sensor circuit board

Connection to Arduino
The sensor can be used through use of the analog output or the digital output. Both options shown further down.
Note that if the digital output option is used, you will need to adjust the sensitivity of the sensor through the potentiometer included in the sensor circuit board. All you have to do is take a small screwdriver and turn the potentiometer to adjust the sensitivity. This is best done while connected to Arduino IDE so you can see the change in results as the potentiometer is adjusted.

Arduino Code – Analog Output Option
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
//Arduino Code - Rain Sensor int Rain_signal = A0; //Define the Analog pin# on the Arduino for the rain sensor signal void setup() { Serial.begin(9600); // Start the serial communication } void loop() { int Rain = analogRead(Rain_signal); Serial.print("Rain Level: "); Serial.println(Rain); delay(200); } |
Arduino Code – Digital Output Option
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
//Arduino Code - Rain Sensor Digital int Rain__dig_signal = 4; //Define the Digital Input on the Arduino for the sensor signal int Sensor_State = 1; void setup() { pinMode(Rain__dig_signal, INPUT); //Step pin as input Serial.begin(9600); // Start the serial communication } void loop() { Serial.print("Raining status: "); Sensor_State = digitalRead(Rain__dig_signal); if (Sensor_State == 1) { Serial.println("Not raining"); } else { Serial.println("Raining"); } delay(200); } |
Run Arduino Code – Testing Rain Sensor
All you need to do now is run the code that was provided above, in either configuration, and open the Serial Monitor.

Components used in this example
*As an Amazon & Ebay Associate I earn from qualifying purchases.
Component | Link |
Arduino UNO | https://amzn.to/3uYVAMC https://ebay.us/veZdKX |
Rain Sensor | https://amzn.to/3e9uzQ3 https://ebay.us/SJqf5a |
Having read this I thought it was extremely enlightening. I appreciate you taking the time and effort to put this information together. I once again find myself personally spending way too much time both reading and posting comments. But so what, it was still worthwhile! Lee Gareth Jakoba
It agree, very useful idea
Hmm is anyone else having problems with the pictures on this blog loading?
I’m trying to figure out if its a problem on my end or if it’s the
blog. Any feed-back would be greatly appreciated.
Hi there, I log on to your new stuff on a regular basis. Your story-telling style is
witty, keep up the good work!
Good post. I’m facing some of these issues as well..