Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
53 views

Computer College: Lecture Module

This document provides instructions for building a CCTV camera using a Raspberry Pi. It outlines the necessary materials, which include a Raspberry Pi, SD card, display cables, keyboard, mouse, power supply, webcam, and wireless adapter. It then describes the steps to set up the NOOBS operating system on the SD card, update the software and firmware, install the Motion application, configure Motion, and set permissions to allow remote access to the webcam stream over the Internet. The overall goal is to design and construct a wireless CCTV security camera using a Raspberry Pi that can be accessed through a web browser from any location.

Uploaded by

aprilynromero
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Computer College: Lecture Module

This document provides instructions for building a CCTV camera using a Raspberry Pi. It outlines the necessary materials, which include a Raspberry Pi, SD card, display cables, keyboard, mouse, power supply, webcam, and wireless adapter. It then describes the steps to set up the NOOBS operating system on the SD card, update the software and firmware, install the Motion application, configure Motion, and set permissions to allow remote access to the webcam stream over the Internet. The overall goal is to design and construct a wireless CCTV security camera using a Raspberry Pi that can be accessed through a web browser from any location.

Uploaded by

aprilynromero
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

LECTURE MODULE

Microelectronics

Computer College
Effectivity:

2014 - 2015

Document
Reference:

Revision No: 1 IssueNo: 1

DateIssued:

May 18,
2015

TITLE
CCTV Camera Using Raspberry Pi

OBJECTIVES

To design and construct a CCTV Camera using Raspberry Pi that can


access through the Internet browser.

INTRODUCTION
The Raspberry Pi is a low cost, credit-card sized computer that plugs
into a computer monitor or TV, and uses a standard keyboard and mouse.
It is a capable little device that enables people of all ages to explore
computing, and to learn how to program in languages like Scratch and
Python. Its capable of doing everything youd expect a desktop computer
to do, from browsing the internet and playing high-definition video, to
making spreadsheets, word-processing, and playing games.

MATERIALS NEEDED

Raspberry Pi

SD Card

Prepared by:
Section AE

Reviewed by:

Approved by:

Engr. Michelle P. Pullon

LECTURE MODULE
Microelectronics

Computer College
Effectivity:

2014 - 2015
o

Document
Reference:

Revision No: 1 IssueNo: 1

DateIssued:

May 18,
2015

We recommend an 8GB class 4 SD card.

Display and connectivity cables

Any HDMI/DVI monitor or TV should work as a display for the


Pi. For best results, use one with HDMI input, but other
connections are available for older devices. Use a standard
Ethernet cable for internet access.

Keyboard and mouse

Any standard USB keyboard and mouse will work with your
Raspberry Pi.

Power supply

Use a 5V micro USB power supply to power your Raspberry Pi.


Be careful that whatever power supply you use outputs at
least 5V; insufficient power will cause your Pi to behave in
strange ways.

Inexpensive webcam

Router or a wireless Wi-Fi module

PROCEDURES
1. First, you must download the NOOBS image from the Raspberry Pi

website.
There are a couple different options for download:
NOOBS (offline installer)
o Torrent
o Compressed ZIP

Prepared by:
Section AE

Reviewed by:

Approved by:

Engr. Michelle P. Pullon

LECTURE MODULE
Microelectronics

Computer College
Effectivity:

2014 - 2015

Document
Reference:

Revision No: 1 IssueNo: 1

DateIssued:

May 18,
2015

NOOBS LITE (online installer)


o Torrent
o Compressed ZIP
The offline installer is significantly larger than the LITE
version, but comes with the ability to reinstall the Raspbian
operating system without a network connection. This is because the
actual OS image is saved onto the SD card when you install NOOBS
for the first time. However, over time the OS image that is included
in the NOOBS installation may become outdated unless you have a
network connection, in which case the newer OS version will be
downloaded and installed.
NOOBS LITE is significantly smaller in size, but requires a
network connection to install the OS images. Both the regular NOOBS
and NOOBS LITE installers allow for installing from a network.
Once youve downloaded the version of NOOBS you prefer
(either the regular version or LITE), then you can simply extract the
ZIP file.

2. Formatting Your SD Card


Before you can actually place NOOBS onto your SD card, you
Prepared by:
Section AE

Reviewed by:

Approved by:

Engr. Michelle P. Pullon

LECTURE MODULE
Microelectronics

Computer College
Effectivity:

2014 - 2015

Document
Reference:

Revision No: 1 IssueNo: 1

DateIssued:

May 18,
2015

must format it. Note, formatting the card erases all data on it.
3. Copying NOOBS
Once you have a formatted FAT SD card, you can simply copy
the files for NOOBS that you extracted earlier. A simple copy and
paste is all that is needed. It might take a while to copy the regular
version of NOOBS due to the slow speed of SD cards, but once its
done you can eject the card from your computer and insert it into
your Raspberry Pi.
4. Using NOOBS
Installing an OS
Before you plug your Raspberry Pi into the power cable, attach
a USB keyboard and mouse so that you can navigate the NOOBS
interface. Once you have the keyboard and mouse plugged in, you
can turn on the power to your Raspberry Pi and you should be
greeted with a screen similar to the following:

This is the operating system installation screen, and allows


you to choose one or more OS images to install onto your SD card.
Notice the icons on the right hand side those OS images with a
Prepared by:
Section AE

Reviewed by:

Approved by:

Engr. Michelle P. Pullon

LECTURE MODULE
Microelectronics

Computer College
Effectivity:

2014 - 2015

Document
Reference:

Revision No: 1 IssueNo: 1

DateIssued:

May 18,
2015

picture of an SD card are already included with your NOOBS


installation, while those with an Ethernet symbol can be downloaded
over a network.
Simply check the boxes next to the OS images you wish to install,
and hit the install button in the toolbar at the top of the window.
5. Boot Selection
Once youve installed one or more operating systems with NOOBS,
rebooting your Raspberry Pi will result in one of two things happening
automatically:

If you have a single OS installed, it will boot automatically

If you have more than one OS installed, a boot selector will be


displayed

Prepared by:
Section AE

Reviewed by:

Approved by:

Engr. Michelle P. Pullon

LECTURE MODULE
Microelectronics

Computer College
Effectivity:

2014 - 2015

Document
Reference:

Revision No: 1 IssueNo: 1

DateIssued:

May 18,
2015

To get back to the OS installation screen, simply hold the


shift key on your keyboard as you turn on your Raspberry Pi.
There are many posts on the Internet, demonstrating how to
build a Raspberry Pi-powered camera system. One of the more
frequently

used

off-the-shelf

applications

for

these

projects is Motion.
Motion has the ability to stream images from a webcam and
server them from it is built-in web server, with little or no
configuration. In addition, Motion is easily configured to work with
streaming video applications like the very popular FFmpeg, and save
Prepared by:
Section AE

Reviewed by:

Approved by:

Engr. Michelle P. Pullon

LECTURE MODULE
Microelectronics

Computer College
Effectivity:

2014 - 2015

Document
Reference:

Revision No: 1 IssueNo: 1

DateIssued:

May 18,
2015

images to databases like mySQL or PostgreSQL. Motion can also


execute external scripts such as python or shell.
6. Firmware Update
Before installing Motion, the researchers recommend ensuring
your Raspberry Pi is up-to-date with the latest software and
firmware. Updating firmware is not necessary. The researchers
updated the firmware on the Raspberry Pi. It fixed the problem.
Installing firmware can sound a bit intimidating. However, Liam
McLoughlin (hexxeh) has made the process easy with rpi-update.
7. Software Update
The researchers also update your Raspberry Pis existing software.
To update the Raspberry Pis software, execute the following aptget commands:
1

sudo apt-get update && sudo apt-get upgrade

If you dont do this on a regular basis, as recommended, these


could take up to several minutes. Watch for errors. If there are
any errors, try to run the command again. Sometimes the
Raspberry Pi cannot connect to all code repositories for updates.
8. Installing Motion
Once the updates are complete, install Motion by issuing the
following command:
1

sudo apt-get install motion

9. Enabling Motion
As the installation completes, you should see a warning in the
command shell about Motion being disabled by default.
Prepared by:
Section AE

Reviewed by:

Approved by:

Engr. Michelle P. Pullon

LECTURE MODULE
Microelectronics

Computer College
Effectivity:

2014 - 2015
1
2
3
4
5
6
7

Document
Reference:

Revision No: 1 IssueNo: 1

DateIssued:

May 18,
2015

...
Adding user `motion' to group `video' ...
Adding user motion to group video
Done.
[warn] Not starting motion daemon, disabled via /etc/default/motion ...
(warning).
Setting up ffmpeg (6:0.8.4-1) ...
pi@garyrasppi ~ $

To

enable

Motion

(the

motion

daemon),

we

need

to

edit

the /etc/default/motion file.

sudo nano /etc/default/motion

Change the start_motion_daemon parameter to yes.

Prepared by:
Section AE

Reviewed by:

Approved by:

Engr. Michelle P. Pullon

LECTURE MODULE
Microelectronics

Computer College
Effectivity:

2014 - 2015

Document
Reference:

Revision No: 1 IssueNo: 1

DateIssued:

May 18,
2015

10.
Configuring Motion
Motion is easy to customize with loads of parameters you can tweak
based on your needs. Motion has no GUI. All configurations are all
done through Motions configuration file (/etc/motion/motion.conf).
Before editing the configuration file, we need to change the
permissions on it, so Motion can get access to it. While we are at it,
we will also change permissions on the folder where Motion stores
captured images.
1

sudo chmod -R 777 /etc/motion/motion.conf

Prepared by:
Section AE

Reviewed by:

Approved by:

Engr. Michelle P. Pullon

LECTURE MODULE
Microelectronics

Computer College
Effectivity:

2014 - 2015
2

Document
Reference:

Revision No: 1 IssueNo: 1

DateIssued:

May 18,
2015

sudo chmod -R 777 /tmp/motion

After changing the permissions, to configure Motion, open the


Motions configuration file in a text editor, as root (sudo). The
configuration file can be opened in Nano with the following
command:
1

sudo nano /etc/motion/motion.conf

Motions configuration file is lengthy. However, it is broken down into


logical sections, making finding the setting you are looking for, easy.
First, we need to change the Live Webcam Server section of
configuration. Below are the default settings:

The first thing you will want to change is Motions default


setting

that

restricts

image

streaming

to

localhost,

only

( webcam_localhost on). This means you can only view images in a


Prepared by:
Section AE

Reviewed by:

Approved by:

Engr. Michelle P. Pullon

10

LECTURE MODULE
Microelectronics

Computer College
Effectivity:

2014 - 2015

Document
Reference:

Revision No: 1 IssueNo: 1

DateIssued:

May 18,
2015

web browser on the Raspberry Pi, not remotely over your network.
Change that line of code to read webcam_localhost off.
The next setting we recommend changing for security
purposes is the default port Motions web server uses to stream
images, 8081. Security through obscurity is better than no security
at all. Change port 8081 to a different arbitrary port, for example,
6789 (webcam_port 6789). Just make sure you dont pick a
port already in use by another service or application. Having made
this change, if your Raspberry Pis local IP address is 192.168.1.9,
images from the webcam should be accessible at 192.168.1.9:6789.
The other two settings in this section you can play with are the
webcam quality and maximum frame-rate. You will have to adjust
this based on your network speed and the processing power of your
Raspberry Pi. The default settings are a good place to start.
Speaking of quality, the other two settings you may want to
change are the width and height of the image being captured by
Motion. The Capture device options section is where we change
these settings. As the configurations comments suggest, these
settings are dependent on your camera. Check the cameras
available image sizes; you will need to use one of those size
combinations. I have mine set to an average size of 352 x 288. This
is a good size for those of us with a slower network, or when
streaming

video

over

the

Internet

to

mobile

web

browser.

Conversely, a larger image is better for viewing over your local


network.
Prepared by:
Section AE

Reviewed by:

Approved by:

Engr. Michelle P. Pullon

11

LECTURE MODULE
Microelectronics

Computer College
Effectivity:

2014 - 2015

Document
Reference:

Revision No: 1 IssueNo: 1

DateIssued:

May 18,
2015

Image size, like compression quality, and frame-rate are


dependent on processing power of your Raspberry Pi and its OS
(Raspbian, Debian, Arch, etc.). You may need to play with these
settings to get the desired results.
1
2
3
4
5

# Image width (pixels). Valid range: Camera dependent, default: 352


width 352
# Image height (pixels). Valid range: Camera dependent, default: 288
height 288

Its important to remember, each time you make changes to Motions


configuration file, you must restart Motion, using the following command.
1

sudo /etc/init.d/motion restart

11.
Viewing the Webcam
To view the webcams output from another device on your local
network, point your web browser to the IP address of your Raspberry
Pi, and add the port you assigned in Motions configuration file.
Motion may take up to 15-20 seconds to start responding in the
browser. If it takes longer, you probably have your image size, framerate, and compression settings to high for your Raspberry Pi.
12.
Over the Internet
Enabling your webcams output over the Internet is relatively easy
with the average home router and Internet service provider.

Prepared by:
Section AE

Reviewed by:

Approved by:

Engr. Michelle P. Pullon

12

You might also like