Rain water Sensor interfacing
with Arduino, Node MCU, ESP32 and OLED display
A rain sensor is one kind of low-cost electronic sensor which is used to detect the rainfall or water drops. It works as a switch. Normally the switch is open condition. This sensor consists of mainly two parts, one Sensing Pad and second Sensor Module.
When rainfall or water drops fall on the Sensing Pad surface, the switch will close. The Sensor Module reads data from the sensor pad and processes the data and converts it into a digital/analog output. So, the sensor can provide both types of output Digital output (DO) and Analog output (AO).
Sensing Pad Hardware Overview:
The Rain Sensor Module’s Sensing Pad consists of two nickel-coated series copper tracks. Also, it has two Header pins, these are internally connected to the two copper tracks of the Sensing Pad. These pins are used to connect the Sensing Pad to the rain sensor module circuit through two jumper wire. Always, one pin of the rain sensor circuit provides a +5v power supply to the one track of the sensing pad, and another pin is received the return power supply from another track of the sensing pad.
Normally under dry conditions, the sensing pad provides high resistance and low conductive. So, the 5v power supply cannot be passed from one track to another track. Its resistance varies according to the amount of water on the surface of the sensing pad. When water drops fall on the sensor pad surface its resistance will decrease and conductivity will increase. So, when water drops increase on the pad surface it can pass more power supply through one track to another track.
Sensor Module Hardware Overview:
The Sensor module consists of LM393 Comparator and Trimpot. Rain sensor module circuit has an onboard 10k potentiometer. It is used to set the sensitivity of the rain sensor, rotate the preset knob to adjust the sensitivity of the rain detection. If the preset knob rotated clockwise, the rain sensor sensitivity will be increased. If it rotated counterclockwise, the rain sensor sensitivity will be decreased.
When the rain sensor detects the rainfall or water drops, the RED LED is turn on. When it does not detect any rainfall or water drops, the RED LED is turn off.
How Rain Sensor Module Works
At first, we need to connect the Sensing Pad to the Sensor Module through the jumper wire. Now we can connect the rain sensor module’s Vcc & Gnd pin to 5v power supply. Then set the threshold voltage at the Non-Inverting input (3) of the IC in dry condition of the sensing pad by rotating the potentiometer knob to set the sensitivity of the sensor.
When water drops increase on the sensing pad surface then its conductivity will increase and also resistance will decrease. Then a Low amount of voltage from the sensing pad is given to the Inverting input (2) of the IC. Then the LM393 IC compares this voltage with the threshold voltage. In this condition, this input voltage is less than the threshold voltage, so the sensor output goes LOW (0).
When no water drops fall on the sensing pad surface then it has low conductivity and high resistance. Then the high amount of voltage will be allocated across the sensing pad. So, a High amount of voltage from the sensing pad is given to the Inverting input (2) of the IC.
Again the LM393 IC compares this voltage with the threshold voltage. In this condition, this input voltage is greater than the threshold voltage, so the sensor module output goes High (1).
This resistance can be measured and converted into voltage to feed as A nalog input to Arduino ADC (Analog to Digital Converter). The amplifier circuit also has a Schmitt trigger to produce square wave to connect to any digital pin of Micro-controller. Rain detection sensor module also has four pins VCC, GND, Analog output, and Digital output pins which can be connected to Micro-controller.
Rain water Sensor interfacing with Arduino:
VCC and GND of rain water sensor are connected to 5Volts DC and ground pin of Arduino.
Digital output pin of this board is connected to any Digital pin 7 of the Arduino. Output low indicates rain is detected, and high indicates no rain condition. When this goes Low then Arduino pin 3 and 4 can be pulled High. The Red LED is connected to Pin 3 of Arduino and Buzzer to Pin 4 of Arduino which go high and hence Red LED turns on and buzzer makes sound. Apart from the above Green LED is connected to Pin 2 of Arduino which lights up as soon as we power up Arduino which is power on LED.
Analog output of the board is connected to one of the Analog input pin of Arduino say A0 which gets connected to internal 10 bit ADC (Analog to Digital Converter) which gives out Digital output which can be displayed on suitable display board in our case LCD using I2C interface.
Rain water Sensor interfacing with Node MCU:
VCC and GND of rain water sensor are connected to 3.3Volts DC and ground pin of Node MCU. Digital output pin of this board is connected to any Digital pin GPIO7 of the Node MCU. Output low indicates rain is detected, and high indicates no rain condition. When this goes Low then Node MCU pin GPIO3 and GPIO4 can be pulled High. The Red LED is connected to Pin GPIO3 of Node MCU and Buzzer to Pin GPIO4 of Node MCU which go high and hence Red LED turns on and buzzer makes sound. Apart from the above Green LED is connected to Pin GPIO2 of Node MCU which lights up as soon as we power up Node MCU which is power on LED.
Analog output of the board is connected to one of the Analog input pin of Node MCU say ADC0 which gets connected to internal ADC (Analog to Digital Converter) which gives out Digital output which can be displayed on suitable display board in our case LCD using I2C interface.
Rain water Sensor interfacing with ESP32:
VCC and GND of rain water sensor are connected to 3.3Volts DC and ground pin of ESP32. Digital output pin of this board is connected to any Digital pin GPIO7 of the ESP32. Output low indicates rain is detected, and high indicates no rain condition. When this goes Low then ESP32 pin GPIO3 and GPIO4 can be pulled High. The Red LED is connected to Pin GPIO3 of ESP32 and Buzzer to Pin GPIO4 of ESP32 which go high and hence Red LED turns on and buzzer makes sound. Apart from the above Green LED is connected to Pin GPIO2 of Node MCU which lights up as soon as we power up ESP32 which is power on LED.
Analog output of the board is connected to one of the Analog input pin of ESP32 say ADC0 which gets connected to internal ADC (Analog to Digital Converter) which gives out Digital output which can be displayed on suitable display board in our case LCD using I2C interface.