Sunday, March 9, 2014

Webcam on Raspberry Pi

I want to set up a remote webcam using the Raspberry Pi.  I installed a fresh copy of Raspian (2014-01-07-wheezy-raspbian.zip) from the Raspberry Pi download page.

Then, I followed the directions here.

First, update the raspberry pi firmware using rpi-update to add support for USB video device class (UVC).  I was not sure if this was needed or not.  My device already showed up in the usb device list using the lsusb command.

$ sudo apt-get install rpi-update
$ sudo rpi-update

After this is done, reboot.  Next, update the OS.
$ sudo apt-get update
$ sudo apt-get upgrade

Then install motion.
$ sudo apt-get install motion

After installation, I noted that it will not start by default.  It was disabled via /etc/default/motion.  After motion is installed, configure it by editing the  /etc/motion/motion.conf file (with elevated privileges).  I turned webcam_localhost and control_localhost to off so that I could view the stream and control the camera from a remote host.  I enabled motion by editing the
/etc/default/motion file and changing start_motion_daemon to yes.

Then, I was able to start motion.
$ sudo service motion start

I went to another machine and use VLC to open the stream by selecting "Open Network Steam" and putting in "http://<ip_address>:<port>.  In my case, the port was the default 8081, and the ip address was the address of the Raspberry Pi.

Unfortunately, I got a video stream that said "UNABLE TO OPEN VIDEO DEVICE."  Now I have to figure out why that didn't work. 
 

Bluetooth on Raspian

I've had a Raspberry Pi for a while now.  I've tried Rapbian, OpenELEC, and Kali.  I want to set up a remote webcam using an old webcam, so I just grabbed the 2014-01-07-wheezy-raspbian.zip from here.

The first thing I wanted to do was to get bluetooth working.  I followed the instructions here.  The steps are pretty simple.

  1. sudo apt-get update
  2. sudo apt-get install -y bluetooth bluez-utils blueman
Then I used this bluetooth adapter: Plugable USB Bluetooth 4.0 Low Energy Micro Adapter.  I plugged it in and went to Preferences | Bluetooth Manager.  I searched for devices after putting a bluetooth keyboard into discover mode.   Once I found it, I hit "+" to trust the device.  Then I right clicked on the device and selected "pair."  I had to enter a PIN using my existing keyboard, hit enter, then enter that PIN on the bluetooth keyboard and hit enter. 

Once it was paired, I trusted it by right clicking on the device and selecting "Trust."  Then the Bluetooth Assistant dialog came up and asked if I wanted to connect to "Input Service" or "Don't connect."  I selected "Input Service."  The device connected and I could finally type.

Next step - get a webcam working.