Archive for the ‘DIY’ Category

Fix Mom and Dad’s computer from the comfort of your own home

Thursday, August 21st, 2008

I’ve done technical support for years now and most often have to get someone to be my remote eyes and hands. This can become exceedingly difficult when dealing with someone who’s less versed in the nuances of computer use than I’d like. One of the tools I’ve found that makes this a lot easier to deal with is remote desktop (or remote terminal services). This allows you to see the desktop of whomever you’re troubleshooting with. Now most of the time this involves setting up some sort of remote desktop server on the persons computer and you knowing what their IP address is (Very difficult if it’s dynamic). I know this almost sounds like more trouble. But there is a solution.

(more…)

If you enjoyed this post, make sure you subscribe to my RSS feed!

Emailing or Tweeting when motion is detected on your web cam

Thursday, June 26th, 2008

twitter.pngHi again everyone.

In the previous 2 posts we’ve setup an Xbox LIVE Vision Cam in Ubuntu then we Set it up to trigger on Motion. Now in this post we’re going to build on this and have it send us a notification via email or via a tweet on twitter.

What we’ll need

  1. The Ubuntu/Webcam setup from the previous 2 posts
  2. An internet connection
  3. A twitter.com account or an email address

First things first open up a terminal window

type

sudo vi /etc/motion/motion.conf

(or sudo gedit /etc/motion/motion.conf if you’re using a gui)
to open up the Motion config file.

we’re looking for the “locate” item and we want to change this from “off” to “on”

This will draw a border around the motion in the image.

Next we need to find the “on_motion_detected” line. This is where the magic happens
This line will allow us to define a command to run when motion is detected.

Now like I stated in the beginning we have 2 options we can send the message via email or we can send it via twitter. I’ll begin by showing you how to send the message via twitter.

We need to replace the entire line

; on_motion_detected value

with

on_motion_detected wget -O - --user=TWITTERUSERNAME --password=TWITTERPASSWORD \\
--post-data=”status=Your Message” https://twitter.com/statuses/update.xml

Save your file and restart motion (as covered in the previous article)
Now when motion is triggered you’ll post a tweet with the message you set in the command above.

Now to have it send you an email message there’s an extra step.
We have to install “mailutils”

So run the command

sudo apt-get install mailutils

Once that’s done installing we now have access to the “mail” command

So we need to edit the “on_motion_detected” item in the motion.conf file like for the twitter command above.

type

sudo vi /etc/motion/motion.conf

(or sudo gedit /etc/motion/motion.conf if you’re using a gui)
to open up the Motion config file.

And edit the

; on_motion_detected value

line to read

on_motion_detected echo "Your Message" |mail -s"Email Subject" your@email.addr

Save your file and restart motion (as covered in the previous article)

Now just as with the twitter command when your webcam sees motion an email will be sent off to the email address you set in the command above.

Make sure to check out the previous posts in this series Setup an Xbox LIVE Vision Cam in Ubuntu and Web Cam Motion Detection with Xbox LIVE cam and
As always post any questions, comments or other input in the comment section.
Cheers!

If you enjoyed this post, make sure you subscribe to my RSS feed!

How-To Add motion detection to our Xbox LIVE cam setup

Wednesday, June 25th, 2008

surv.jpgYesterday I showed you how to connect and stream an Xbox LIVE vision Camera from an Ubuntu computer to the internet (or your local network). Today we’re going to go a step further and set up a piece of software called Motion to not only stream the video but it will watch for motion and capture still frames when it sees any.

This is a fairly easy process.

What we need

  1. Our Ubuntu/Xbox LIVE Vision cam setup from yesterday
  2. An internet connection

Now as with the previous walkthrough we’re going to open up a terminal window

The first command we’ll run is

sudo apt-get install motion

This will fetch and install the Motion software package from the Ubuntu software repositories.

Now that we have Motion installed we need to tweak it’s configuration files to have it stream via webpage

so we type

 sudo vi /etc/motion/motion.conf

(Replace “vi” with “gedit” if you want to do this via your gui)

This opens the main motion config file for editing

We need to replace the following lines

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

    replace with

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

    replace with

    # Image height (pixels). Valid range: Camera dependent, default: 288
    height 480
  3. find
    # Quality of the jpeg images produced (default: 50)
    webcam_quality 50

    replace with

    # Quality of the jpeg images produced (default: 50)
    webcam_quality 80
  4. find
    # Restrict webcam connections to localhost only (default: on)
    webcam_localhost on

    replace with

    # Restrict webcam connections to localhost only (default: on)
    webcam_localhost off

Save the file ( “esc” then “:wq” in vi. Just use the menus if you used gedit)

now we can test motion to see if it’s working.

sudo motion

You should get output similar to the following

[0] Processing thread 0 - config file /etc/motion/motion.conf
[0] Motion 3.2.9 Started
[0] ffmpeg LIBAVCODEC_BUILD 3352064 LIBAVFORMAT_BUILD 3344896
[0] Thread 1 is from /etc/motion/motion.conf
[1] Thread 1 started
[1] cap.driver: "uvcvideo"
[1] cap.card: "Video Camera           "
[1] cap.bus_info: "0000:00:02.2"
[1] cap.capabilities=0x04000001
[1] - VIDEO_CAPTURE
[1] - STREAMING
[1] Supported palettes:
[1] 0: MJPG (MJPEG)
[1] 1: YUYV (YUV 4:2:2 (YUYV))
[0] motion-httpd/3.2.9 running, accepting connections
[0] motion-httpd: waiting for data on port TCP 8080
[1] Test palette YUYV (640x480)
[1] Using palette YUYV (640x480) bytesperlines 1280 sizeimage 614400 colorspace 00000008
[1] found control 0x00980903, "Hue", range -180,180
[1] 	"Hue", default 0, current 0
[1] found control 0x00980910, "Gamma", range 180,250
[1] 	"Gamma", default 180, current 180
[1] found control 0x00980913, "Gain", range 0,255
[1] 	"Gain", default 0, current 24
[1] found control 0x08000000, "Backlight Compensation", range 0,1
[1] 	"Backlight Compensation", default 0, current 0
[1] found control 0x08000001, "Power Line Frequency", range 0,2
[1] 	"Power Line Frequency", default 2, current 2
[1] mmap information:
[1] frames=4
[1] 0 length=614400
[1] 1 length=614400
[1] 2 length=614400
[1] 3 length=614400
[1] Using V4L2
[1] Started stream webcam server in port 8081

If you do use your web browser to go to http://your.ip.address:8081 (replace your.ip.address with the IP address of the computer Motion is installed on)

you should get a webpage with a view from your webcam. Success!

Now a couple tweaks you can make.
By default motion saves the images of motion to /tmp/motion if you want to change this folder you just need to edit the “target_dir /tmp/motion” entry in the /etc/motion/motion.conf while you’re in there you can increase the fps of the feed by changing the “webcam_maxrate 1″ entry to a higher number as well if you want to run this full time you may want to run it as a daemon which means it will run in the background to do this just set the “daemon” entry in the motion.conf file to “on” instead of “off”.

If you have any questions or suggestions please feel free to leave them in the comments.

If you enjoyed this post, make sure you subscribe to my RSS feed!

XBOX Live Vision Camera in Ubuntu

Tuesday, June 24th, 2008

Xbox LIVE Vision Cam The Xbox live Vision camera. There’s a lot of these things floating around but just not enough good uses when connected to your Xbox 360. Up until recently (The release of Hardy Heron) It was fairly painstaking to get this working. But now you can have it up and streaming to the web in a couple minutes.

What you’ll need

  1. A Computer running Ubuntu (8.04 Hardy Heron) http://www.ubuntu.com
  2. An Xbox LIVE Vision Cam http://www.xbox.com/en-US/hardware/x/xboxlivevision/
  3. A Free USB 2.0 port on your computer (IT HAS TO BE USB 2.0 a 1.1 port will not work)
  4. A Web browser (Preferably FireFox http://www.getfirefox.com

Now that we have all the pieces lets get to work.

Lets cut right to the chase.
Plug your Xbox LIVE cam into the USB 2.0 port on your Ubuntu box.
Open a terminal window and type

sudo modprobe uvcvideo

press return.

You should be prompted for your password. If you don’t get any errors the command was successful.

You can double check this by typing

lsmod |grep uvcvideo

The output should look like this

uvcvideo               58116  1
compat_ioctl32          2304  1 uvcvideo
videodev               29312  2 uvcvideo
v4l1_compat            15492  2 uvcvideo,videodev
v4l2_common            18304  2 uvcvideo,videodev
usbcore               146028  4 uvcvideo,ehci_hcd,ohci_hcd

At this point Ubuntu knows how to use our Xbox LIVE Cam but we don’t have any software to pull the video out.

We’ll install a nice little peripheral app for UVCVideo that streams your camera live.

lets make a temporary folder to work in.

mkdir /home/username/uvcwork
cd /home/username/uvcwork
wget http://internap.dl.sourceforge.net/sourceforge/mjpg-streamer/mjpg-streamer_r64-1_i386.deb

(Or download from the SourceForge project page (http://sourceforge.net/projects/mjpg-streamer/)

dpkg -i ./mjpg-streamer_r64-1_i386.deb

That’s it the MJPG streamer is now installed.

Start it up with the following command

mjpg_streamer -i "input_uvc.so -d /dev/video0 -f 15 -r 640x480" -o "output_http.so -p 8080 -w ./"

If it works you should get the following back on the terminal and the green ring should light up on the camera

MJPG Streamer Version.: 2.0
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 15
 i: Format............: MJPEG
 o: www-folder-path...: ./
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled

Lets test it out. Go to the following address

http://your.ip.address:8080/?action=stream

Replace “your.ip.address” with the IP address or hostname of the computer you’ve plugged the camera into

If everything went well you should be seeing the view from your camera.

*NOTE: Sometimes mjpg_streamer refuses to start with an error. The following sequence of commands usually resolves it

sudo rmmod uvcvideo
sudo modprobe uvcvideo

In my next article we’ll be adding motion detection to this setup. Make sure and check back

Camera View

If you enjoyed this post, make sure you subscribe to my RSS feed!

How-To:XBOX 360 Media Server in Linux

Wednesday, January 9th, 2008

If you have an XBOX 360 and you’re not using the media capabilities your not completely using your XBOX. The 360 is an excellent way to bring the media on your PC to your living room. Today I’m going to walk you through how to stream video to your 360 using uShare on a computer running linux. It doesn’t need to have very high specs, mine only has a Pentium 4 running at 1.6Ghz with 768 Megs of ram and it streams flawlessly.

(more…)

If you enjoyed this post, make sure you subscribe to my RSS feed!