Cheap webcams on raspberry pi and HTTP

I finally found a webcam and software combination that is not only cheap, but relatively easy to setup. Being a cheapskate, I have avoided the Raspberry pi camera. The Raspberry pi camera has several things going for it (from what I gather): lower power consumption, faster response, and it does not use a USB port. I ordered a very cheap webcam (rather blindly) from Amazon hoping it will work. lsusb indicates it is made by Aveo (or at least compatible) and comes up with ID 1871:0101 (my kernel is 3.10.25). This webcam works without a powered USB hub. It typically shows up in the device tree as /dev/video0 (if it’s the only device you have plugged in). I’ve found that the rpi does not supply enough USB power to power the camera and anything else (including a keyboard).

Edit: Demo images
test7

5MP webcam test images

test3

test6
(Amazon Link)

There are several different software packages out there:

  • raspistill for the Official Rasperry pi camera
  • OpenCV or SimpleCV
  • pygame
  • imgproc a library for Python (no save capability)
  • fswebcam

I’ve found fswebcam to be the fastest way of getting started. I burned a lot of time looking at OpenCV or combinations of mpeg-streamer. fswebcam just works. It comes in a package:

sudo apt-get install fswebcam

and it is very easy to use:

fswebcam -d /dev/video0 -r 640x480 test.jpg

and it is very easy to use:

fswebcam -d /dev/video0 -r 640x480 test.jpg

I found that the software can sometimes return an image that contains parts of two frames, like this:
messedup

To avoid this problem, tell the program to skip two frames:

fswebcam -d /dev/video0 -S 2 -r 640x480 test.jpg

There is also a background mode (using -b) to enable it run as a background daemon. So far fswebcam will not retrieve images at greater than 640×480 resolution from this camera.

Raspberry webcam

Raspberry pi Model A with Edimax

I got my Model A Raspberry pi working with the Edimax EW-7811 USB wifi adapter and no additional network connectivity. I used a cheap USB hub and could power the mouse, keyboard, and wifi with no external power.

There are a few tricks: the first is to use the most recent version Raspbian.

The second trick is to edit the /etc/wpa_supplicant/wpa_supplicant.conf file and manually join to an SSID:


ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

network={
ssid="luben"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
psk="*password*"
}

The /etc/network/interfaces file looks like this,


auto lo

iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Raspberry pi model A versus B

Received my first raspberry pi. I’ve been looking for a use for one of these for a while and finally found it. Come to find out there are three different types of pi’s on the market: Model A, Model B Rev 1 and Model B Rev 2. The Model A has no ethernet. To get connectivity, you must use a USB adaptor. Model B Rev 1 has wired ethernet whereas Rev 2 is the same, but with an extra 256mb RAM (512 total).

Raspberry Pi’s are now starting to show up on Amazon Prime, but the price is a bit higher than ordering from Sparkfun or Adafruit, but it will appeal the instant gratification crowd.