TinyUVC is a header-only C++ USB Video Class (UVC) device library for Arduino. It turns an ESP32-S2/S3/P4, a Raspberry Pi Pico (RP2040/RP2350) or an STM32 into a USB webcam that Linux, Windows and macOS use without any driver.
- Header only:
#include "TinyUVC.h". - One generic TinyUSB implementation (Adafruit TinyUSB Library) for RP2040, RP2350, STM32, SAMD and nRF52; the ESP32 uses the TinyUSB of its core.
- UVC 1.1 with a bulk endpoint: MJPEG and/or uncompressed YUY2, several resolutions and frame rates. The host picks, your sketch is told.
- Frames in RGB565, RGB888, BGR888 or grayscale are converted to YUY2 while they are sent: no second frame buffer.
- PSRAM: frame buffers are taken from PSRAM where the board has it (ESP32, RP2350).
- TinyCamera integration: ESP32, ESP32-P4, RP2040 and STM32 camera sensors become webcams in a few lines.
- arduino-audio-tools
integration: video encoders, decoders and demuxers (e.g.
MJPEGEncoder,DemuxerAVI) feed the webcam. - TinyGPU integration: the webcam as TinyGPU display, so 2D graphics, text, sprites and 3D wireframes are sent as video (YUY2 or MJPEG).
- Desktop build with CMake: the device code runs against a simulated USB host
that behaves like Linux'
uvcvideodriver.
Verified on an ESP32-S3 and a Raspberry Pi Pico with Linux hosts; see Supported platforms for the board settings and the test status, and Limitations for what is not supported.
- Usage: plain frames, TinyCamera, arduino-audio-tools, and the examples
- Supported platforms: board settings, tested hardware, and USB bandwidth
- Configuration: compile-time settings
- Desktop build and tests: CMake, the simulated USB host, and what it checks
- Limitations: what is not supported
- API reference Doxygen Class Documentation
- License: Apache 2.0; the License notes cover TinyUSB and the GPLv3 integrations
You can download the library as zip and call include Library -> zip library. Or you can git clone this project into the Arduino libraries folder e.g. with
cd ~/Documents/Arduino/libraries
git clone https://github.com/pschatzmann/TinyUVC.git
I recommend to use git because you can easily update to the latest version just by executing the git pull command in the project folder.
Optional: TinyCamera, arduino-audio-tools, TinyGPU and TinyJPEG; for STM32 the Adafruit TinyUSB Library.
Then add #include "TinyUVC.h" to your sketch. See the usage guide and the TestPatternWebcam example.
For desktop builds with CMake, see Desktop build and tests.