Eric Nam Showcases the Espressif ESP32-S2's USB Capabilities with a Webcam Streaming Mod

Based on Espressif demo code, this project showcases the flexibility of the ESP32-S2's USB Host capabilities.

ghalfacree
over 3 years ago HW101

YouTuber Eric Nam has shown off the flexibility of the native USB support in Espressif's ESP32-S2 system-on-chip (SoC), using it to play host to a USB webcam — though warns that performance expectations should be tempered.

"[The] ESP32-S2 supports a native USB interface. It works as a USB Host and allows data communication by connecting USB peripherals," Nam explains in a video demonstrating the chip's capabilities. "Unfortunately, it's an old version of the USB interface which is 1.1 and the maximum speed of this USB is 12Mbps, so you can't expect [it to be] that fast."

Eric Nam's latest video shows off the capabilities of the USB support in Espressif's ESP32-S2. (📹: That Project)

Using an ESP32 chip to turn a camera sensor into a wireless device is a common project, but Nam has approached the problem in a different way: rather than using a TTL camera sensor, he has chosen a webcam, which connects to the ESP32-S2 over USB.

"My current camera resolution is 320×240, and I was able to get a frame rate of approximately 15 [frames per second]," Nam says of his initial efforts. "Officially, it should output about 33 FPS at 320×240 resolution, but with my camera I couldn't reduce the interval between images to the maximum.

"There are a few things you need to know first to try this out," Nam notes. "You must have an [ESP32-]S2 or [ESP32-]S3 with at least 2MB of PSRAM [Pseudo-Static RAM], and your USB camera must support MJPEG [Motion JPEG] compression, It should be possible to set the packet size not to exceed the maximum of 512 bytes."

The project is compatible with many USB webcams, providing they support MJPEG. (📷: That Project)

"The image transmission bandwidth must be less than 4Mbps," Nam continues, "[and] due to USB isochronous transfer bandwidth limitations, the image frame rate and single image size are mutually limited. If the image size is 25kB per frame, the frame rate cannot exceed 20 FPS."

Nam's full video demo is available on the That Project YouTube channel, while the source code on which it's based comes from Espressif's ESP IoT Solution GitHub repository where it's made available under the permissive Apache 2.0 license for use with the ESP-IDF toolchain.

ghalfacree

Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.

Latest Articles