Tuesday, September 23, 2014

Rasperry Pi security.

(Article from instructables.com with author's permission).

Security is becoming more and more important to people. So they are used in protecting property. Actually the are other reasons. Set up security cameras in the testing lab at the school where I use to work to aid in keeping students from cheating.

Most people want to be able to use a computer to fill that need without spending zillions of dollars on a special system. We use a Raspberry Pi plus an inexpensive web cam to do just that. There are two major software packages for linux to set up video security and they are Zoneminder and Motion. Like Motion because of the smaller footprint. That makes for better performance on embedded devices such as the Raspberry Pi. . Since the video is internet based, you can watch it from virtually anywhere you can connect to the system. More information on Zoneminder at: http://www.instructables.com/id/Computerized-video-security-setup/

Here is a quickie setup we did for the Raspberry Pi.


It is wonderful that the Raspberry Pi (aka RPi)  is supported by Debian linux. There already so much software for Debian that the Raspberry Pi can take advantage of. One such piece of software is Motion. Motion is a security cam server software than does not require a gui, That is you can run Motion without a gui installed or activated on the Raspberry Pi.  One caveat is that you will want a disk drive with a lot of space to hold all the pictures. The sd card is just not enough.

Let's get your system up to date (might take a while if you have not updated very recently).

$ sudo apt-get update ; sudo apt-get upgrade
$ sudo apt-get dist-upgrade

Now let's install Motion

$ sudo apt-get install motion.

Does the RPi see your camera?  (aka list usb devices attached.)

$ lsusb

...
Bus 001 Device 004: ID 046d:08a9 Logitech, Inc. Notebook Deluxe
...

if not, you may need to get a more mainstream camera. usually Logitech sets the standard. I just used a cheap refurbished knockoff. Your output will vary..

Do a little configuration:


$ sudo nano /etc/motion/motion.conf
In here there are a few basic changes that you need to perform:
  • Daemon = OFF to ON
  • webcam_localhost = ON to OFF
You can change other settings but it’s recommend you don’t take more than 2 frames, and you been the default frame pixel size, for stability.

To ensure that the motion service will actually start as a daemon we need to change another configuration setting, so enter the following:

sudo nano /etc/default/motion

Then change the value “start_motion_daemon=no” to “yes”


Let's get started:

Finally you can start the motion service to stream the web cam images

sudo service motion start


Then after about 30 seconds browse to the new web interface, which should be at the below URL (where 192.168.0.100 is your Raspberry PI’s IP address yours may vary)

http://192.168.0.100:8081

Hint: if you do not have direct access to your RPi, you can use http://www.instructables.com/id/Red-October-network-discovery/ to find it on the network Frequently I will hook up the RPi to the network without a keyboard, mouse, or monitor and then remote into the unit,

for more information see: http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome


Note if you want to use an ipcamera it is easy but you have to know about the camera. I ended up going to the Zoneminder wiki and found the answer for my camera. Setup is the same, but you have to add two lines to motion.conf.

 netcam_url http://19.168.10.85/videostreamlocationsomekindof.cgi
 netcam_userpass user:password

For us  it was:

 netcam_url http://192.168.10.85/video.cgi
 netcam_userpass user:password

No comments:

Post a Comment