IOT based Smart Home Security System with Alert and Door Access Control using Smart Phone

DOI : 10.17577/IJERTV5IS120325

Download Full-Text PDF Cite this Publication

Text Only Version

IOT based Smart Home Security System with Alert and Door Access Control using Smart Phone

Shaik Anwar

Department of Electronics and Communication Engineering

Aditya College of Engineering and Technology Surampallem, AndhraPradesh, India

D. Kishore Associate Professor

Department of Electronics and Communication Engineering

Aditya College of Engineering and Technology Surampallem, AndhraPradesh, India

Abstract The system is about remotely managed Door accessibility and voice alerting through Smart Phone and receive captured image of visitor at Door as Email alert. Smart home security control system has become indispensable in daily life. The design and development of a home security system, based on human motion detection and remotely monitoring technology, to confirm visitor identity and to control Door accessibility has been reported in this paper. This paper describes about the implementation and deployment of wireless control system and accessibility in to a home environment for authenticated people only. A PIR motion sensor and Camera module are used to detect motion and capture images respectively are dedicatedly make the security system alive as per the request. Electromagnetic door lock module operate the door accessibility, has been designed and developed.

The proposed system uses controller interface system with Raspberry Pi which is low cost and consume smaller amount of power. When visitor motion detected at Door, Camera module interfaced to Raspberry Pi capture images, save it on system and send it as Email alert via TCP/IP. The concerned authority can control the system and view video stream of camera module through Smart mobile Phone. The system also provided concerned authority to use Smart Phone to send command for voice alert when intruder identified. Users can monitor visitors and control the door lock on active SSH (Secure Shell) page designed on android platform and enhanced with JavaScript. This system finds a wide application in areas where physical presence is not possible all the time. The entire control system is built using ARM1176JZF-S microcontroller and tested for actual use in home environment.

KeywordsPIR; Raspberry Pi; PiCamera module; SSHclient; Door acess;Voice alert; Email alert.

  1. INTRODUCTION

    An efficient, low power consumption and low cost embedded access control system for Smart home security and remote monitoring[3] based on motion detection is very important for wide range of commercial and security application. Many countries are gradually adopting smart home security control system. Today most of the home and office appliances that we interact with contain microprocessors. All of these appliances have some user interface, but many users become frustrated with the difficulty of using the complex functions of their appliances. We are developing a framework that allows users to interact

    with appliances through a separate user interface device that they are already carrying. Smart phones are good candidates for providing interfaces because they are common, have communication capabilities to allow connection to appliances, and are already being used for a wide range of different applications. Our framework includes an abstract specification language for describing appliances, a two-way communication protocol, and automatic interface generation software that allows user interfaces to be customized to users and the devices they are using [2]. The most important part of any home security system is accurately detecting visitor who enter and leave through the door. An entrance guard can be managed remotely, detecting visitors at Door and alerting to user via mobile phone is the most natural way to perform security. The proposed system have added features like view video stream through mobile phone [3]. Additionally, voice alert or siren activated to alert neighbors when intruder detected. The system identifies the visitors presence, capture and transfers the image through email automatically to home owner to recognize the visitors. The system also generates voice output whenever a person tries to enter into the house. The user can directly login and interact with the embedded device in real time without the need to maintain an additional server. It has a variety of features such as energy efficient, intelligence, low cost, portability and high performance.

  2. SYSTEM ARCHITECTURE

    Smart home security system consists of two components, Embedded Control Unit (ECU) is part of Smart home where security system implemented and Remote Control Unit (RCU) is a framework implemented on Users smart phone.

    1. Embedded Control Unit (ECU)

      ECU is an efficient, low power consumption and low cost embedded access control system for Smart home security and allows user to remote monitoring and controlling. ECU consists of Raspberry Pi set up with Raspbian Operating System on installed SD card. PIR motion sensor and PiCamera interfaced with Raspberry Pi to detect visitors motion at Door and capture image respectively. Captured images with time and date are saved on SD card. Raspberry Pi configured for enabled SSH and camera. ECU

      also consists of Relay Driver for control of Electromagnetic Door lock and Loud Speaker system for enabled Voice alert.

    2. Remote Control Unit (RCU)

    RCU is a software tool implemented on Users Smart Phone. Provide GUI (Graphical User Interface) to send predefined Linux Terminal Commands via SSH to ECU. SSH is a secure protocol and the most commonly used to administrate and communicate with Linux servers. RCU is implemented on android platform using Java Script on JDK (Java Development Kit) and Eclipse IDE.

  3. BLOCK DIAGRAM

    The System architecture of Smart Home Security System is shown in the figure 1. Raspberry Pi, PiCamera and Power supply forms the entire security system to be installed at the required place. PIR motion sensor is connected to GPIO pins of Raspberry Pi. We can use LCD monitor for setting up Raspberry web server. Loudspeaker mounted at Audio Jack of Raspberry Pi. Relay Driver circuit with IC ULN2003 [16] is interfaced to Raspberry Pi to control Electromagnetic Door Lock. The image captured can save with time and date on SD card or USB Pen drive connected on Raspberry Pi.

    Figure 1: Block diagram

  4. SYSTEM DESCRIPTION

    The remote monitoring and controlling of ECU over the Internet can be mechanized by setting up certain network architectural design strategies such as SSH and applying Internet protocol (IPV6) communication standards [3]. If any visitors arrive, ECU capture image of visitor, save it and sends it to an appropriate email including the details of time and date of captured image. The owner can directly login and interact with the ECU. The images captured and the video recorded will be directly streamed on user pre-decided android app on Smart Phone. User can access the video directly using the Static IP address or can also stream on local domain with the help of websites.

    1. Raspberry Pi

      Raspberry Pi board [13] is a miniature marvel, packing considerable computing power into a footprint no larger than a credit card. The processor at the heart of the Raspberry Pi system is a Broadcom BCM2835 system-on-chip (SoC) multimedia processor. This means that the vast majority of the systems components, including its central and graphics processing units along with the audio and communications hardware, are built onto that single component hidden beneath the 512 MB memory chip at the centre of the board. Its not just this SoC design that makes the BCM283 different to the processor found in your desktop or laptop, however. It also uses a different instruction set architecture (ISA), known as ARM. The Raspberry Pi, by contrast, is designed to run an operating system called GNU/Linux Raspbian. Hereafter referred to simply as Linux. Unlike Windows or OS X, Linux is open source: its possible to download the source code for the entire operating system and make whatever changes you desire.

      Features of the Raspberry Pi [13]

      • Model B+ Raspberry Pi with Mounting Points and

      • 512MB RAM.

      • Broadcom BCM2835 ARM11 700 MHz

      • Integrated Video core 4 Graphics GPU capable of playing

      • Full 1080p HD Video.

      • 4 x USB Ports (Max Output 1.2A).

      • Board Power Draw: 600mA.

      • HDMI Video Output.

      • 10/100Mb Ethernet Port for Internet Access.

      • Micro SD Flash Memory Card Slot.

      • 40-pin 2.54mm Header Expansion Slot (Which allow for peripherals and expansion boards)

      • Dimensions 85 x 56 x 17mm.

      • The Raspberry Pi is boot by external memory card with Raspbian Jessie images

        Figure 2: Raspberry Pi3

    2. Raspberry PiCamera Module

      The Raspberry Pi Camera Module is a custom designed add- on for Raspberry Pi. It attaches to Raspberry Pi by way of one of the two small sockets on the board upper surface. This

      interface uses the dedicated CSI interface, which was designed especially for interfacing to cameras. The CSI bus is capable of extremely high data rates, and it exclusively carries pixel data.

      Figure 3: Raspberry PiCamera Module

    3. PIR motion Sensor

    The PIR (Passive Infra-Red) Sensor is a Pyroelectric device that detects human body motion by measuring changes in the infrared levels emitted by surrounding objects. This motion can be detected by checking for a high signal on a single I/O pin. Incorporating a Fresnel lens and motion detection circuit. High sensitivity and low noise. Output is a standard 5V active low output signal. Module provides an optimized circuit that will detect motion up to 6 meters away Inexpensive and easy to use, The Output can be connected to GPIO pins of Raspberry Pi directly to monitor signal.

    Figure 5: PIR motion Sensor

  5. SYSTEM IMPLEMENTATION

    The System was implemented on a Raspberry pi development board in Linux environment, which supports SMTP (Simple Mail Transfer Protocol), TCP/IP, HTTP. The web server Flash File System supports dynamically generated files that can include output data from hardware resources. This type of file is called an embedded server page (ESP).

    1. Installing OS and Configuring Raspberry Pi

      First we need to install Raspbian on your micro SD card that will be used in Raspberry Pi. We can download the latest image of Raspbian OS from Raspberry Pi website at [13]:

      http://www.raspberrypi.org/downloads/ http://www.raspberrypi.org/documentation/installat…

      After successfully installing Raspbian OS on Raspberry Pi, we need to update software. To do this we need to run following Linux commands [13]:

      $ sudo apt-get update

      $ sudo apt-get upgrade

    2. Raspberry Pi Camera Configuring

      After successfully installing Raspbian OS on Raspberry Pi, we need install Pi camera Library files. To do this we need to run following Linux commands [13]:

      $ sudo apt-get install motion

      $ sudo apt-get install python-picamera

      $ sudo apt-get install python3-picamera

      After installing Picamera Library files, we need to enable camera by running command [13]:

      $ sudo raspi-config

      Use the cursor keys to move to the camera option and select enable. On exiting raspi-config it will ask to reboot. The enable option will ensure that on reboot the correct GPU firmware will be running and the GPU memory split is sufficient to allow the camera to acquire enough memory to run correctly. To test that the system is installed correctly and is in working condition, try the following command [13]:

      $ rasistill -v -o test.jpg

    3. Installing Software for sending Email alert

      Now after setting up the Pi Camera, we will install software for sending the Email. Here we are using SMTP, which is an easy and good solution for sending Email using command line or using Python Script. We need to install two Libraries for sending mails using SMTP:

      $ sudo apt-get install ssmtp

      $ sudo apt-get install mailutils

      After installing libraries, user needs to open ssmtp.conf file and edit this configuration file as shown below and then save the file. To save and exit the file, Press CTRL+x, then y and then press enter.

      $ sudo nano /etc/ssmtp/ssmtp.conf

      root=YourEmailAddress mailhub=smtp.gmail.com:587 hostname=Anwar(User Name) AuthUser=EmailAddress AuthPass=EmailPassword FromLineOverride=YES UseSTARTTLS=YES UseTLS=YES

      root=YourEmailAddress mailhub=smtp.gmail.com:587 hostname=Anwar(User Name) AuthUser=EmailAddress AuthPass=EmailPassword FromLineOverride=YES UseSTARTTLS=YES UseTLS=YES

      We can also test it by sending a test Email by issuing below command; we shall get the Email on the mentioned email address if everything is working fine:

      $echo "Hello Smart Phone" | mail -s "Testing…"

    4. Python Program for ECU

      The Python Program of this project plays a very important role to perform all the operations. First of all, we include required libraries for email, initialize variables and define pins for PIR, LED and other components. For sending simple email, SMTP Library is enough but if we want to send

      if current_state:

      cap = cv2.VideoCapture(0) ret, frame = cap.read()

      cap = cv2.VideoCapture(0) print "Saving Photo"

      picname = datetime.now().strftime("%y-%m-%d-%H-

      %M")

      picname = picname+'.jpg' cv2.imwrite(picname, frame) print "Sending email"

      attach = picname

      msg = MIMEMultipart() msg['From'] = gmail_user msg['To'] = to msg['Subject'] = subject

      msg.attach(MIMEText(text))

      part = MIMEBase('application', 'octet-stream') part.set_payload(open(attach, 'rb').read()) Encoders.encode_base64(part) part.add_header('Content-Disposition','attachment;

      filename="%s"' %

      if current_state:

      cap = cv2.VideoCapture(0) ret, frame = cap.read()

      cap = cv2.VideoCapture(0) print "Saving Photo"

      picname = datetime.now().strftime("%y-%m-%d-%H-

      %M")

      picname = picname+'.jpg' cv2.imwrite(picname, frame) print "Sending email"

      attach = picname

      msg = MIMEMultipart() msg['From'] = gmail_user msg['To'] = to msg['Subject'] = subject

      msg.attach(MIMEText(text))

      part = MIMEBase('application', 'octet-stream') part.set_payload(open(attach, 'rb').read()) Encoders.encode_base64(part) part.add_header('Content-Disposition','attachment;

      filename="%s"' %

      mail in cleaner way with subject line, attachment etc. then we needs to use MIME (Multipurpose Internet Mail Extensions). The following library module files are imported on python script.

      import RPi.GPIO as GPIO import time

      import numpy as np import cv2

      from datetime import datetime import os

      import smtplib

      from email.MIMEMultipart import MIMEMultipart from email.MIMEBase import MIMEBase

      from email.MIMEText import MIMEText from email import Encoders

      import RPi.GPIO as GPIO import time

      import numpy as np import cv2

      from datetime import datetime import os

      import smtplib

      from email.MIMEMultipart import MIMEMultipart from email.MIMEBase import MIMEBase

      from email.MIMEText import MIMEText from email import Encoders

      After importing required Library modules, we need to define Email address and message for alert

      mail_user = "xxxx@gmail.com" #Sender email address

      gmail_pwd = "xxxx" #Sender email password

      to = "xxxx@gmail.com" #Receiver email address subject = "Security Breach"

      text = "Visitors at Door. Find attached picture."

      gmail_user = "xxxx@gmail.com" #Sender email address

      gmail_pwd = "xxxx" #Sender email password

      to = "xxxx@gmail.com" #Receiver email address subject = "Security Breach"

      text = "Visitors at Door. Find attached picture."

      Now, we need to define GPIO pins for PIR sensor and define PiCamera function to capture image when PIR sensor tiger input.

      sensor = 4 GPIO.setmode(GPIO.BCM)

      GPIO.setup(sensor, GPIO.IN, GPIO.PUD_DOWN) previous_state = False

      current_state = False while True:

      previous_state = current_state current_state = GPIO.input(sensor) if current_state != previous_state:

      new_state = "HIGH" if current_state else "LOW" print("GPIO pin %s is %s" % (sensor, new_state)

      sensor = 4 GPIO.setmode(GPIO.BCM)

      GPIO.setup(sensor, GPIO.IN, GPIO.PUD_DOWN) previous_state = False

      current_state = False while True:

      previous_state = current_state current_state = GPIO.input(sensor) if current_state != previous_state:

      new_state = "HIGH" if current_state else "LOW" print("GPIO pin %s is %s" % (sensor, new_state)

      Now, we need to define Sendmail() module

      mailServer = smtplib.SMTP("smtp.gmail.com", 587) mailServer.ehlo()

      mailServer.starttls() mailServer.ehlo()

      mailServer.login(gmail_user, gmail_pwd) mailServer.sendmail(gmail_user, to, msg.as_string()) mailServer.quit

      mailServer.close() print "Email Sent" os.remove(picname)

      mailServer = smtplib.SMTP("smtp.gmail.com", 587) mailServer.ehlo()

      mailServer.starttls() mailServer.ehlo()

      mailServer.login(gmail_user, gmail_pwd) mailServer.sendmail(gmail_user, to, msg.as_string()) mailServer.quit

      mailServer.close() print "Email Sent" os.remove(picname)

    5. Voice alert

      User can send Linux command using SSH Client over internet to activate voice alert which is done by playing MP3 file on pre-installed MP3 library module by using the commands:

      $ sudo apt-get install omxplayer

      $ omxplayer voicealer.mp3

    6. DOOR acess

    The Electromagnetic Door Lock which use a relay to Lock or Unlock. It done by running simple Python script:

    importRPi.GPIOas GPIO DOOR_PIN =3

    defGPIOsetup(): GPIO.setmode(GPIO.BCM) GPIO.setup(DOOR_PIN, GPIO.OUT)

    GPIO.setwarnings(False) Defdoor_lockON(): GPIO.output(DOOR_PIN,0) print"DOOR LOCKED"

    return() defdoor_unlock():

    GPIO.output(DOOR_PIN,1) print"DOOR UNLOCKED"

    return()

    importRPi.GPIOas GPIO DOOR_PIN =3

    defGPIOsetup(): GPIO.setmode(GPIO.BCM) GPIO.setup(DOOR_PIN, GPIO.OUT)

    GPIO.setwarnings(False) Defdoor_lockON(): GPIO.output(DOOR_PIN,0) print"DOOR LOCKED"

    return() defdoor_unlock():

    GPIO.output(DOOR_PIN,1) print"DOOR UNLOCKED"

    return()

  6. SOFTWARE IMPLEMENTATION FOR RCU Software tool RCU implemented to provide GUI

    (Graphical User Interface) of SSH client as shown in Figure 5 to send predefined Linux Terminal Commands via SSH to ECU. SSH is a secure protocol and the most commonly used to administrate and communicate with Linux servers. SSH Client is implemented on android platform using Java Script on JDK (Java Development Kit) and Eclipse IDE. Android is the first complete, open, and free mobile platform. Developers enjoy a comprehensive software development kit. Eclipse is an integrated development environment (IDE) used for implementing Android application. It is based on Java IDE. Eclipse is written mostly in Java and its primary use is for developing Java application.

  7. EXPERIMENTAL RESULT

    The experimental setup shown in the Figure 5 is monitoring the environment for visitor at the Door, the ECU sends the Email alert indicating the update visitor to the authorized users and the user then sent command using SSH Client over Internet to ECU for controlling action which is shown from Figure 5 to Figure 9, respectively. Based on command ECU run the Python script and activate respective devices. For example, a command with the subject ON CAMERA ALERT was sent to ECU to active PiCamera, capture image and it as Email alert if any Visitor at Door found.

    Figure 5: Working Experimental setup for ECU

    The SSH Client or Linux command used to run Python Script for activate and stop PiCamera is:

    $ python cameraalert.py

    $ pkill -9 cameraalert.py

    The SSH Client or Linux command used to run Python Script for lock and unlock Door is:

    $ python lockdoor.py

    $ python unlockdoor.py

    Figure 6 Screenshot of SSH Client on Smart Phone

    Figure 7 Screenshot of SSH client setup on Smart Phone

    SSH client is setup by knowing static IP address and Port. When we connect through SSH, we will be dropped into shell session, which is text based interface where we can interact with our server. For the duration of SSH session, any command that we type into local terminal are sent through an encrypted SSH tunnel and executed on server.

    We can also stream PiCamera video over internet by installing and configuring uv4I Linux Driver. Simply by identifying raspberry Pi IP address, on any internet browser we can login to view PiCamera Video stream

    Figure 8: Screenshot of Email alert on Smart Phone

    Figure 9: Screenshot of Email alert on Internet Browser

  8. CONCLUSION

This paper presents the design and the implementation of an interactive Smart home security system with Email alert, Web enabled video streaming and remote control of Voice alert and Door accessing system using Smart Phone. The Smart mobile Phone based monitor and automatic

control of equipment is forming a trend in automation field. Replacing

PC with low-cost single chip processor which can make administrators to get parameters of different remote devices and send control information to field equipments at any time through Internet.

REFERENCES

  1. Mrutyunjaya Sahani, Chiranjiv Nanda, Abhijeet Kumar Sahu and Biswajeet Pattnaik, Web-Based Online Embedded Door Access Control and Home Security System Based on Face Recognition 2015 International Conference on Circuit, Power and Computing Technologies [ICCPCT]

  2. R h y thm Haji,Arjun Trivedi, Hitarth Mehta ,Prof. A.B.Upadhyay Implementation of Web-Surveillance usingRaspberry Pi International Journal of Engineering Research & Technology (IJERT)

    Vol. 3 Issue 10, October- 2014, IJERT

  3. Jinsoo Han; Chang-Sic Choi; Ilwoo Lee, "More efficient home energy management system based on ZigBee communication and infrared remote controls," Consumer Electronics, IEEE Transactions on , vol.57, no.1, pp.85,89, February 2011.

  4. Erdem, H.; Uner, A., "A multi-channel remote controller for home andoffice appliances," Consumer Electronics, IEEE Transactions on, vol.55, no.4, pp.2184,2189, November 2009.

    Yuksekkaya, B.; Kayalar, A.A.; Tosun, M.B.; Ozcan, M.K.; Alkar, A.Z., "A GSM, internet and speech controlled wireless interactive home automation system," Consumer Electronics, IEEE Transactions on , vol.52, no.3, pp.837,843, Aug. 2006.

  5. Chia-Hung Lien; Ying-Wen Bai; Ming-Bo Lin, "Remote-Controllable Power Outlet System for Home Power Management," Consumer Electronics, IEEE Transactions on , vol.53, no.4, pp.1634,1641, Nov. 2007.

    Vernon, S.; Joshi, S.S., "BrainMuscleComputer Interface: Mobile- Phone Prototype Development and Testing," Information Technology in Biomedicine, IEEE Transactions on , vol.15, no.4, pp.531,538, July 2011.

  6. Faundez-Zanuy, M. Are inkless fingerprint sensors suitable for moile use? IEEE Aerospace and Electronic Systems Magazine, Vol. 19, No.4, pp. 17-21, April 2004.

  7. I.S. Jacobs and C.P. Bean, Fine particles, thin films and exchange anisotropy, in Magnetism, vol. III, G.T. Rado and H. Suhl, Eds. New York: Academic, 1963, pp. 271-350.

  8. K. Elissa, Title of paper if known, unpublished. R. Nicole, Title of paper with only first word capitalized, J. Name Stand. Abbrev., in press.

  9. Y. Yorozu, M. Hirano, K. Oka, and Y. Tagawa, Electron spectroscopy studies on magneto-optical media and plastic substrate interface, IEEE Transl. J. Magn. Japan, vol. 2, pp. 740-741, August 1987 [Digests 9th Annual Conf. Magnetics Japan, p. 301, 1982].

  10. M. Young, The Technical Writers Handbook. Mill Valley, CA: University Science, 1989.

  11. Raspberry Pi Official website [Online], Available: http://www.raspberrypi.org/

  12. Peter H.N. de and W. Lao, J. Han With, Automatic videobased humanmotion analyzer for consumer surveillance system, IEEE Trans Consum Electron, Vol. 55, No. 2, pp. 591-598, 2009.

  13. The Robot control using the wireless communication and the serial communication, by JONG HOON AHNN, Project Advisor: Professor Mark Campbell, Cornell University May 2007

  14. Pandurang H. Tarange, Rajan G. Mevekari, Prashant A. Shinde Web based Automatic Irrigation System usingwireless sensor network and Embedded Linux board 2015 International Conference on Circuit, Power and Computing Technologies [ICCPCT]

Leave a Reply