When I saw the rain drop sensor module, I wanted to say that this module did not know whether it could detect the amount of rain? Let's see the result after implementation?
The specifications of the rain sensor module are as follows:
The specifications of the rain sensor module are as follows:
- The sensor adopts FR-04 double-sided material, with a large area of 5.0*4.0 cm, and the surface is treated with nickel plating, which has the characteristics of anti-oxidation and good conductivity
- Working voltage 3.3V-5V
- Output form: digital switch output (0 and 1) and analog voltage output
- Use wide voltage LM393 comparator
[Material]
- Arduino Uno
- Rain drop sensor module
- LED x1
- 220 ohm resistor x1
- Buzzer x1
- Breadboard x1
- Wires x N
[Wiring diagram]
Arduino | Rain drop sensor | LED AND BUZZER |
---|---|---|
+5V | VCC | - |
GND | GND | - |
A0 | A0 | - |
D3 | D0 | - |
D5 | - | The positive pole of the red LED is connected to a 220 ohm resistor negatively, and the other end of the resistor is grounded. |
D4 | - | The buzzer is positive and the other end is grounded. |
[Code]
int led=5; int buzz=4; int get_D3 = 3; int get_A0 = A0; void setup(){ pinMode(led,OUTPUT); pinMode(buzz, OUTPUT); pinMode(get_D3, INPUT); Serial.begin(9600); } void loop(){ int value = analogRead(A0); //Read sensor data from A0 Serial.print(value); Serial.print(" "); if(digitalRead(get_D3) == LOW){ Serial.println("Digital value : wet"); digitalWrite(buzz,HIGH); } else{ Serial.println("Digital value : dry"); digitalWrite(buzz,LOW); } delay(1000); }
[Result]
I use water droplets to simulate rain, similar to a heavy rain. If the water droplets are relatively small, not every drop can trigger an alarm, sometimes a few more drops, the sensing value will become HIGH.[Reference]
Tags:
Arduino