Updating the Raspberry Pi Webcam

I built a streaming webcam showing the view from my downtown Oakland apartment in November 2012. I used a Raspberry Pi (Model B Revision 1.0) and the Raspian Wheezy (2012-10-28) image. For the webcam/web server software, I used MJPG-streamer. The problem with MJPG-streamer is that if the images/stream is available on the internet, then anyone can access the software.

Recently my Raspberry Pi began to lose the WiFi connection. In researching various solutions, I disabled WiFi power management on the Edimax EW-7811Un nano-size USB WiFi adapter. That didn’t solve the problem. I switched to Ethernet but the connection still dropped.

I found a nice script for “Rebooting the Raspberry Pi when it loses wireless connection“. It’s a script that runs in crontab and checks for a network connection by pinging a local address. If the ping fails, it restarts wlan0.

The checkwifi.sh script worked great, but then I had an issue with the video stream image oscillating. The image would continually go between light and dark and the only way to stop it was to restart MJPG-streamer.

I decided to update to the current Raspbian Jessie with Pixel and some other webcam software. The Motion-Project seemed not to difficult – I could use it as a streaming webcam. I decided to use Motion 4.0 and Kenneth Lavrsen’s Motion 4.0 Guide to help set it up. I don’t know if the image oscillation is an issue caused by using the Creative Live! Cam Chat HD (auto exposure?) but this current setup seems to have resolved the issue.

Raspberry Pi Webcam

 Raspberry Pi Webcam

I’ve had a webcam serving live images using WebCam2000 running on my Macbook. I recently bought a new webcam, a Creative Live! Cam Chat HD (it was cheaper, $25, when I bought it August 2012). The previous webcam I was using, a Vivicam 3350B (I bought it on Woot! for $8.50 in 2005), didn’t have a Windows 7 driver and I was using Windows XP Mode and Windows Virtual PC – it was a little cumbersome.

When the Raspberry Pi was released, I thought it would be a great webcam server. I ordered one from Allied Electronics last July, but they never had stock. When Adafruit started selling them, I bought one.

After I acquired a compatible USB keyboard and dug up an Intellimouse Explorer 3.0, I started out with the 2012-09-18-wheezy-raspbian image. Googling found a Romanian site, BobTech, with an excellent tutorial for setting up a Raspberry Pi streaming webcam (English Google translation). Basically, the instructions just worked.

Later, I bought an Edimax EW-7811Un USB Adapter and with the current 2012-10-28-wheezy-raspbian image, WiFi was even easier to setup. The only change I made in the network setup was to give the Raspberry Pi a static IP address so I could find it. I edited wlan0 section in /etc/network/interfaces:

iface wlan0 inet static

address 192.168.1.115

netmask 255.255.255.0

gateway 192.168.1.1

nameserver 208.67.222.222

wpa-ssid Skynet

wpa-psk xxxxxxxxxxxxxx

I made a change to have MJPG-streamer serve a single image instead of a stream. Instead of using http://raspberrypi:8080/?action=stream, I used http://raspberrypi:8080/?action=snapshot. I use a script to reload the page every 10 seconds.  In mjpg-streamer.sh, I set FRAME_RATE=”10″ You really don’t see much action unless it’s windy.

Once the Raspberry Pi was setup, I used puTTY to connect to it, so I can start mjpg-streamer and do other things without having the Raspberry Pi connected to a monitor.