Access Control of Door and Home Security by Raspberry Pi Through Internet


In this modern world crime has become ultra modern too! In this current time a lot of incident occurs like robbery, stealing unwanted entrance happens abruptly. So the home security does matters in this daily life. People always remain busy in their day to day work also wants to ensure their safety of their beloved things. Sometimes they forget to look after their necessary things like keys, wallet, credit cards etc. Without these, they are unable to access their home security or any place they want. To prevent such incidents many scholars came into action and tried to pro- hibit them. Like YanboZhao ; ZhaohuiYe introduced ‚ÄúA GSM/GPRS based wireless home security system[2] but the system is not cost effective as the GSM/GPRS charges a fixed amount from each sms/call or data transfer. Ha- san,H. ; Bakar,R.A. ; Mokhtar,A.T.F. also introduced ‚ÄĚ ‚ÄúFace recognition based on auto-switching magnetic door lock system using microcontroller‚ÄĚ[3][5] but face recognition means com- plex algorithms and sometimes the system may be unable to detect the visitors identification correctly and keeps a computer chip busy for longer time. Assaf, M.H. ; Mootoo, R. ; Das, S.R. ; Petriu, E.M. ; Groza, V. ;Biswas, S. invented ‚ÄúSensor based home automation and security system‚ÄĚ[4] designed a sensor based system. Lots of paper work has been done so far. In this paper, a new system is designed which would access control the door through the internet without any complexity. It‚Äôs very conve- nient and serves as a plug and play system. The user can see from anywhere in this world that who is at his door steps.¬†The system keeps a picture of the visitor as evidence that would be needed if any unwanted situation occurs like stealing, robbery etc. The user can access control the door with a single command through the internet by mobile, pc, tablets etc. This system can also be used for industrial automation wirelessly.¬†Also for any kind of accident like fire, or stolen keys the door can be opened by a single and simple command. As a result the home security is con-
firmed also the mental peace.

Author 1- Dept. of Electrical & Electronic Engineering, AIUB (American

International University-Bangladesh)


Author 2- Dept. of Electrical & Electronic Engineering, AIUB (American

International University-Bangladesh) Email:

Author 3- Dept. of Electrical & Electronic Engineering, AIUB (American

International University-Bangladesh) Email:


In this project with a minicomputer raspberry pi different input and output is interfaced. In input section there is calling bell, PIR sensor & wireless camera. In processing section a minicomputer raspberry pi is used. Raspberry pi is equipped with wifi dongle. And on the output terminal there are Lcd, magnetic door lock, emailing & tweeting services. A calling bell is placed on door so that if someone visits the user the person will press the bell and the bell will generate a signal to raspberry pi indicating presence of a person. There is also another way of sensing human and that is passive infra red human motion detection sensor. If any thief tries to break into the house PIR sensor will identify the motion of that human and will transmit an alarm to raspberry pi. Most im- portant input device is the wireless camera. It is used to see video stream and also whenever a person comes it takes a snapshot of that person and transmit it to raspberry pi. Raspberry pi process these inputs like whenever it gets a calling bell as input it trans- mits a signal to wireless camera to capture an image of the visitor. Within the time it receives the picture it generate a Tweet alerting the user that someone has arrived infront of door. After receiving the image raspberry pi sends a mail to user attaching the picture. User can control the magnetic lock through twiter. If user wants to permit the visitor access he can turn on the lock and if he wants to reject access for any reason user can show the reason to LCD tweeting a text for visitor

minicomputer 1


Figure 1. Main Project Outline

Figure 2. Prototype Design of Internet Controlled Door



Raspberry Pi Model B has 512Mb RAM, 2 USB ports and an Ethernet port. It has a Broadcom BCM2835 system on a chip which includes an ARM1176JZF-S
700 MHz processor, Video Core IV GPU, and an SD card. It has a fast 3D core accessed using the supplied OpenGL ES2.0 and Open VG libraries. The chip spe- cifically provides HDMI and there is no VGA sup- port. The foundation provides Debian and Arch Li- nux ARM distributions and also Python as the main programming language, with the support for BBC BASIC, C and Perl


Wifi dongle is connected through USB port. With wireless speeds of up to 300Mbps and advanced MI- MO technology, works seamlessly with existing IEEE
802.11b/g networks. This tiny adapter works as a vir-
tual wireless Access Point. Compatible with Wi-Fi Protected Setup (WPS), establish a WPA2 secure con- nection, more secure than WEP encryptions.



Fig.3. Raspberry pi

Fig.4. WiFi Dongle


The key of this project is Human sensing technology. In this projectPassive Infra Red sensor has been used to detect hu- man. Infrared radiation exists in the electromagnetic spectrum at a wavelength which is longer than visible light. it can be detected though it cannot be seen. Objects that generate heat also generate infrared radiation and those objects include an- imals and the human body whose radiation is strongest at a wavelength of 9.4um [6].PIR sensor is able to detect the change of radiation of these infrared radiation. A picture of working principle of PIR sensor is given below


Figure.5. Typical configuration of PIR

PIR sensor generates +5v and -5v sine signal when any human or animal passes in front of the sensor or any movement is detected of human or animal in front of this. A breakout board is used to detect this signal and convert it into a longer digital signal. The output of PIR sensor can be adjusted. For max it can create an output signal for approximately 1.2 seconds [7]. This is more than enough to detect the signal.


Fig.6. Working principle of PIR sensor


Figure 7. Main Circuit Diagram


Heart of this project is raspberry pi minicomputer. Wifi dongle is connected through USB port. The wifi module scans for the available network and connects to the network with pass- word. Calling bell is connected with GPIO of raspberry pi. Whenever someone come to home and press button the calling bell starts to transmit musics. A resister is connected to calling bell and whenever music plays it generates 5v signal. This causes an interrupt to raspberry pi. PIR sensor is also con- nected to GPIO. The pin is pulled down and pir sensor also generates a high voltage whenever it detects presence of any human. Raspberry pi is always scanning for pir sensor input or calling bell input. Here is also an indication which gene- rates an special alert. In the algorithm it is defined that if any visitor comes in and press the bell means both the interrupt
happened it is a common situation and indicating that a visitor
has arrived But if only one interruption happens like human motion then it’s indicates that a thief or robber might have come. An individual interrupt of calling bell indicates pir sen- sor has gone out of order. When the system received both the interrupts raspberry pi take a snap shot of the person through wifi camera. Here the camera is connected with raspberry pi through wifi network. Raspberry pi transmits the snapshot through gmail. And also generates a tweet that someone has arrived. But if only PIR sensor generates the interrupt then it generates an instant alerm that might have someone is trying to have unauthorized access or break into the house. It takes several snapshots and generates several tweets to the user as alert. The 1.8’ TFT LCD is connected through serial peripheral interface and the magnetic lock is controlled by a GPIO.


Here is the flow chart of the system. At first the system detects human and automatically raspberry pi take a snapshot which means the image acquisition part. After that image is attached and mailed to user that is the image processing, mail & tweet part. At last when user sends a re-tweet of door lock or open according to users command the magnetic lock gets open or close.


Fig.8. Flow chart of the designed System

Fswebcam is used to take the webcam snapshots by the Wi- Fi camera. Also this Wi-Fi camera is accessible from anywhere for a live view of the visitor.

sudo apt-get install fswebcam

Here is the interrupt portion. If interrupt from PIR sensor happens then the cam is commanded to take snapshot.

sudo apt-get install fswebcam if (GPIO.input(buttonPin)):

#this is the script that will be called (as root)

os.system(“fswebcam -r 960×720 -d

/dev/video0 /home/pi/webcam.jpg”)



The system needs its own username and password so that it can access to the account and generate a mail automatically. The email address and password of the system is given bel- low.

USERNAME = “” PASSWORD = “awsedrft123”

server = smtplib.SMTP(‘’) server.ehlo_or_helo_if_needed() server.starttls() server.ehlo_or_helo_if_needed() server.login(USERNAME,PASSWORD) server.sendmail(USERNAME, to,



After connecting to the server the server needs the email address of the user. The users email address is given bellow.

sendMail( [“”],

“Door Bell Alert! Visitor Snap-


“Someone is at your door and ringing

your door bell. Please See the Attached picture.”,

[“/home/pi/ Visitor at your

door.jpg “] )

The image is attached as Visitor at your door.jpg and mailed to

IJSER © 2013

International Journal of Scientific & Engineering Research Volume 4, Issue 1Ňó«į»Ī ¬ė¬ü¬é¬Ė¬č¬é¬õ-2013

ISSN 2229-5518


In order to tweet from Raspberry Pi to notify the user about the visitor Twython needs to be installed on the Raspberry Pi. It’s a a Python module for interfacing with Twitter. A OAuth access token is needed, this gives application to access the us- ers twitter account.
By default, the app is set to read-only, so user won’t be able to publish tweets without changing that to Read and Write. Need to change from Settings tab and change the Application type.


Fig.8. Application type changed to read and write


Fig.9. Access token for the Application on Twitter
On the twitter app page the followings needs to be replaced by user’s token information

import sys

from twython import Twython

ACCESS_KEY = From Token
In addition the user can also have the picture of the visitor instantly on twitter. The following needs to be followed in order to tweet picture from raspberry pi to twitter account. Here pygame libraries are used to take picture from the cam- era.

import pygame


from pygame.locals import *

cam =“/dev/video0”,(640,480))
image = cam.get_image(),’ Visitor at your door.jpg’)
Then to update this status in twitter :
photo = open(‘visitor at the door.jpg’,’rb’)
api.update_status_with_media(media=photo, status=’Door
Bell Alert!Someone is at your door’)


Figure 10. Hardware of the designed System


Here the figure of the implemented hardware is given. All the components and connected according to the main circuit diagram. When the PIR sensor is interrupted then the Wi-Fi camera takes a snapshot and E-mail that attachment to the respective E-mail account and generates a tweet in the twitter to notify the authorized person about the visitor with picture. The user can then see the visitor either from web from anywhere in the world by Wi-Fi camera. If the user wants to give a message to the visitor, user just tweets in the twitter and the visitor can see the message on the screen on the front face of the door or the user can send command via twitter to open the door.



When the PIR sensor faces obsticles or detects human or the visitor rings the bell the camera takes a snapshot and send it via Email to the users account.
Figure 11. E-mail Received with Snapshot of the Visitor
An automatic tweet notification is generated in the twitter with picture of the visitor also. The user can choose wether to see the picture from the E-mail or Twitter
If the user wants to open the door for the visitor, user just needs to tweet from twitter and the command goes to raspberry and the door is opened


Figure 13. Confirmation from twitter
The user can commad to raspberry to close the door.


Fiure 14. Confirmation from twitter after closing the door
Figure 12. Visitor Alert from twitter



ÔÉė¬†Internet of households where we can attach other devices of house with internet.

ÔÉė¬†Industrial automation and control through internet.

ÔÉė¬†Automated fire exit systems can be build

ÔÉė¬†Improvement in the security issues in highly re- stricted areas


The system can be used in several places like banks, hospitals, labs and other sophisticated automated systems, which dramatically reduce the hazard of unauthorized entry. Evidence can be given to the security department if any robbery issue occurs. But the system needs to be monitor always that the internet bills are paid in due time to keep connected with own home.

Source: Access Control of Door and Home Security by Raspberry Pi Through Internet

0/5 (0 Reviews)

About The Author

Hassan Zaka

I am an expert in accounting and possess diverse experience in technical writing. I have written for various industries on topics such as finance, business, and technology. My writing style is clear and simple, and I utilize infographics and diagrams to make my writing more engaging. I can be a valuable asset to any organization in need of technical writing services.

Follow Us:

Leave a Comment

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

Scroll to Top