Security Alarm System Using Arduino

Introduction

In this Arduino project tutorial, we will learn to make a Security Alarm System Using Arduino Uno R3. This comes under IoT (Internet of Things). In this project, the buzzer will produce a sound whenever any object is placed in the range of the sensor. A security alarm system has many applications in various places like in hospitals, at home, in schools, etc.

For physical projects, the components can be purchased online or from any electronics center.

For online projects, the TinkerCad website can be used.

 

Supplies

In order to do this security alarm Arduino project, we will require the following components:

Components

  • Arduino Uno R3
  • Piezo(Buzzer)
  • PIR Sensor
  • 2 green wires
  • 2 black wires
  • 1 red wire

Circuit Diagram

Security Alarm System Arduino Project

Steps To Create A Security Alarm System Using Arduino

Step 1: Gather all the components on the Digital Board or Physical Table.

Piezo(Buzzer):

Step 2: Connect its positive and negative terminals to the 9 number pin and Grounding in the Digital side of the Arduino using Green and Black wire, respectively.

PIR Sensor:

Step 3: Connect the Signal Terminal of it to the Analog pin A2 using a Green wire.

Step 4: Connect the Ground terminal of it to GND in Arduino at the analog side using a Black coloured wire.

Step 5: Connect the Power terminal of it to the 5V pin of Arduino.

Source Code

int status = 0;
void setup()
{
pinMode(9, OUTPUT);
pinMode(A2, INPUT);
}
void loop()
{
status = digitalRead(A2);
if(status == HIGH)
{
digitalWrite(9, HIGH);
}
if(status == LOW)
{
digitalWrite(9, LOW);
}
delay(2000);
}

Explanation of the Code

To make the Security Alarm System Using Arduino, we need to input the above-written code.

1. In the beginning, we initialized an integer variable named “status” to 0.

2. In this source code, we have used two functions, namely, setup() and loop().

3. The setup function is used to declare that from pin 9, we are taking input, and from pin A2, we are producing the output.

4. In the loop function, we are reading the input using digitalRead and storing it in the status variable.

5. Now, if the input is High, meaning there will be some object in the range of the sensor, then we are writing the output as High using digitalWrite at pin 9 of the Arduino, which means the buzzer will get current to produce sound.

6. Similarly, if the input is low, meaning there is no object in the range of the sensor, the buzzer will not buzz.

7. At last, the delay will fix the time period till which the buzzer will produce sound. The time is in milliseconds.

Output

We will get the following output on the successful completion of the Security Alarm System Using Arduino project.

Security Alarm System Using Sensor

If the object is placed in the range of the sensor, the piezo will produce sound. Else, no sound will be produced.

 

More Arduino Projects>>>

You May Also Like To Create…

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *