Supported ESP32 SoCs
The ESP32_USB_STREAM library is compatible with specific ESP32 System-on-Chip (SoC) variants that include USB OTG (On-The-Go) host capabilities.ESP32-S2
Features:
- Single-core Xtensa LX7 @ 240 MHz
- USB OTG Full-Speed (12 Mbps)
- 320 KB SRAM
- Wi-Fi 802.11 b/g/n
ESP32-S3
Features:
- Dual-core Xtensa LX7 @ 240 MHz
- USB OTG Full-Speed (12 Mbps)
- 512 KB SRAM
- Wi-Fi 802.11 b/g/n + Bluetooth 5.0
Why ESP32-S3 is Recommended
For most applications, especially those requiring concurrent UVC and UAC streaming, the ESP32-S3 offers significant advantages:Dual-core processing
One core can handle USB streaming while the other manages application logic, Wi-Fi, or display updates.
More RAM
512 KB SRAM vs 320 KB on S2 allows larger frame buffers and more headroom for complex processing.
USB Host Wiring
Proper USB connections are critical for reliable operation. The ESP32-S2/S3 USB OTG peripheral uses specific GPIO pins.Standard USB Pin Configuration
| Signal | ESP32-S2/S3 GPIO | USB Type-A Pin | Color (typical) |
|---|---|---|---|
| D+ (Data Plus) | GPIO 20 | Pin 3 | Green |
| D- (Data Minus) | GPIO 19 | Pin 2 | White |
| VBUS (5V Power) | 5V | Pin 1 | Red |
| GND (Ground) | GND | Pin 4 | Black |
USB Type-A Connector Wiring
Connection Diagram
The ESP32’s internal USB PHY handles the USB signal levels automatically. You can connect the data lines directly without level shifters.
Power Considerations
USB devices can draw significant current, and proper power design is essential.USB Power Requirements
Examples: Simple webcams, basic microphonesCan typically be powered from ESP32 development board’s 5V pin if it has sufficient supply.
Examples: Most USB cameras, audio interfacesRequires external 5V power supply. Do not rely on USB-to-Serial converter or computer USB port.
Examples: High-resolution cameras, active speakersRequires dedicated 5V power supply rated for at least 2A. May need powered USB hub.
Power Supply Options
Option 1: Development Board 5V Pin (Limited)
Option 1: Development Board 5V Pin (Limited)
Use when:
- Device draws less than 100 mA
- Dev board has robust 5V regulator
- External power adapter is connected to dev board
- Device is high-power
- Powering from computer USB only
- Experiencing brown-out or reset issues
Option 2: External 5V Power Supply (Recommended)
Option 2: External 5V Power Supply (Recommended)
Connection:Benefits:
- Stable power for device and ESP32
- Prevents brown-out resets
- Supports high-power USB devices
Option 3: Powered USB Hub
Option 3: Powered USB Hub
When to use:
- Multiple USB devices
- Very high-power devices (>1A)
- Maximum compatibility
- Connect powered hub to ESP32 USB host pins
- Hub provides power to all connected devices
- ESP32 draws minimal current for USB signals
Compatible USB Devices
The library supports standard UVC (Video Class) and UAC (Audio Class) compliant devices.USB Video Class (UVC) Devices
Supported Devices
- Standard USB webcams
- USB endoscopes
- USB microscopes
- Action cameras with UVC support
- USB capture cards (UVC compatible)
- Industrial USB cameras
Requirements
- UVC 1.0, 1.1, or 1.5 compliant
- MJPEG format (default support)
- Full-Speed USB (12 Mbps)
- Resolutions up to ~720p @ 15fps
USB Audio Class (UAC) Devices
Supported Devices
- USB microphones
- USB headsets
- USB speakers
- USB audio interfaces
- USB sound cards
- Conference speakerphones
Requirements
- UAC 1.0 or 2.0 compliant
- Full-Speed USB (12 Mbps)
- Sample rates: 8-96 kHz
- Bit depths: 8, 16, 24, 32-bit
Tested Device Examples
While the library supports standard UVC/UAC devices, actual compatibility depends on the device’s implementation. Some devices may have non-standard behavior.
- Generic 480p/720p USB webcams
- Logitech C270 (at lower resolutions)
- USB endoscope cameras
- Generic USB microphones
- USB conference speakers
- Simple USB headsets
Device Compatibility Checks
Before purchasing a USB device, verify it meets these criteria:Check USB class compliance
Device must be standard UVC (video) or UAC (audio) compliant. Look for “UVC” or “USB Video Class” in specifications.
Verify power requirements
Check device current draw (usually in mA). Ensure your power supply can handle it.
Confirm USB Full-Speed support
ESP32 supports Full-Speed (12 Mbps) only. High-Speed (480 Mbps) devices may work at reduced performance.
Concurrent Streaming Limits
The ESP32_USB_STREAM library supports concurrent streaming with these constraints:Maximum Simultaneous Streams
1 UVC
One USB camera providing video stream
1 Microphone
One USB microphone input
1 Speaker
One USB speaker output
Bandwidth Considerations
USB Full-Speed theoretical maximum is 12 Mbps, but practical limits are lower:| Configuration | Estimated Bandwidth | Feasibility |
|---|---|---|
| 640×480 @ 15 fps MJPEG | ~4-6 Mbps | ✅ Excellent |
| 1280×720 @ 15 fps MJPEG | ~8-10 Mbps | ⚠️ Marginal |
| 1920×1080 @ 15 fps MJPEG | ~12-16 Mbps | ❌ Exceeds USB |
| 48 kHz stereo 16-bit audio | ~1.5 Mbps | ✅ Excellent |
| UVC + UAC mic + UAC speaker | ~5-8 Mbps | ✅ Good |
Memory Constraints
Circuit Design Guidelines
Minimal USB Host Circuit
Recommended Protection Circuit
For production designs, add protection components:Development Board Recommendations
Popular ESP32-S2/S3 boards suitable for USB host applications:ESP32-S3-DevKitC-1
Official Espressif board
- ESP32-S3-WROOM-1 module
- USB-to-UART + USB OTG ports
- Exposed GPIO 19/20 for USB host
- Recommended for development
ESP32-S2-Saola-1
Official Espressif board
- ESP32-S2-WROVER module
- USB OTG port available
- Cost-effective option
- Good for basic applications
Ensure your development board breaks out GPIO 19 and GPIO 20, or has a dedicated USB OTG port you can use in host mode.
Troubleshooting Hardware Issues
Device not detected / enumeration fails
Device not detected / enumeration fails
Possible causes:
- Incorrect wiring (check D+/D- connections)
- Insufficient power supply
- Device not UVC/UAC compliant
- Faulty USB cable
- Verify GPIO 19 → D-, GPIO 20 → D+ connections
- Use external 5V/2A power supply
- Test with a known-good USB device
- Try a different (shorter) USB cable
ESP32 resets during streaming
ESP32 resets during streaming
Cause: Brown-out due to insufficient powerSolutions:
- Use dedicated 5V power supply (not computer USB)
- Add bulk capacitors (100µF-470µF) near ESP32 and USB VBUS
- Reduce USB device power consumption (lower resolution/frame rate)
- Consider powered USB hub
Intermittent disconnections
Intermittent disconnections
Possible causes:
- Poor USB cable quality
- Electrical noise on data lines
- Power supply ripple
- Long cable lengths
- Use high-quality shielded USB cable (less than 1 meter)
- Add 33Ω series resistors on D+/D- lines
- Add ferrite bead on USB cable
- Ensure solid ground connections
Poor video/audio quality
Poor video/audio quality
Possible causes:
- USB bandwidth exceeded
- Insufficient ESP32 processing power
- Memory allocation issues
- Reduce resolution or frame rate
- Lower audio sample rate
- Use ESP32-S3 instead of S2
- Increase buffer sizes if memory permits
Related Topics
UVC Streaming
Learn about USB video streaming configuration
UAC Streaming
Learn about USB audio streaming configuration