Escolar Documentos
Profissional Documentos
Cultura Documentos
BACHELOR OF TECHNOLOGY
in
SANGYA 04720902713
to the
APRIL 2017
[i]
CERTIFICATE
This is to certify that Report entitled ANTI THEFT HOME which is submitted by us in
partial fulfilment of the requirement for the award of degree B.Tech. In Computer Science
Engineering to GBPEC, GGSIP University, Delhi comprises only our original work and due
acknowledgement has been made in the text to all other material used.
SANGYA
ANUMEHA
AMAN GARG
APPROVED BY...................
[ii]
ACKNOWLEDGEMENT
The project has been a success only because of the supportive environment and therefore we
would take the opportunity to thank our teacher coordinators Ms. Sunita Tiwari and Ms.
Jyoti, CSE Dept. (G. B. Pant Govt. Engineering College). It would not have been possible
without their guidance and motivation throughout the project and research.
It gives us great pleasure to place on record our sincere thanks to our teachers for
having generously providing necessary guidance, encouragement, and moral support during
the course of the project preparation.
Finally we extend our gratefulness to one and all who are directly and indirectly
involved in the successful completion of this project work.
[iii]
ABSTRACT
This project, Anti Home Theft is a real life application and implementation of Internet of
Things. IoT is simply the network of interconnected things/devices which are embedded with
sensors, software, network connectivity and necessary electronics that enables them to collect
and exchange data making them responsive. The basic functionality of the project includes a
camera and a sensor which will detect the movement and capture the photographs, a central
processing unit and a platform where the response will be shown. Here we are using
Raspberry Pi as the central processing unit. As for the camera, we are using a Raspbian
camera and PIR sensor.
The PIR sensor keeps checking for any movement and when the motion is detected by
the sensor, it sends a signal to the camera which then captures a photograph and sends it to the
server along with the PI ID. The server then matches the PI ID for the facebook ID of the user
and the captured photograph is sent to the facebook messenger.
[iv]
TABLE OF CONTENTS
CERTIFICATE ii
ACKNOWLEDGEMENT iii
ABSTRACT iv
TABLE OF CONTENTS v
LIST OF TABLES vii
LIST OF FIGURES viii
1. INTRODUCTION 1
2. SYSTEM SPECIFICATION 3
2.1 SOFTWARE SPECIFICATION 3
2.1.1 CHATBOT 3
2.2 HARDWARE SPECIFICATION 8
2.2.1 RASPBERRY PI: 9
2.2.2 PIR Sensor 10
2.2.3 PICAMERA 11
[v]
[vi]
LIST OF TABLES
[vii]
LIST OF FIGURES
[viii]
[ix]
CHAPTER 1
INTRODUCTION
Anti-Theft System:
The basic idea of an anti-theft system revolves around recognition and prevention of any kind
of anti - social activity such as theft and robbery. Our project is based on such a belief. The
project focuses on detection of any kind of physical movement in the range of our device and
then sending data such as pictures to a remote device.
The detection of the movement is done with the help of a PIR Sensor that is a Passive Infrared
Sensor. It measures infrared (IR) light radiating from objects in its field of view. The camera
used for taking pictures is compatible with Raspberry Pi which is a single board
microcomputer.
Our Anti-Theft System makes use of Internet of Things technology which is basically
collaboration between the real life entities such a s cameras and sensors with internet based
facilities such as a Facebook Chat bot. It empowers the users to keep a check of their valuable
belongings even if they are not in the close vicinity of them.
Target Audience:
Being based on IoT, our system is both versatile and flexible. Anyone who thinks he/she has
something valuable, be it material or non-material, they are our target audience. This project
can have a number of applications and its domain can vary from any theft system to normal
monitoring and surveillance systems. With an addition of a few functionalities, we can use it
for managing things like access modifiers and that too with just a click of a button.
[1]
Motivation:
Items may require an anti-theft system for a variety of reasons, which may occur in
combination depending on the type of item and its purpose:
The item is expensive and/or has sentimental value (prestigious car, family heirloom,
birthday gift, war medals, coin collection).
The item is difficult/impossible to replace if lost (produced in low numbers, antiques,
and unique works of art).
The item is easy to steal (retail/supermarket products, office stationery).
The item may be left unattended in an unsafe environment for a certain amount of time
(laptop in a library, car in a car park).
Improper use of the item may cause considerable damage or encourage further
unauthorized actions (theft of car keys, stolen building access keys, identity theft).
Ubiquitous networks personal Wi-Fi on your mobile phone and on every other
device. Everyone (and everything) wants and needs to be connected.
Connected computing we want all of our devices, phones, televisions, music players,
vehicles, etc. to keep track of what we are doing, viewing, reading, and listening to as
we move through our day, from place to place the handoffs from device to device are
already happening.
Ubiquitous sensors on everything. It is already here the Internet of Everything and
the wearable revolution.
[2]
CHAPTER 2
SYSTEM SPECIFICATION
2.1.1 CHATBOT:
Before chatbots there were just bots: a piece of software that is designed to automate
a specific task. A chatbot is built on the same premise; however it delivers this task
around a single function, namely chat, or simulated conversation.
The chatbot is essentially a user interface which can be plugged into a number of
data sources via APIs so it can deliver information or services on demand, such as
weather forecasts or breaking news.
We used django framework to create our chatbot. This code is deployed on the
Heroku which will act as the Webhook that will be used in creating facebook app.
[3]
You need to create a Facebook Page. The Facebook Page is the identity of your
bot, including the name and image that appears when someone chats with it inside
Facebook Messenger.
You need to create a Facebook Page. The Facebook Page is the identity of your
bot, including the name and image that appears when someone chats with it inside
Facebook Messenger.
Fig 1.
Youll see your new App ID at the top left on the next page. Scroll down and click
Get Started next to Messenger.
[4]
Fig 2
Now were in the Messenger settings of our Facebook App. There are a few things
well need to fill out in order to get our chatbot wired up to the Heroku endpoint
we setup earlier.
[5]
Fig 3
Click on the Page Access Token to copy it to your clipboard. Youll need to set it
as an environment variable for your Heroku application. This token will be used to
authenticate your requests whenever you try to send a message or reply to
someone.
Setup Webhook
When you go to setup your Webhook, youll need a few bits of information:
Fig 4
Callback URL - The Heroku (or other) URL that we setup earlier.
Verification Token - A secret value that will be sent to your bot, in order to
verify the request is coming from Facebook. Whatever value you set here,
make sure you add it to your Heroku environment
Subscription Fields - This tells Facebook what messaging events you care
about and want it to notify your Webhook about. If you're not sure, just start
with "messages," as you can change this later.
After youve configured your Webhook, youll need to subscribe to the specific
page you want to receive message notifications for.
[6]
Fig 5
Once weve gotten your Page Access Token and set up our Webhook, and make
sure we set both the PAGE_ACCESS_TOKEN and VERIFY_TOKEN config
values in your Heroku application.
Fig
[7]
Fig
Start sending your Page messages and the bot should reply. To see whats happening, check
the logs of your application Heroku logs t.
RASPBERRY PI
RASPBERRY PI CAM
PIR SENSOR
JUMPER WIRES
HDMI TO HDMI CABLE
HDMI DISPLAY
USB KEYBOARD
USB MOUSE
5V,3A POWER ADAPTER
MICRO SD CARD 16GB
[8]
2.2.1 RASPBERRY PI:
HDMI to HDMI / DVI lead HDMI to HDMI lead (for HD TVs and monitors with HDMI input)
Keyboard and mouse Any standard USB keyboard and mouse should work.
Ethernet (network) cable Networking is optional, although it makes updating and getting new
[optional] software for your Raspberry Pi much easier.
Power adapter A good quality, micro USB power supply that can provide at least
700mA at 5V is essential.
Table 1
[9]
You will be asked for your Password
Type : raspberry
You will then see the prompt : pi@raspberry ~ $
Start the desktop by typing : startx
Raspberry Pi is now running.
Most PIR sensors have a 3-pin connection at the side or bottom. One pin will be
ground, another will be signal and the last pin will be power. Power is usually up to
5V. Sometimes bigger modules dont have direct output and instead just operate a
relay which case there is ground, power and the two switch associations. Interfacing
PIR with micro controller is very easy and simple. The PIR acts as a digital output so
all you need to do is listening for the pin to flip high or low. The motion can be
detected by checking for a high signal on a single I/O pin. Once the sensor warms up
the output will remain low until there is motion, at which time the output will swing
high for a couple of seconds, then return low. If motion continues the output will cycle
in this manner until the sensors line of sight of still again. The PIR sensor needs a
warm-up time with a specific end goal to capacity fittingly. This is because of the
settling time included in studying natures domain. This could be anyplace from 10-60
seconds.
[10]
Connect the one labeled VCC on the PIR sensor to the 5V pin on the Raspberry Pi.
This provides power to the PIR sensor.
Connect the one labeled GND to a ground pin on the Raspberry Pi. This completes the
circuit.
Connect the one labeled OUT to GPIO pin 4. This pin will output a voltage when
motion is detected, that can then be received by the Raspberry Pi.
pir = MotionSensor(4)
while True:
if pir.motion_detected:
print("Motion detected!)
Every time the PIR detects motion, you should see the words Motion detected! appear
in the IDLE shell. Press Ctrl + F6 when you want to exit.
2.2.3 PICAMERA
The Camera Module is a great accessory for the Raspberry Pi, allowing users to take
still pictures and record video in full HD.
Connect the Camera Module
Locate the camera port and connect the camera:
Connect the camera
[11]
Start up the Pi.
Open the Raspberry Pi Configuration Tool from the main menu:
Raspberry Pi Configuration Tool
Ensure the camera software is enabled:
Camera software enabled
If it's not enabled, enable it and reboot your Pi to begin.
Camera Preview
Now your camera is connected and the software is enabled, you can get started by
trying out the camera preview.
camera = PiCamera()
camera.start_preview()
sleep(10)
camera.stop_preview()
4. Save with Ctrl + S and run with F5. The camera preview should be shown for 10
seconds, and then close. Move the camera around to preview what the camera sees.
5. If your preview was upside-down, you can rotate it with the following code:
camera.rotation = 180
camera.start_preview()
sleep(10)
camera.stop_preview()
You can rotate the image by 90, 180, or 270 degrees, or you can set it to 0 to reset.
6. You can alter the transparency of the camera preview by setting an alpha level:
camera = PiCamera()
[12]
camera.start_preview(alpha=200)
sleep(10)
camera.stop_preview()
alpha can be any value between 0 and 255.
Fig
Fig
[13]
Fig
Fig
[14]
[15]