Arduino projects: Rainfall detector

I usually put my laundry outside on the balcony and I built this Arduino rainfall detector to let me know when rain starts.

A nice project for beginners, Let’s see how you can built a simple rain detector using the rain sensor and a buzzer. The detector will start a beep to let you know the rain has started.

Arduino rainfall detector

Here is the list of the part needed for this project:

The rain sensor is just a PCB board with opens traces when a drop of water close the circuit on the board, a special circuitry gives a LOW signal to the digital output pin. It has an analog output pin as well which you can use to read analog values from the sensor.

With the potentiometer on board, you can control the threshold for digital outputs. A red LED signals that rain is detected, you can see it by touching the sensor with a hand (sometimes you have to squeeze it a little to see the light, because the skin resistance is quite big).

Here is the schematic. Note that it does not matter how you connect the the rain sensor driver (this blue PCB with a potentiometer) to the sensing board (the black one with silver traces).

The connected project looks somewhat like the picture below.

Now, we can upload a code. A short and simple code.

I will suggest you play with the code, try changing the time delay, add some melody instead of beeps or try to add an LED instead of a buzzer.

void setup() {
//on pin12 we have the rain sensor so this is an input
pinMode(12, INPUT);
//on pin 13 we have buzzer so this is an output
pinMode(13, OUTPUT);

void loop() {
//when rain sensor gives LOW signal it means that it rains
if(digitalRead(12) == LOW){
//for half a second we turn the buzzer on
digitalWrite(13, HIGH);
//for half a second we turn the buzzer off
digitalWrite(13, LOW);
//so we have the beep-beep signal like an alarm


To make it useful, you should put the sensing board outside the window and leave other parts inside the house to protect them from the rain.

Whenever there will be a rain, you will be notified by the buzzer.



Related Posts