Video Tutorial
........Loading...................
Description
Hai, friends, in this project we are going to make a security system which can be established anywhere in your home, office etc. this project contains a sensor and an alarm(beeper). the sensor can detect any object which it appears in front of the sensor. as result, the alarm turns on when an object gets detected.
Components Required
1. | Arduino UNO | * 1 |
2. | Beeper | * 1 |
3. | IR sensor | * 1 |
4. | Jumper Wires | |
5. | Bread Board | *1 |
Circuit Diagram
Beeper Red wire - pin 8, Beeper black wire - GND, OUT - A0, VCC - GND
Program
Complete your coding with the help of the Arduino ide. Upload program to your Arduino board makes sure that the Arduino port selection option is perfect. Avoid chance to get an error during uploading program to board
Click here to learn: "How to Upload your code to Arduino boards Without Error"
int sensor = 0;
void setup()
{
Serial.begin(9600);
pinMode(8,OUTPUT);
}
void loop()
{
sensor = analogRead(A0);
Serial.println(sensor);
delay(100);
if(sensor>200)
{
digitalWrite(8,HIGH);
}
if(sensor<200)
{
digitalWrite(8,LOW);
}
}