Home Live Security (Linux Based)

Published on June 2016 | Categories: Types, Research | Downloads: 24 | Comments: 0 | Views: 437
of 7
Download PDF   Embed   Report

Comments

Content

Home Live Security
By Sandip Nair [email protected] sandipnair.hpage.com

Application: A simple and economical home security system.

Block diagram: -

Principle: The whole idea has been implemented in linux (Ubuntu). The computer should be connected to internet. A webcam, speaker and microphone are to be fixed on the door at a particular orientation for optimized performance. The basic working of the design is that, when a person rings the bell, his/her image will be captured using webcam. An audio will be played in the speaker which would ask the individual to spell out his/her name. The voice from the individual will be recorded using the microphone. After this a sms will be sent to the owner's cell phone and the respective image and the audio file will be sent to the specified email id.

Software requirements: 1. 2. 3. 4. 5. ubuntu (operating system) mplayer (to play the audio) arecord (to record the audio) streamer (to capture the image) xdotool (controls the keyboard short cut from command)thunderbird (mail client) 6. Indiatimes mail on mobile service (for reliance and tata connection) http://email.indiatimes.com/

Hardware requirements: 1. Usb webcam (I used Logitech) 2. USB cable 3. monostable circuit – resistor(91k , 1k x3) , capacitor(100uf, 0.01uf), diode, LED, relay, 555 ic, BC548 x 2, switch (for bell). 4. Pushbutton switch( used as calling bell)

Circuit diagram: -

Flow chart: -

Working: The program is written in perl and shell script. The programme was tested in ubuntu 9.10. The hardware is a simple circuitry which when activated connects the usb webcam with the operating system for 10 seconds as set by the time constant of monostable multivibrator (t = 1.1*R*C). The loop.pl programme should run continuously which would check if the webcam is connected or not. Using the vendor id, “Logitech” in this case, the webcam is detected. According to the programme written, when a person rings the bell (which is the switch for triggering the monostable circuit), the webcam gets connected to the system. As soon as it is detected, the programme control moves inside the “if condition”. Here it starts executing the following list of programmes sequentially: Webcam.pl – it acquires image from the webcam using streamer tool. Listen.pl – plays the audio instruction to the listener using mplayer tool. Record.pl – records the audio from the listener using arecord tool. Sms.send.sh – for this program to be executed, one should have an email id in indiatimes, and should have registered for receiving mail through sms service using reliance mobile or tata connection. In this program a mail is sent to the indiatimes account, using thunderbird tool, which then sends a sms to the respective number. Mail_pic.sh – a mail is sent to an email id using thunderbird tool with the picture taken as attachment. Mail_ audio.sh – a mail is sent to an email id using thunderbird tool with the recorded audio as attachment.

Programme: webcam.pl ->
#!/usr/bin/perl use strict; use warnings; open FILE, "date.txt" or die $!; my $date = <FILE>; chop($date); print "\nhi\n$date"; system ("sudo streamer -c /dev/video1 -b 16 -o /home/sandipnair/Documents/photos/image_$date.jpeg"); close FILE; listen.pl -> #!/usr/bin/perl use strict; use warnings;

system ("sudo mplayer attention.wav"); record.pl -> #!/usr/bin/perl use strict; use warnings; open FILE, "date.txt" or die $!; my $date = <FILE>; chop($date); system ("sudo arecord -f CD -d 5 -D hw:0,0 /home/sandipnair/Documents/audios/audio_$date.wav"); sms_send.sh -> #!/bin/bash -x thunderbird -compose & sleep 5; xdotool type '[email protected]'; sleep 1; xdotool key Tab; sleep 1; xdotool type 'somebody is at the door'; sleep 1; xdotool key Tab; sleep 1; xdotool type 'check your mail'; sleep 1; xdotool key Ctrl+Return; mail_pic.sh -> #!/bin/bash -x while read myline do echo $myline date=$myline done < date.txt thunderbird -compose "attachment=file:///home/sandipnair/Documents/photos/image_$date.jpeg"& sleep 5; xdotool type '[email protected]'; #sleep 1; xdotool key Tab; #sleep 1; xdotool type 'somebody is at the door'; #sleep 1; xdotool key Tab; #sleep 1; xdotool type 'this is the picture'; sleep 1; xdotool key Ctrl+Return; mail_audio.sh -> #!/bin/bash -x while read myline do

echo $myline date=$myline done < date.txt thunderbird -compose "attachment=file:///home/sandipnair/Documents/audios/audio_$date.wav"& sleep 5; xdotool type '[email protected]'; #sleep 1; xdotool key Tab; #sleep 1; xdotool type 'somebody is at the door'; #sleep 1; xdotool key Tab; #sleep 1; xdotool type 'this is the audio'; sleep 1; xdotool key Ctrl+Return; loop.pl -> #!/usr/bin/perl use strict; use warnings; my $i=0; while($i == 0) { system "lsusb |sudo tee usblist.txt"; open FILE, "usblist.txt" or die $!; my $line; my $count; my $count2=0; open FILE, "usblist.txt" or die $!; while ($line = <FILE>) { my @word = split(/ /, $line); $count = grep(/^Logitech/, @word); if($count==1) {$count2=1;} } close FILE; if ($count2 ==1) { my $date = localtime time; my @date2 = split(/ /, $date); $date = "$date2[4]_$date2[0]_$date2[1]_$date2[3]_$date2[5]"; system "echo $date | sudo tee date.txt"; system "./webcam.pl"; system "./listen.pl"; system "./record.pl"; system "./sms_send.sh"; sleep 10; system "./mail_pic.sh"; sleep 20; system "./mail_audio.sh";

} }

Note: Thunderbird has to be configured before running this application. Registering for the indiatimes mail on mobile service, fixed charges are applied. Values for sleep command can be changed to achieve an optimised performance. Each usb device connected to a computer will have a vendor id and product id which distinguishes itself from the other devices.

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close