Computer College: Lecture Module
Computer College: Lecture Module
Microelectronics
Computer College
Effectivity:
2014 - 2015
Document
Reference:
DateIssued:
May 18,
2015
TITLE
CCTV Camera Using Raspberry Pi
OBJECTIVES
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:
LECTURE MODULE
Microelectronics
Computer College
Effectivity:
2014 - 2015
o
Document
Reference:
DateIssued:
May 18,
2015
Any standard USB keyboard and mouse will work with your
Raspberry Pi.
Power supply
Inexpensive webcam
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:
LECTURE MODULE
Microelectronics
Computer College
Effectivity:
2014 - 2015
Document
Reference:
DateIssued:
May 18,
2015
Reviewed by:
Approved by:
LECTURE MODULE
Microelectronics
Computer College
Effectivity:
2014 - 2015
Document
Reference:
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:
Reviewed by:
Approved by:
LECTURE MODULE
Microelectronics
Computer College
Effectivity:
2014 - 2015
Document
Reference:
DateIssued:
May 18,
2015
Prepared by:
Section AE
Reviewed by:
Approved by:
LECTURE MODULE
Microelectronics
Computer College
Effectivity:
2014 - 2015
Document
Reference:
DateIssued:
May 18,
2015
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:
LECTURE MODULE
Microelectronics
Computer College
Effectivity:
2014 - 2015
Document
Reference:
DateIssued:
May 18,
2015
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:
LECTURE MODULE
Microelectronics
Computer College
Effectivity:
2014 - 2015
1
2
3
4
5
6
7
Document
Reference:
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
Prepared by:
Section AE
Reviewed by:
Approved by:
LECTURE MODULE
Microelectronics
Computer College
Effectivity:
2014 - 2015
Document
Reference:
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
Prepared by:
Section AE
Reviewed by:
Approved by:
LECTURE MODULE
Microelectronics
Computer College
Effectivity:
2014 - 2015
2
Document
Reference:
DateIssued:
May 18,
2015
that
restricts
image
streaming
to
localhost,
only
Reviewed by:
Approved by:
10
LECTURE MODULE
Microelectronics
Computer College
Effectivity:
2014 - 2015
Document
Reference:
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.
Reviewed by:
Approved by:
11
LECTURE MODULE
Microelectronics
Computer College
Effectivity:
2014 - 2015
Document
Reference:
DateIssued:
May 18,
2015
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:
12