Setting up webcam on Raspberry Pi

I wanted to find out if the Raspberry Pi supports webcam or not. So I pulled an old Microsoft LifeCam NX-3000 to test with the Pi.The packages were talking a long time to load so I had to perform most of my installation on the emulator instead.
Since my MAC has single hard disk drive, the USB drive for the SD card would always be on /dev/disk1s1 when plugged in. To overcome the problem I created a shell script to write any Raspberry Pi  images on the SD card.

#!/bin/bash
sudo diskutil umount /dev/disk1s1
sudo dd bs=1m if=$1 of=/dev/rdisk1
sudo diskutil umount /dev/disk1s1

Through Qemu you can quickly install debian packages on SD card.The image can be loaded on the SD card using the script above.Follow the steps below to test webcam packages on the Raspberry Pi:

1. Remotely access your Linux box using ssh, then mount the folder containing wheezy raspbian image.
2. Create a raw 3GB raw image disk and copy wheezy raspbian onto it:
qemu-img info 2012-09-18-wheezy-raspbian.img
qemu-img create -f raw newwheezy.img 3G
dd if=2012-09-18-wheezy-raspbian.img of=newwheezy.img
3. Start qemu without graphic, and specify 512MB memory (or replace the flag to -m 1024 to use 1GB memory), command:
sudo qemu-system-arm -kernel kernel-qemu -cpu arm1176 -M versatilepb -m 512 -no-reboot -append "root=/dev/sda2" -hda newwheezy.img -net nic -net user -nographic
4. Within qemu emulating Raspbian:
sudo passwd root
(enter new root password: root, twice)
su
(enter root)
aptitude update
aptitude install -y camorama
aptitude show camorama (to make sure it's installed).
shutdown -h now
(enter Ctrl-a x to exit qemu, then quit ssh session to go back to the MAC).
5. From the MAC, use sftp or scp to copy the new wheezy raspbian image loaded with camorama, command:
./loadsd.sh newwheezy.img
6. Now boot your Raspberry Pi with new wheezy raspbian. Enter command: startx to start the GUI & click LXTerminal, enter:
lsub (a list of USB devices is displayed, one of those lines listed the LifeCam)
camorama (command to start camorama, or command cheese to start cheese)


3 comments

  1. plz start with the basics and tutorial from getting started so that a newbie can follow ur blog and will start on raspberry pi..

    ReplyDelete
  2. The reference to camorama was useful. It solved my problem.
    I just had to do a sudo apt-get install camorama. Thanks!!

    ReplyDelete