DIY Webcam Server or Home Security / Monitoring Setup Using BeagleBoard XM Running Ubuntu
Earlier I showed how you can use a BeagleBoard XM as a home file server as well as a DLNA server using Ubuntu headless server. It is now time to extend the setup to include Home Security / Monitoring capability using a cheap webcam and a webcam server software. This tutorial is not restricted to Beagleboard platform and can be implemented on a Raspberry pi or any computer running Ubuntu or similar Linux flavour. While Ubuntu offers multiple software options for serving webcam live streams, however the final choice was dictated by the fact that Arm version of Ubuntu doesn’t offer all packages. Here is how to go about doing it:
First, you need a Linux compatible Webcam that works with UVC driver, I bought a cheap $6 webcam from ebay which works well. If you want a good webcam then Logitech Quickcam Pro 9000 works very well. If you have any other cam then test whether it works by hooking it to a Linux box and launching Cheese (you may have to install it by doing: sudo apt-get install cheese), if you can see video from the webcam then you are ready to proceed to next step.
Install motion by doing:
sudo apt-get install motion
Motion is a very capable software which can be used as for a variety of stuff:
- Motion detection – record video/and or frames if there is motion.
- Snapshot intervals – take time interval snapshots regardless of motion detection.
- Live video IP stream in mjpeg format (only this feature is used in current setup).
- Specify recorded video to be saved in your choice mpeg, avi, flv, swf format.
- When motion exists, have frames and videos draw a box around the specific motion for more obvious recognition of subtle movements.
- Easily send all data through FTP / SFTP etc. to a backup server in a variety of ways.
Since my interest is currently only in setting up a live video stream, I would focus on setting up the configuration file for the same.
The headless Ubuntu server running on my BeagleBoard XM doesn’t allow access of /dev/video0 (webcam) without root permission, therefore I had to add my user name to group video by doing the following (I am assuming that you have already sshed in to your headless server or are sitting locally on your target machine):
sudo usermod -a -G video my_user_name
This allows us to run motion as a regular user. Now create a directory .motion in your home directory (i.e. /home/my_user_name):
Now inside that directory create a file motion.conf by pasting the following content in it:
followed by pasting the following content
text_right=%d %b %Y\n%k:%M:%S
If you want to know the details of what each of the entries mean (some of them are obvious) then you should take a look at the global configuration file for motion by typing this:
sudo less /etc/motion/motion.conf
The above configuration file runs motion as a daemon (run as a background process without need of a terminal). input=8 stands for USB type device used for capture, framerate specifies the rate at which the frames are acquired from the webcam (15 worked well for me). Settings output_all=off, output_motion=off, output_normal=off implies that I have disabled the frame capture in event of motion or at periodic intervals. You may enable it if you want to log the video frames.
Now you launch motion by typing
If all went well you would see the message
 Processing thread 0 – config file /home/abhish/.motion/motion.conf
 Motion 3.2.12 Started
 Motion going to daemon mode
Point a browser to http://ip-of-webcam-server:8080 to see the live video feed. You can also use iOS or Android Apps to see the video feed over your Home LAN. Since right now there is no security feature enabled I would not advise you to do port forward and all to enable viewing from outside your home LAN.
You might also like
|Install DLNA Server On Ubuntu File Server While there...||How to View your Webcam on iPod Touch / iPhone / iPad If you have...||BeagleBoard XM Powered File Server Using Ubuntu Single Board...||How To Make Ubuntu A perfect Mac File Server and Time Machine Volume There is...|