DIY Webcam Server or Home Security / Monitoring Setup Using BeagleBoard XM Running Ubuntu

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

quickcamEarlier 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):

mkdir .motion

Now inside that directory create a file motion.conf by pasting the following content in it:

nano motion.conf

followed by pasting the following content

daemon=on
norm=3
input=8
auto_brightness=on
framerate=15
height=288width=352
jpeg_filename=motion/%Y%m%d/%v-%H%M%S-%q
noise_tune=off
output_all=off
output_motion=off
output_normal=off
quality=75
snapshot_interval=0
target_dir=/home/my_user_name/capture
text_left=(c) Abhi
text_right=%d %b %Y\n%k:%M:%S
threshold=500
v4l2_palette=6
videodevice=/dev/video0
webcam_localhost=off
webcam_maxrate=100
webcam_port=8080
webcam_quality=85

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

motion

If all went well you would see the message

[0] Processing thread 0 – config file /home/abhish/.motion/motion.conf
[0] Motion 3.2.12 Started
[0] 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...

About the Author

has written 346 posts on this blog.

Meditating towards his "nerdvana", lifehacker is a teacher by the day and a nerdy blogger by the night. He lives to learn and yearns to learn living.

2 Comments on “DIY Webcam Server or Home Security / Monitoring Setup Using BeagleBoard XM Running Ubuntu”

  • Tafo627 wrote on 18 November, 2017, 10:50

    I apreciate your aport a lot!! Thank you so much for share this, this really works for me!!!

    Like or Dislike: Thumb up 0 Thumb down 0

    [Reply]

    Tafo627 Reply:

    @Tafo627,

    So how can I stop the service, cause I’ve tried using sudo /etc/init.d/motion stop; sudo service motion stop, and motion stop; but it keeps streaming, I need to stop and run everytime is because I wanna know how you can you do it, thank you!!

    Like or Dislike: Thumb up 0 Thumb down 0

    [Reply]

Write a Comment

Gravatars are small images that can show your personality. You can get your gravatar for free today!

*

Copyright © 2017 Hack Your Life!. All rights reserved.
Proudly powered by WordPress. Developed by Deluxe Themes