Introduction:
In this project we are trying to implement a simple project using LASER with Arduino. The project idea revolves around creating a security system. Whenever any object will obstruct the LASER ray the alarm will start ringing.
Components Required:
- Arduino NANO
- LASER
- Buzzer
- LDR
- Resistors (1k)
- Bread Board
- Cable
- Jumper wires (M-M, M-F)
Working:
The project basically works on the principle of interruption. If by any means the LASER light is interrupted the alarm will start ringing. The laser is a concentrated light source that puts out a straight beam of light of a single color. The LDR is sensitive to light and puts out a voltage when the laser light hits it. When the laser beam is interrupted and can’t reach LDR, its voltage output changes, and eventually the alarm will ring.
Circuit Diagram:
In circuit LED is used just to demonstrate, practically in place of LED we need to use
Code:
int ldrpin = A0;
int buzzpin = 13;
void setup ()
{
Serial.begin(9600);
pinMode (ldrpin, INPUT);
pinMode (buzzpin, OUTPUT);
buzz(200);
delay(2000);
}
void loop ()
{
int ldrval = analogRead(ldrpin);
Serial.println(ldrval);
if (ldrval <= 900)
{
buzz(500);
}
}
void buzz(unsigned char time)
{
digitalWrite(buzzpin, 170);
delay (time);
digitalWrite(buzzpin, 0);
delay (time);
}
No comments:
Post a Comment