This project transforms an ESP32 into a Bluetooth adapter that enables wireless connectivity for USB keyboards and mice. It acts as a bridge between traditional USB input devices and Bluetooth-enabled devices, effectively converting your wired peripherals into wireless ones.
📱 ESP32-S3-USB-OTG → Ready to use!
OR
🔧 Other ESP32 Board → Need USB Host Module
Your ESP32 must have USB Host support. Choose your setup:
┌──────────────────────┐
│ ESP32-S3-USB-OTG │
│ ✅ Built-in USB │
│ ⚡ Full Speed │
│ 📊 12 Mbps │
└──────────────────────┘
┌──────────────────────┐
│ Other ESP32 │──➤ USB Host Module
│ 🔌 External USB │ Required
│ ⚠️ Check Support │
└──────────────────────┘
- 🎮 Built-in Support: ESP32-S3-USB-OTG has native USB host capabilities
- 🔌 Module Option: Other ESP32s need external USB host module
- ⚡ Speed: Full-speed USB (12 Mbps)
- 📚 Documentation: Official ESP32-S3-USB-OTG Guide
- Supports both USB keyboards and mice simultaneously
- Bluetooth Low Energy (BLE) connectivity
- Plug-and-play functionality
- Low latency input processing
- Compatible with multiple operating systems (Windows, macOS, Linux, iOS, Android)
- Battery-powered operation possible (with appropriate power supply)
- ESP32-WROOM-32 development board
- USB keyboard (USB HID compliant)
- USB mouse (USB HID compliant)
- Female USB-A ports or breakout boards (for connecting peripherals)
- Jumper wires
- Breadboard (for prototyping)
- 5V power supply
- 3D printed case (design files available)
- LiPo battery (for portable use)
- Battery charging module
- Arduino IDE (2.0 or later recommended)
- ESP32 board support package
- Required Libraries:
- ESP32-BLE-Keyboard
- ESP32-BLE-Mouse
- ESP32-USB-Soft-Host
- Add ESP32 board manager URL in Arduino IDE preferences:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
- Install ESP32 board package via Board Manager
- Install required libraries through Library Manager
- D+ (Data+): GPIO 16 (RX2)
- D- (Data-): GPIO 17 (TX2)
- VCC: 5V (VIN or 5V pin)
- GND: Ground (Any GND pin)
- D+ (Data+): GPIO 22 (GPIO22)
- D- (Data-): GPIO 23 (GPIO23)
- VCC: 5V (VIN or 5V pin)
- GND: Ground (Any GND pin)
Function | GPIO Pin | Board Label | Notes |
---|---|---|---|
Keyboard D+ | GPIO 16 | RX2 | Also labeled as U2RXD |
Keyboard D- | GPIO 17 | TX2 | Also labeled as U2TXD |
Mouse D+ | GPIO 22 | GPIO22 | General purpose IO pin |
Mouse D- | GPIO 23 | GPIO23 | General purpose IO pin |
Note: The pins used for USB communication (GPIO 16, 17, 22, 23) are multiplexed pins that can serve different functions on the ESP32. In this project, we're using them for USB communication, so they won't be available for their alternative functions while the adapter is operating.
-
Hardware Assembly
- Connect USB ports according to the pin configuration
- Ensure proper power supply connection
- Double-check all connections before powering on
-
Software Installation
- Follow the Development Setup instructions below
- Flash the firmware to ESP32
- Monitor serial output for debugging
-
Pairing Process
- Power on the adapter
- Search for Bluetooth devices on your target device
- Connect to "ESP32 Keyboard" and "ESP32 Mouse"
- Test input devices
- Install Visual Studio Code
- Clone this repository
- Open the
ESP32-USB-TO-BLE.code-workspace
file in VSCode - Install recommended extensions:
- PlatformIO IDE
- C/C++ Extension Pack
- CMake Tools
- Git Graph
- GitLens
- Serial Monitor
- Click "Install All" when prompted
- Wait for PlatformIO to download dependencies
- Use PlatformIO toolbar for:
- Building (✓)
- Uploading (→)
- Serial monitoring (🔌)
-
Device Not Connecting
- Ensure ESP32 is powered properly
- Check if device is in pairing mode
- Verify USB connections
-
Input Lag
- Reduce distance from adapter
- Check for interference sources
- Verify power supply stability
-
Device Not Recognized
- Confirm USB device compatibility
- Check physical connections
- Verify serial monitor output
For additional issues, please open a GitHub issue with:
- Detailed problem description
- Hardware configuration
- Serial monitor output
- Steps to reproduce
We welcome contributions! To contribute:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to your branch
- Open a Pull Request
Please follow our coding standards and include appropriate documentation.
This project is licensed under the MIT License. See the LICENSE
file for details.
This project builds upon the excellent work of:
- T-vK for the ESP32-BLE-Keyboard and ESP32-BLE-Mouse libraries
- tobozo for the ESP32-USB-Soft-Host library
For support:
- Open a GitHub issue
- Join our Discord community
- Check the Wiki for additional documentation
- Add multi-device support
- Implement custom key mapping
- Develop mobile configuration app
- Add macro support