Skip to content
avivgr edited this page Oct 28, 2013 · 7 revisions

#Welcome to the teensy webcam project page!

Teensy 2.0 is a complete USB-based microcontoller development system based on Atmel ATMEGA32U4.

The Teensy UVC webcam project implements a standard USB Video Class (UVC) device using the Teensy 2 board.

#FAQ

What is uvc?

UVC is a USB specification for video class devices, including webcams. The spec can be downloaded from here. The advantage of implementing a standard class device is that all major OSs includes host drivers for them.

Do you need to attach a camera sensor ?

I did not include a real camera sensor in my project. The idea was to understand how the UVC standard is implemented, not to produce a real camera. In theory, a real sensor could be attached to Teensy through its pins, however the Atmel ATMEGA32U4 probably does not have enough cpu juice nor memory to push data from a sensor.

So, what image does the "camera" produce?

It produces a moving color bars (inspired by the linux vivi driver).


Camorama


Watch this short video:
Short video

Does the camera have any controls?

I added one brightness control. More could be easily added.

Do i need to solder anything?

Not necessary, just burn the hex image into Teensy, and use a camera application (e.g skype, camorama etc)

How do i debug the code?

I attached a serial cable to Teensy and i print some debug strings from the code to the UART pins.


Pins used for serial debugging

What pixel format/resolution is used?

160x120 using YV12 pixel format. You can add your own.

Do i need to install any drivers for Linux/Windows/Mac?

No, the driver is included with the OS. Its a standard USB device, did i mention this?

How did you program the USB?

I programmed the USB controller directly using the Atmel datasheet as a reference. All the webcam controls (negotiating pixel formats, querying the device capabilities etc) are done using endpoint 0, the default control endpoint. Video streaming on the other hand is done using a USB isochronous endpoint.

What techniques did you use to maximize USB throughput?

Teensy 2 is not a high speed USB device, it is capable of full speed only, and is limited in memory and compute power. Teensy 3 is a the latest revision and has more processing power. Having said that, i used a 256 endpoint size for isochronous streaming. I also used ping pong buffer config. This means that Teensy has 2 buffers it can toggle - So while the host is reading one buffer, Teensy cpu can write to the second buffer in parallel to increase throughput.

How is the device enumerated?

See lsusb output.

Why did you do this project?

I did it because it is fun and for educational purposes. Who knew that such a small and inexpensive device could become a webcam? :)

Author