Lesson 14 Rain Detection Module

Share for us
Share on facebook
Share on twitter
Share on pinterest
Share on whatsapp

Introduction

The rain detection module detects rain on the board. Place the rain detection board in the open air. When it is raining, the rain detection module will sense the raindrops and send signals to the Raspberry Pi.

Required Components

1 * Raspberry Pi

1 * Breadboard

– 1 * Rain Detection module

– 1 * PCF8591

– 1 * LM393

– 1 * 2-Pin ribbon cable

– 1 * 4-Pin anti-reverse cable

– Several Jumper wires

Experimental Principle

There are two metal wires that are close to each other but do not cross on the rain detection board. When rain drops on the board, the two metal wires will conduct, thus there is a voltage between the two metal wires. The schematic diagram:

Experimental Procedures

Step 1: Build the circuit.

Raspberry Pi GPIO Extension Board PCF8591 Module 
SDA SDA1SDA
SCLSCL1SCL
3.3V3V3VCC
GNDGNDGND
LM393GPIO Extension BoardPCF8591 Module
DOGPIO17 *
AO*AIN0
VCC3V3VCC
GNDGNDGND

Note: The two pins on the rain detection board are exactly the same. You can connect them to pin IN and GND on LM393.

For C Users:

Step 2: Change directory. 

    cd /home/pi/SunFounder_SensorKit_for_RPi2/C/14_rain_detector/

Step 3: Compile.

    gcc rain_detector.c -lwiringPi

Step 4: Run.

    sudo ./a.out

For Python Users:

Step 2: Change directory. 

    cd /home/pi/SunFounder_SensorKit_for_RPi2/Python/

Step 3: Run.

    sudo python3 14_rain_detector.py

Now drop some water onto the rain detection board until “raining” displayed on the screen. You can adjust the potentiometer on LM393 to detect the threshold of rainfall.