Rat Detector Using Laser and LDR with Arduino Uno
This is a simple and interesting Project "Rat Detector". This Project can also be implemented for detecting as well as counting anything like the number of People passes a given point or how many vehicles pass from a certain point of Road etc.
Component Required
- Arduino Uno
- LDR
- LASER
- Buzzer
- Jumper Wire
In this project, we are using LDR (Light Dependent Resistor) and LASER Light for detecting anything that passes between it.
Place LDR and Laser such that LASER Light directly Incident on LDR.
Whenever anything is detected then Buzzer is starting Beeping.
Arduino Code
int ldrPin = A0;
int buzzer = 3;
void setup()
{
Serial.begin(9600);
pinMode(ldrPin,INPUT);
pinMode(buzzer,OUTPUT);
}
void loop()
{
int ldrValue = analogRead(ldrPin);
//Serial.print("LDR Value:");
//Serial.println(ldrValue);
if (ldrValue > 1000)
{
Serial.println("Rat Detected");
digitalWrite(buzzer,HIGH);
}
else
{
digitalWrite(buzzer,LOW);
}
}
No comments: