0% found this document useful (0 votes)
34 views22 pages

Minor Project

This document summarizes a student's Internet of Things minor project on creating a burglar alarm using a PIR sensor. The project involves: 1. Using a PIR sensor to detect motion and ring a buzzer if motion is detected. 2. Interfacing a PIR sensor with an Arduino to blink an LED and beep a buzzer when movement is detected. 3. Automatically switching on a light bulb using a photo resistor to detect low light intensity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views22 pages

Minor Project

This document summarizes a student's Internet of Things minor project on creating a burglar alarm using a PIR sensor. The project involves: 1. Using a PIR sensor to detect motion and ring a buzzer if motion is detected. 2. Interfacing a PIR sensor with an Arduino to blink an LED and beep a buzzer when movement is detected. 3. Automatically switching on a light bulb using a photo resistor to detect low light intensity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

INTERNET OF THINGS MINOR PROJECT

Name : Grandhi Sri Vyshnavi

Year : 2nd year

Branch : Electrical and Electronics Engineering

College name : University College of Engineering Kakinada (JNTUK)

Trainer name : Swathi Chitta

Institute name : Acmegrade


1.Create a burglar alarm-
detect motion of a person
(using a PIR sensor). If there is
motion, ring the buzzer.
ABSTRACT:
The paper presents the design, construction and
testing of a simple sound activated burglar alarm. The principle of
operation of this burglar alarm is very simple. When the intensity of
the sound exceeds certain intensity, the alarm is triggered and the
siren begins to operate. The speaker beeps and flasher (light) flashes.
These actions thus alert the owner of the residence and security
personnel of the presence of an intruder. Burglar alarm systems are
increasingly being used in private homes, offices, stores and others
businesses. They have become standard equipment especially in
stores, warehouses etc. The system is also suitable for use in jewelry
stores, artifacts in museums and for safe guarding drawings, paintings
and sculpture in art galleries and also to detect unauthorised access.
PIR SENSOR

Detecting motions or movements has always been important in most projects. With the help
of the PIR Sensor it has become very easy to detect human/animal movements. In this project
we will learn how we can interface a PIR Sensor with a microcontroller like Arduino. We
will interface an Arduino with PIR module and blink a LED and beep a Buzzer whenever a
movement is detected. The following components will be needed to build this project.

Components:

1. PIR Sensor Module


2. Arduino UNO (any version)
3. LED
4. Buzzer
5. Breadboard
6. Connecting Wires
7. 330 ohm resistor

PIR sensor:
The PIR sensor stands for Passive Infrared sensor. It is a low cost sensor which can detect the
presence of Human beings or animals. There are two important materials present in the
sensor one is the pyroelectric crystal which can detect the heat signatures from a living
organism (humans/animals) and the other is a Fresnel lenses which can widen the range of
the sensor. Also the PIR sensor modules provide us some options to adjust the working of the
sensor as shown in below image.

The two potentiometers (orange color) are used to control the sensitivity and trigger on time
of the sensor. Basically the Dout pin of the sensor is present in between the Vcc and Gnd pins.
The module works on 3.3V but can be powered with 5V as well. On the top left corner it also
has a trigger pin setup which can be used to make the module work in two different modes.
One is the “H” mode and the other is the “I” mode.

In “H” mode the output pin Dout will go high (3.3V) when a person is detected within range
and goes low after a particular time (time is set by potentiometer). In this mode the output
pin will go high irrespective of whether the person is still present inside the range or has left
the area. We are using our module in “H” mode in our project.
In “I” mode the output pin Dout will go high (3.3V) when a person is detected within range
and will stay high as long as he/she stays within the limit of the Sensors range. Once the
person has left the area the pin will go low after the particular time which can be set using
the potentiometer.

Note: The position of potentiometers or pins may vary based on your PIR sensor vendor.
Follow the Silk screen to determine you pinouts

Circuit Diagram and Explanation:


The circuit Diagram for arduino motion detector project by interfacing Arduino with PIR
module and blinking an LED/Buzzer is shown in the below image.

We have powered the PIR sensor using he 5V Rail of the Arduino. The output pin of the PIR
Sensor is connected to the 2nd digital pin of Arduino. This pin will be the INPUT pin for Arduino.
Then the 3rd pin of Arduino is connected to the LED and Buzzer. This pin will act as the output
pin of the Arduino. We will program the Arduino to trigger an Output on 3 rd pin if an Input
has been detected at 2nd pin. The complete Program is explained below.

Programming the Arduino:


The program for Arduino is pretty simple and straight forward. To connect Arduino PIR
Sensor, we have to assign the pin number 2 as input and pin number 3 as output. Then we
have to produce a discontinuous trigger whenever the pin 2 goes high. Each line is explained
below.

In the void setup function shown below, we have to declare that the pin 2 connected to PIR
output will be used as input and the pin 3 connected to LED/Buzzer will be used as input.

void setup() {

pinMode(2, INPUT); //Pin 2 as INPUT

pinMode(3, OUTPUT); //PIN 3 as OUTPUT

Then we proceed to the loop() function. As we know the code in here gets executed as long
as the MCU is powered on. So we always check if the Pin 2 has gone high by using the below
line inside the loop() function.

if (digitalRead(2) == HIGH)

If we find that the particular pin has gone high, it means that the PIR module has be triggered.
So, now we has make our output pin (pin 3) to go high. We turn this pin on and off with a
delay of 100 milli second so that we can attain the flashing or buzzing output. The code to do
the same is shown below.

void setup() {

pinMode(2, INPUT); //Pin 2 as INPUT

pinMode(3, OUTPUT); //PIN 3 as OUTPUT


}

void loop() {

if (digitalRead(2) == HIGH) // check if PIR is triggered.

digitalWrite(3, HIGH); // turn the LED/Buzz ON

delay(100); // wait for 100 msecond

digitalWrite(3, LOW); // turn the LED/Buzz OFF

delay(100); // wait for 100 msecond

}
CONCLUSION:
Burglary is the most common cause of properties losses.
Different types of detectors are used, which are far more effective
than human senses, to detect the unwanted changes in the property
areas. Computer control intruder detection and alarm systemic
designed to detect intruder using different types of intruder detection
sensors, which connected to a PC using specific interface circuitry.
REFERENCES:
5. Automatic switching on the light
bulb-read the ambient light intensity
(using a photo resistor).If intensity is
low then switch on the bulb.
ABSTRACT:
In this project, I will show you how to build a simple
Light activated Switch Circuit using photo resistor. Using this circuit,
an electrical device or an appliance like a light bulb or a fan for
example, can be controlled based on the intensity of the light near
the circuit. The Main principle of this circuit is based in the working
of the LDR sensor i.e. the light Dependent Resistor and to switch ON
or OFF the light based on the intensity of the illumination the LDR is
subjected to. Speaking of the light dependent resistor, it will have a
high resistance in darkness and low resistance in the presence of
light.Thes sensors are also used in all types of light sources like
natural sunlight, incandescent lamps, and flfluorescent. This sensor is
also be used in indoor as well as outdoor lightings for turning on/off
which include street lighting, electronic signals as well as signs.
Light Sensor (Photoresistor) With Arduino in
Tinkercad
A light-sensitive type of variable resistor, using Arduino's Analog Input. It's also called an
LDR (light-dependent resistor).
So far you've already learned to control LEDs with Arduino's analog output, and to read a
potentiometer, which is another type of variable resistor, so we'll build on those skills in this
lesson. Remember that Arduino's analog inputs (pins marked A0-A6) can detect a gradually
changing electrical signal, and translates that signal into a number between 0 and 1023.
Components:
1. LED
2. Resistor
3. Bread Board
4. Aurdino
5. Photoresistor
6. Connecting wires

Explore the sample circuit embedded here in the workplane by clicking Start Simulation and
clicking on the photoresistor (brown oval with squiggly line down the middle), then drag the
brightness slider to adjust the simulated light input.

In this lesson, you'll build this simulated circuit yourself along side the sample. To optionally
build the physical circuit, gather up your Arduino Uno board, USB cable, solderless
breadboard, an LED, resistors (220 ohm and 4.7k ohm), photoresistor, and breadboard
wires. Take a look at the breadboard circuit pictured. It can be useful to look at a free-wired
version of this sample circuit for comparison, pictured. In this step, you will build your own
version of this circuit along side the sample in the workplane.

To follow along, load up a new Tinkercad Circuits window and build your own version of this
circuit along side the sample.
Identify the photoresistor, LED, resistors, and wires connected to the Arduino in the
Tinkercad Circuits workplane.

Drag an Arduino Uno and breadboard from the components panel to the workplane, next to
the existing circuit.

Connect breadboard power (+) and ground (-) rails to Arduino 5V and ground (GND),
respectively, by clicking to create wires.

Extend power and ground rails to their respective buses on the opposite edge of the
breadboard (optional for this circuit but good common practice).

Plug the LED into two different breadboard rows so that the cathode (negative, shorter leg)
connects to one leg of a resistor (anywhere from 100-1K ohms is fine). The resistor can go in
either orientation because resistors aren't polarized, unlike LEDs, which must be connected
in a certain way to function.

Connect other resistor leg to ground.

Wire up the LED anode (positive, longer leg) to Arduino pin 9.

Drag a photoresistor from the components panel to your breadboard, so its legs plug into
two different rows.

Click to create a wire connecting one photoresistor leg to power.

Connect the the other leg to Arduino analog pin A0.

Drag a resistor from the components panel to connect the photoresistor leg connected to
A0 with ground, and adjust its value to 4.7k ohms.

You can follow along virtually using Tinkercad Circuits. You can even view this lesson from
within Tinkercad (free login required)! Explore the sample circuit and build your own right
next to it. Tinkercad Circuits is a free browser-based program that lets you build and
simulate circuits. It's perfect for learning, teaching, and prototyping.

Step 1: Build the Circuit


Take a look at the breadboard circuit pictured. It can be useful to look at a free-wired
version of this sample circuit for comparison, pictured. In this step, you will build your own
version of this circuit along side the sample in the workplane.

To follow along, load up a new Tinkercad Circuits window and build your own version of this
circuit along side the sample.

Identify the photoresistor, LED, resistors, and wires connected to the Arduino in the
Tinkercad Circuits workplane.

Drag an Arduino Uno and breadboard from the components panel to the workplane, next to
the existing circuit.

Connect breadboard power (+) and ground (-) rails to Arduino 5V and ground (GND),
respectively, by clicking to create wires.

Extend power and ground rails to their respective buses on the opposite edge of the
breadboard (optional for this circuit but good common practice).

Plug the LED into two different breadboard rows so that the cathode (negative, shorter leg)
connects to one leg of a resistor (anywhere from 100-1K ohms is fine). The resistor can go in
either orientation because resistors aren't polarized, unlike LEDs, which must be connected
in a certain way to function.

Connect other resistor leg to ground.

Wire up the LED anode (positive, longer leg) to Arduino pin 9.

Drag a photoresistor from the components panel to your breadboard, so its legs plug into
two different rows.

Click to create a wire connecting one photoresistor leg to power.

Connect the the other leg to Arduino analog pin A0.


Drag a resistor from the components panel to connect the photoresistor leg connected to
A0 with ground, and adjust its value to 4.7k ohms.

Step 2: Code With Blocks

Let's use the code blocks editor to listen to the state of the photoresistor, then set an LED to
a relative brightness based on how much light the sensor sees. You may wish to refresh your
memory of LED analog output in the Fading LED lesson.

Click the "Code" button to open the code editor. The grey Notation blocks are comments for
making note of what you intend for your code to do, but this text isn't executed as part of
the program.

Click on the Variables category in the code editor.

To store the resistance value of the photoresistor, create a variable named "sensorValue".

Drag out a "set" block. We'll store the state of our photoresistor in the
variable sensorValue .

Click on the Input category and drag out an "analog read pin" block, and place it into the
"set" block after the word "to"
Since our potentiometer is connected to the Arduino on pin A0, change the dropdown to
A0.

Click the Output category and drag out a "print to serial monitor" block.

Navigate to the Variables category and drag your variable sensorValue onto the "print to
serial monitor" block, and make sure the dropdown is set to print with a new line.
Optionally start the simulation and open the serial monitor to verify readings are coming in
and changing when you adjust the sensor. Analog input values range from 0-1023.

Since we want to write to the LED with a number between 0 (off) and 255 (full brightness),
we'll use the "map" block to do some cross-multiplication for us. Navigate to the Math
category and drag out a "map" block.

In the first slot, drag in a sensorValue variable block, then set the range from 0 to 255.

Back in the Output category, drag out an analog "set pin" block, which by default says "set
pin 3 to 0." Adjust it to set pin 9.

Drag the map block you made earlier into the "set pin" block's "to" field to write the
adjusted number to the LED pin using PWM.

Click the Control category and drag out a wait block, and adjust it to delay the program for
.1 seconds.

Step 3: Photoresistor Arduino Code Explained


When the code editor is open, you can click the dropdown menu on the left and select
"Blocks + Text" to reveal the Arduino code generated by the code blocks. Follow along as we
explore the code in more detail.

int sensorValue = 0;

Before the setup() , we create a variable to store the current value read from the
potentiometer. It’s called int because it’s an integer, or any whole number.

void setup()
{
pinMode(A0, INPUT);
pinMode(9, OUTPUT);
Serial.begin(9600);
}
Inside the setup, pins are configured using the pinMode() function. Pin A0 is configured as
an input, so we can "listen" to the electrical state of the potentiometer. Pin 9 is configured
as an output to control the LED. To be able to send messages, the Arduino opens a new
serial communication channel with Serial.begin() , which takes a baud rate argument (what
speed to communicate), in this case 9600 bits per second.

void loop()
{
// read the value from the sensor
sensorValue = analogRead(A0);
// print the sensor reading so you know its range
Serial.println(sensorValue);

Anything after a set of slashes // is a comment, which helps folks understand in plain
language what the program is intended to do, but is not included in the program your
Arduino runs. In the main loop, a function called analogRead(); checks the state of pin A0
(which will be a whole number from 0-1023), and stores that value in the
variable sensorValue .

// map the sensor reading to a range for the LED


analogWrite(9, map(sensorValue, 0, 1023, 0, 255));
delay(100); // Wait for 100 millisecond(s)
}

The line following the next comment is doing a lot at once. Remember analogWrite() takes
two arguments, the pin number (9 in our case), and the value to write, which should be
between 0 and 255. The inline function map() takes five arguments: the number to
evaluate (the ever-changing sensor variable), the expected minimum and expected
maximum, and the desired min and max. So the map() function in our case is evaluating
the incoming sensorValue, and doing some cross multiplication to scale the output down
from 0-1023 to 0-255. The result is returned into the second argument of analogWrite(); ,
setting the brightness of the LED connected to pin 9

Step 4: Build a Physical Arduino Circuit (optional)


To program your physical Arduino Uno, you'll need to install the free software (or plugin for
the web editor), then open it up. Various photocells have different values, so if your physical
circuit is not working, you may need to change the resistor that is paired with it. Learn more
about voltage dividers in the Instructables Electronics Class lesson on resistors.

Wire up the Arduino Uno circuit by plugging in components and wires to match the
connections shown here in Tinkercad Circuits. For a more in-depth walk-through on working
with your physical Arduino Uno board, check out the free Instructables Arduino class.

Copy the code from the Tinkercad Circuits code window and paste it into an empty sketch in
your Arduino software, or click the download button (downward facing arrow) and open the
resulting file using Arduino.You can also find this example in the Arduino software by
navigating to File -> Examples -> 03.Analog -> AnalogInOutSerial.

Plug in your USB cable and select your board and port in the software’s Tools menu.

Upload the code and use your hand to cover the sensor from receiving light, and/or shine a
light on your sensor!

Open the serial monitor to observe your sensor values. It's likely that real world values will
not extend all the way to 0 or all the way to 1023, depending on your lighting conditions.
Feel free to adjust the 0-1023 range to your observed minimum and observed maximum in
order to get the maximum brightness expression range on the LED.

Step 5: Next, Try...


Now that you’ve learned to read a photoresistor and map its output to control the
brightness of an LED, you're ready to apply those and other skills you've learned so far.
Can you swap out the LED for another type of output, like a servo motor, and create some
code to reflect the sensor's current light level as a certain position along a gauge?

Try swapping out your photoresistor for other analog inputs such as an ultrasonic distance
sensor or potentiometer.

Learn more about how to monitor your Arduino's digital and analog inputs through the
computer using the Serial Monitor.
CONCLUSION:
In this paper, the light will turn on once it is exposed to
darkness. So, it's a light that will come on when it gets dark such as at
night time. This is extremely useful for people who may live in a house
that have vision problems and need the lights to automatically turn on
when it gets dark. It's also very useful for elderly people who live in a
home who may have difficulty walking to turn on lights when it
becomes dark. In our circuit, we will turn on a lamp as soon as the level
of light reaches a certain level of darkness. Thus, the place where we
place this circuit will always be illuminated, either by the natural light
of the day or by the lamp of this circuit turning on when it becomes
dark.

By using this system energy consumption is also reduced


because nowadays the manually operated street lights are not
switched off even after the sunlight comes visible and also switching
ON earlier before sunset. This design can be used in different areas
like Street lights, Public parks, and lights outside of buildings. This
circuit can extend by using Radio Frequency Identification (RFID) for
the automatic detection and identification of light faults. This system
can extend remote monitoring to check the LED brightness level.
REFERENCES:

You might also like