Rain is one of the most important natural phenomena for us human beings. In the vast majority of times, for example, for those who live on agriculture, knowing that it rained or is raining is a great gift, unfortunately there are also cases in which it creates concerns, such as those who live in flooded or floods areas. Let's learn how to find this out with the Arduino.
Figure 1 - YL-83, LM393 and Arduino |
The sensor
The Rain Sensor (Detector) module consists of two parts.
The first is the YL-83, which is nothing more than a printed circuit board with two conductive lines, which although interlaced in the shape of an E, are not connected, thus it creates a field of "resistivity" for electrical conduction.
The second is a circuit (module) based on the LM393 chip, this chip consists of two independent, high precision voltage comparators, designed to work from a single power source, in our case, the Arduino, and it is who makes the magic, since, according to Ohms' Law, the voltage, even though it is very low, between the two resistive filaments falls linearly to the increase of their resistances. This circuit also has a trimpot (A small potentiometer) to adjust its sensitivity. This module can provide a digital and an analogic information and works with a voltage of 3.3V to 5V.
The circuit
To assemble the circuit, you need:
- 1x - Module YL-83
- 1x - LM393 module
- ~6x - Jumpers
- 1x - Arduino
Figure 2 - Assembled circuit |
The assembly of the circuit is intuitive. At the positive (+) and negative (-) terminals of the LM393 module, connect the terminals of the two conductive lines of the YL-83 module, regardless of the polarization. At the other end of the LM393 module, connect the VCC and GND terminals to the 5V and GND of the Arduino board, respectively. Finally, connect the analog terminal A0 to any of the analog pins on the Arduino, do the same with the digital terminal D0, but to any digital pin on the Arduino.
The code
It is important to highlight that there are two ways to read the results, through the digital port, and obtain the binary value, 0 or 1, and find out if it is raining or not. And in the analog way, which in the case of Arduino Uno, with an analog input resolution of 10 bits, can vary from a value between 0 and 1023, thus making it possible to "measure" the intensity of the rain.
YL-83 + LM393 (Rain Sensor) with Arduino
Reviewed by AJ Alves
on
quinta-feira, janeiro 10, 2013
Rating:
Nenhum comentário:
Postar um comentário