Raspberry Pi: How To Build A Surveillance System 1

Raspberry Pi: How To Build A Surveillance System 1

ENTERPRISE54 – The ‘Raspberry Pi How To’ series (#RPiHowTo) is a regular series which covers a number of projects that can be built using the Raspberry Pi. To kickstart our series we’ll be working on a home surveillance system. This project was first demoed at the December Raspberry Jam and is relatively easy to set up.

ENTERPRISE54 – The ‘Raspberry Pi How To’ series (#RPiHowTo) is a regular series which covers a number of projects that can be built using the Raspberry Pi.

To kickstart our series we’ll be working on a home surveillance system. This project was first demoed at the December Raspberry Jam and is relatively easy to set up. To get started let’s go through the project requirements listed below.

Components:
This describes a checklist of things (accessories etc) required to get your project working – in addition to your Raspberry Pi of course!

For this project we’ll be needing:
– A Raspberry Pi Model B
– A USB WebCam – for this we’re using the Microsoft HD LifeCam
– WiFi Dongle or Ethernet Cable for LAN connection

Difficulty: Beginner
We’ll cover projects that have different levels of difficulty ranging from beginner, intermediate and advanced projects.

Project Duration: 1-2 hours

Getting Started
Step 1: Upgrade and update.

If you haven’t used your RPi in a while or at all, you’ll need to first update your raspbian image as well as your packages. To do this run the following commands, the first set of commands update your raspbian image, while the next set update your packages.

sudo apt-get install rpi-upgrade
sudo apt-get install rpi-update

sudo apt-get upgrade
sudo apt-get update

Step 2: Install Motion
We’ll need to install motion which enables us to detect movement captured by our webcam.
Motion also comes with configuration options to allow us to perform different actions based on our webcam feed, we’ll be exploring some of these options in subsequent posts. To set up motion run the following command in your LX Terminal:

sudo apt-get install motion

Connect your USB webcam and run the lsusb command. Your webcam should be listed alongside all the other USB components you may have plugged in (keyboard, mouse, wifi dongle etc).

Step 3: Setting up your connection
You can either connect your RPi to a local network or your WiFi network.

Step 4: Configure Your Settings
The next step is to configure your motion settings. We’ll start with the motion.conf file.

sudo nano /etc/motion/motion.conf

This opens up the motion file in the nano editor. Make the following changes to the configuration file:

-Change Daemon from off to on – to run motion as a background process
-Change webcam_localhost from off to on – to ensure you can view the stream from a different computer

Step 5: Run Motion
Now we’re set to run motion. To do this, type:

sudo service motion start

You can then navigate to your IP address to view the webcam feed. You can find out your IP address by running the ifconfig command in your LXTerminal. If you’re connecting to the local network via an ethernet cable pay attention to the etho information. If you’re connecting over a WiFi network pay attention to the wlano details.

You’ll need to add 8081 in front of your IP address, as this is the default port for streaming, for example  http://xxx.xx.x.xxx:8081

Step 6: Access remotely
You can also view the feed from your own computer. Just make sure your RPi and computer are on the same network. Simply access the IP address of your PI from your computer web browser. You should be able to do some fun stuff with

Now you’ve successfully set up a useful but simple project. Over the next two weeks we’ll be building on this project to make it do more fun stuff.

Extra Tips
You can also ssh into your Raspberry Pi and work on your Pi remotely. This means that you can gain access to your Pi from your computer. If you’re a Mac user open up your terminal and type ssh [email protected] where 172.30.0.21 is the IP address of your Raspberry Pi.

Troubleshooting
Common things that might go wrong with this project include:
-Connecting your USB Webcam directly to your Pi. You’ll need to first connect to your Pi Hub to ensure your webcam has enough power.
-Make sure your RPi and laptop are connected to the same network (LAN or WLAN) so that you can access your webcam feed remotely.

This project was built at our MXLab. If you would like to have your project featured send an email to mxlab[at]cchubnigeria.com. Don’t own a Raspberry Pi but would like to build this project? Purchase one today.

Were you able to successfully set up this project? Did you have any issues setting up? Let us know in the comments below.

 

Editor’s Note: This piece first appeared on Co-creation Hub mxlab blog.

1 comment
Contributor
CONTRIBUTOR
PROFILE

Posts Carousel

Leave a Comment

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

1 Comment

  • work in africa
    November 22, 2015, 12:05 pm

    I just like the helpful info you supply in your articles.
    I’ll bookmark your blog and test again right here frequently.

    I am moderately certain I will learn plenty of new stuff right here!
    Best of luck for the next!

    REPLY

Latest Posts

Top Authors

Most Commented

Featured Videos