Professional Documents
Culture Documents
TASK – 5
COMPONENTS REQUIRED:
PROCEDURE:
1) Construct the circuit with all the components required (Arduino, PIR Sensor,
Piezo buzzer, Connection Wires, Resistors and LED.
2) The PIR sensor is connected to the Pin 8 of the Arduino and led to the pin 7
and Piezo to the pin 3 of the Arduino
3) Coding is done in such a way that if the person is in the detectable range of the
PIR sensor then the buzzer will ring otherwise the buzzer will not ring.
CODE:
// 19BEC0273_Task5
//
int Sensorvalue = 0;
void setup()
{
pinMode(8, INPUT);
Serial.begin(9600);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
}
void loop()
{
Sensorvalue = digitalRead(8);
Serial.println(Sensorvalue);
if (Sensorvalue == 1) {
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
} else {
digitalWrite(10, LOW);
digitalWrite(9, LOW);
}
delay(1000); // Delay a little bit to improve simulation performance
}
OUTPUT SCREENSHOTS:
I) Output when person is in the range of PIR sensor then the led glows and
the buzzer rings.
II) Output when the person is not in the range of PIR sensor then the led will
not glow and the buzzer will not ring.
CONCLUSION:
Hence with the help of Arduino, PIR sensor and piezo buzzer we have
successfully constructed a security alarm system or theft alert system.