Old PC Accessories + Raspberry PI = DoorCam & surveillance Kit

Step 1: You will need

  • Raspberry PI B (this project is based on B+ model)
  • 5V Raspberry PI power supply
  • A couple of PC speakers
  • TV/Monitor with composite input and its power supply
  • 3.5mm jack to RCA A/V cable
  • Compatible webcam (see at: http://elinux.org/RPi_USB_Webcams)
  • Three female/female jumpers
  • Relay 1 channel 5V PIC ARM AVR DSP

To make something easy, my webcam is conencted directly to Raspberry PI usb port. To do this i have simply drilled the wall. Everything is connected directly to the LAN network to contain costs.

Old PC Accessories + Raspberry PI = DoorCam & surveillance Kit

Step 2: How it works

My first need was to check who is outside my home door. To do this Raspberry PI has been programmed as follow:

at a motion detection in webcam area

  • turn on monitor for 40″
  • send email with snapshot & public IP URL
  • send email with timelapse video & public IP URL(*)
  • sound alert

obviously, snapshot and video are chronological order stored in your gmail messages.

when my public IP changes, system sends an email with updated IP.

(*) on IOS mobile devices video file can be played with Ace Player app.

Step 3: Initial settings & packages installation

Initial settings

Create two GMAIL accounts, one for store jpeg files and one for mjpeg files.

On your RPI enable access directly to graphical interface:

$ sudo raspi-config

choose option:

Desktop Log in as user ‘pi’ at the graphical desktop

Then reboot.

Install sendEmail

Download sendEmail tar file:

$ wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz

extract it:

$ tar -zxvf sendEmail-v1.56.tar.gz

copy to correct path:

$ sudo cp -a sendEmail-v1.56/sendEmail /usr/local/bin

make it executable

$ chmod +x /usr/local/bin/sendEmail

Install TLS support for Gmail

$ sudo apt-get install libnet-ssleay-perl libio-socket-ssl-perl

after installing, change it as follow:

$ sudo nano /usr/share/perl5/IO/Socket/SSL.pm

with CTRL-W find the line with this argument:


and change it to:


save and exit

try to send an email with the command line:

$ sendEmail -f [email protected] -t [email protected] -u "OBJECT" -m "MESSAGE TEXT" -xu [email protected] -xp YOURPASSWORD -o tls=yes -s smtp.gmail.com:587

Install Chromium Browser

$ sudo apt-get install chromium-browser

set now Chromium browser autostart kiosk mode:

$ sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

(if you haven’t NOOBS : sudo nano /etc/xdg/lxsession/LXDE/autostart)

#@lxpanel –profile LXDE

#@pcmanfm –desktop –profile LXDE

#@xscreensaver -no-splash

# auto run the browser

@xset s off@xset -dpms

@xset s noblank

@chromium –kiosk –enable-kiosk-mode –enabled –touch-events –touch-events-ui –disable-ipv6 –allow-file-access-from-files –disable-java –disable-restore-session-state –disable-sync –disable-translate –disk-cache-size=1 –media-cache-size=1 http://localhost:YOURWEBCAMPORT

now reboot

Install MP3 PLAYER

$ sudo apt-get install mpg123

Install Motion

$ sudo apt-get install motion

modify configuration file:

$ sudo nano /etc/motion/motion.conf

Basically, i’ve changed these options:

#start as

daemon on

# Rotate image

rotate 90 (my webcam is 270° rotated)

# Image width

width 640 (check your webcam resolution)

# Image height

height 480 (check your webcam resolution)

# Maximum number of frames

framerate 2

# Threshold

threshold 15000

# Picture frames must contain motion

minimum_motion_frames 2

# Specifies the number of pre-captured

pre_capture 5

# Codec to used by ffmpeg for the video compression

ffmpeg_video_codec mpeg4

# The mini-http server listens

webcam_port 8080 (selected your preferred port)

# TCP/IP port for the http server to listen on

control_port 8081 (select different port by webcam port)

# Restrict webcam connections to localhost only

webcam_localhost off

# Command to be executed when an event starts.

on_event_start mpg123 -m –gain 70 /home/pi/testsound.mp3 ;

# Command to be executed when a picture (.ppm|.jpg) is saved (default: none)

on_picture_save sendEmail -f [email protected] -t [email protected] -u “Motion detected!” -m “http://”`curl -s checkip.dyndns.org|sed -e ‘s/.*Current IP Address: //’ -e ‘s/<.*$//’`”:8080″ -xu [email protected] -xp YOURGMAILPSSWD -o tls=yes -s smtp.gmail.com:587 -a %f

# Command to be executed when a movie file (.mpg|.avi) is created.

on_movie_start sendEmail -f [email protected] -t [email protected] -u “Motion timelapse” -m “http://”`curl -s checkip.dyndns.org|sed -e ‘s/.*Current IP Address: //’ -e ‘s/<.*$//’`”:8080″ -xu [email protected] -xp YOURGMAILPSSWD -o tls=yes -s smtp.gmail.com:587 -a %f

Old PC Accessories + Raspberry PI = DoorCam & surveillance Kit

Final settings

add following lines at rc.local file:

$ sudo nano /etc/rc.local

before “exit” add:

sudo mkdir /var/run/motion

sudo chmod a+rwxt /var/run/motion

sudo motion

sleep 60

save and exit

create now a script that check if public IP has been changed

$ nano ipchangecheck.sh

add this script:



CURRENT_IP=$(curl -s checkip.dyndns.org | sed -e ‘s/.*Current IP Address: //’ -e ‘s/<.*$//’)

if [ -f $IPFILE ]; then





if [ “$CURRENT_IP” != “$KNOWN_IP” ]; then


sendEmail -f [email protected] -t [email protected] -u “your IP is changed!” -m $CURRENT_IP -xu [email protected] -xp YOURGMAILPASSWORD -o tls=yes -s smtp.gmail.com

save and exit

$ chmod 700 ipchangecheck.sh

if you want to check every five minutes:

$ sudo nano /etc/crontab

*/5 * * * * pi bash /home/pi/ipchangecheck.sh

save and exit


For more detail: Old PC Accessories + Raspberry PI = DoorCam & surveillance Kit

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

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

Scroll to Top