You are on page 1of 9

Experiment 1

Arduino Based Security Alarm System Using Tinker Cad


simulator

Internet of Things

Instructor: Dr. Behailu Getachew

Author Name: Hafiza


Partner Name: Jemal

Experiment Contacted on: March 11, 2024 G.C


Report Submitted on: March 15, 2024 G.c

School of Computing
Department of Software Engineering

Mekelle University
Mekelle, Tigray, Ethiopia
Table of Contents
Objective........................................................................................................................................... 3
Introduction.......................................................................................................................................3
Equipment Used................................................................................................................................3
Experiment procedure.......................................................................................................................5
Part 1............................................................................................................................................5
Part 2............................................................................................................................................7
Part 3............................................................................................................................................7
Data and Result.................................................................................................................................8
Discussion.........................................................................................................................................8
Conclusion and Recommendation.....................................................................................................8
figure 1 .............................................................................................................................................
figure 2..............................................................................................................................................
figure 3..............................................................................................................................................
figure 4..............................................................................................................................................
figure 5..............................................................................................................................................

2
1. Objective
The main aim of this experiment is to design a security system using tinkercad simulator
that senses a persons entry and give a sound to alert to the whom is concerned about.

2. Introduction

currently, security is a significant issue as number of crimes is increasing with the


increment of number of society. As a consequence, to overcome such societies problem, the
experiment “Security Alarm System”, that senses entry of a person to a restricted place and
give an alert is contacted. As a result, a safe and secured area is owned.

3. Equipments Used
The equipments used in this experiment are tinkercad materials.

• Arduino UNO R3
Arduino UNO is a microcontroller board primarily based at the atmega328p. It has 14
digital input/output pins of which 6 can be used as PWM outputs, 6 analog inputs, a
16MHz ceramic resonator, a USB connection, a power jack , an ICSP header, and a reset
button.

Figure 1. Arduino UNO

3
• Bread board
A breadboard is a rectangular plastic board with a bunch of tiny holes in it. These holes
let us easily insert electric components to prototype an electronic circuit, like a battery,
switch, resistor and an LED.

Figure 2. Bread board

• 4 LEDs (Light Emitting Diodes)


LED is a widely used standard source of light in electrical equipment. It has a wide range of
applications ranging from our mobile phone to large advertising billboards. They mostly find
applications in devices that show the time and display different types of data.

In this Experiment I try to use 4 LEDs which demonstrates how far or close we are from the
sensor.

Figure 3. Light Emitting Diodes

• 4 Resistors
A resistor is a passive electrical component that regulates the flow of electrical current in an
electronic circuit. In this experiment 4 resistors are used for the LEDS to prevent them from
burning out.

4
Figure 4. Resistor

• Ultrasonic Distance Sensor (HC-SR04)


The HC-SR04 uses non-contact ultrasound sonar to measure the distance to an object and
consists of two ultrasonic transmitters, a receiver, and a control circuit. The transmitters emit
a high frequency ultrasonic sound, which bounce off any nearby solid objects, and the
receiver listens for any return echo. That echo is then processed by the control circuit to
calculate the time difference between the signal being transmitted and received.

Figure 5. Ultrasonic Distance Sensor

4. EXPERIMENTAL METHOD AND PROCEDURE

PART 1: WORKING OF THE CIRCUIT

Step 1: connecting Arduino with breadboard


• Gnd pin of Arduino is connected to the negative Gnd pin of breadboard.
• The 5v or power of Arduino is connected to the power of breadboard.
Step 2: connecting LED with resistors and Arduino
Each LED is connected with one resistor. And all LEDS have connected with four resistors.
• The first LED is connected to pin number 4.

5
the first LED will glow if we are in the range of 10cm.
• The second LED connected to pin number 5.
the second LED will glow if we are in the range 10 and 20cm.
• The third LED is connected to pin number 6.
the third LED will glow if we are in the range 20 and 30cm
• The fourth LED is connected to pin number 7.
the fourth LED glow if we are in a distance greater than 30cm.
Step 3: connecting ultrasonic with breadboard
• The Groundpin of the Ultrasonic is connected to the negative pin of breadboard.
• The power pin of the ultrasonic is connected to the power pin of breadboard.
• The echo pin of the Ultrasonic is connected to the pin number 2 of the Arduino.
• The Trig pin of the ultrasonic is connected to the pin number 3 of the Arduino.
Step 4: connecting buzzer with breadboard
• The negative of the buzzer connected to the groundpin of breadboard.
• The positive of the piezo is connected to the pin number 7 of Arduino.

PART 2: CODING OF THE DESIGNED CIRCUIT


The designed circuit is written using C++ programming language
const int echopin = 2;
const int trigpin =3;
const int led1 = 4;
const int led2 = 5;
const int led3 = 6;
const int led4 = 7;
const int buzzer = 8;

Void setup()
{
pinmode(trigpin, output);
pinmode(led1, output);
pinmode(led2, output);
pinmode(led3, output);
pinmode(led4, output);
pinmode(buzzer, output);
pinmode(echopin, input);
}
void loop()
{
// activate the sensor
digitalwrite(trigpin, LOW);
delay microsecond(2);
digitalwrite(trigpin, HIGH);
delay microsecond(10);
digitalwrite(trigpin, LOW);

6
int duration = pulseIN(echopin, HIGH);
// convert from time to distance
int distance = duration * 0.0343/2;

if(distance <=10)
{
digitalwrite(led1, HIGH);
digitalwrite(led2 LOW);
digitalwrite(led3 LOW);
digitalwrite(led4 LOW);
tone(buzzer, 262);
}
else if (distance>10 && distance <=20)
{
digitalwrite(led2, HIGH);
digitalwrite(led1, LOW);
digitalwrite(led3,LOW);
digitalwrite(led4,LOW);
tone(buzzer,150);
}
else if(distance>25 && distance <=30)
{
digitalwrite(led3,HIGH);
digitalwrite(led1, LOW);
digitalwrite(led2, LOW);
digitalwrite(led4, LOW);
tone(buzzer, 120);
}
else
{
digitalwrite(led4,LOW);
digitalwrite(led1,LOW);
digitalwrite(led2,LOW);
digitalwrite(led3,LOW);
noTone(buzzer);
}

PART3: STARTING SIMULATION

5. Data and RESULT


After processing the code, the final result has been obtained. As a result the ultrasonic
sensor able to detect an objects movement and give a sound alert. Similarly, The LEDS give
alert by glowing . During the experimentation with different value of distance of the person
from the sensor, different LEDS was glowed and the tone frequency of the buzzer was
different.

7
• Taking sample distance values the following result was obtained.

Distance LED1 LED2 LED3 LED4 Tone frequency


data(cm) of buzzer
9cm HIGH LOW LOW LOW 265
15cm LOW HIGH LOW LOW 150
28cm LOW LOW HIGH LOW 120
32cm LOW LOW LOW LOW NO tone

6. DISCUSSION

The result shows that as the distance between the restricted area and the object is too close
both the tone frequency of the buzzer and the LED becomes high, as a result the authorized
person becomes informed about the event so fast. In the reverse if the distance increases the
tone frequency of the buzzer and the LED becomes LOW. Then the less the authorized person
is awared about the event.

7. QUESTION

Question1: what if for example a thief is trying to enter to my house and no one is in my house to be
alerted? At that instant how my house can be secured from thief or unauthorized person?
Question2: how the position of the entry person can be known?

8. CONCLUSION
In this experiment using ultrasonic sensor, arduino uno, buzzer, buzzer and breadboard a
security system is proposed and tested. As a result a successful outcome was gained. An
objects distance was measured and detected by ultrasonic distance measure and the buzzer
and the LEDs reacted according the input gained. This system is significant to enhance our
place secured.
9. RECOMMENDATION
This system can be more valuable for security if we enhance some concepts like adding
camera that can capture the object in entry to have a full information about that object and
take reaction according to.

8
9

You might also like