USB Camera on BeagleBone Black
Hello all,
This blog post is about the SparkFun cheap video camera on a BBB. The Sparkfun part number is SEN-11957.
Pre-requisites:
1. Angstrom build with Kernel 3.8.13 or newer.
Steps:
1. Power the BeagleBone Black with enough juice to run a camera. You should be 1A USB port — pretty much every modern laptop powered USB port. If you’re using a hub, that probably won’t provide enough power. Use the barrel jack and a 5V, 1A adapter. In the alternative, you can use a cell-phone external battery like the Anker Astro Mini( this provides USB 1A power for 3 hours, roughly ):
2. Probe the USB port to ensure a connection. SSH to your BBB, and run this:
#lsusb
You should get “Bus 001 Device 002: ID 0c45:62f1 Microdia” or something like that, along with other USB devices ( the on-board hubs ).
3. Cd in your dev tree, check that the video0 device auto-mounted correctly
# cd /dev & ls -l video0
Results:
crw-rw—- 1 root video 81, 0 Jan 1 00:01 video0
4. Probe The device with the Video for linux subsystem pre-compiled into Angstrom. Not every distribution has it, but Angstrom as of March 2013 does have it. Earlier versions likely do as well. It’s the version I tested with…
#v4l2-ctl –list-devices
Results:
USB 2.0 Camera (usb-musb-hdrc.1.auto-1):
/dev/video0
If it’s the only device, you can send the -all parameter to get the camera’s driver and abilities. My camera supports 640×480 video, 25FPS, using the universal video driver. It’s a really basic VGA camera. The specs say it can do 1024×768 SVGA — I think it can, too. I’m testing it out as I write this blog post…
#v4l2-ctl –list-formats-ext
Returns — too much to type out/cut and paste. It lists all available resolutions currently supported by the driver.
5. set the camera to 1024×768 video format. The camera only supports 1 raw video format without any compression.
#v4l2-ctl –set-fmt-video=width=1024,height=768
Returns nothing. You can re-probe from step 3. It seems that this camera under this driver cannot do the 1024×768, but only 640×480. You can also add the ,pixelformat=N parameter to the set-fmt-video argument, where N=1 meaning h.264 on a hardware encoding camera.
6. Capture an image.
# cd ~/
#mkdir Image
# cd image
# v4l2grab -x640 -y480 -n1
result:
out000.ppm — download this file and it should be a picture… Thought my own camera gives me a series of lines rather than a picture…