arduino-bt-hid-proxy icon indicating copy to clipboard operation
arduino-bt-hid-proxy copied to clipboard

Support for ESP32

Open leopck opened this issue 3 years ago • 13 comments

Great project, I love this project as this has been my pain point for sometime now and there's no solution in the market that is able to resolve this.

Is there any plans to adopt ESP32 with USB HID and Bluetooth as a single package solution for this? This would make it much leaner and smaller in package and if we turn off Wi-Fi, potentially it would be relatively low power as well.

leopck avatar Jan 12 '22 06:01 leopck

Some good hardware to get started on is the latest version ESP32-S3: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitm-1.html https://github.com/espressif/esp-dev-kits/tree/master/esp32-s3-usb-otg

leopck avatar Jan 12 '22 06:01 leopck

Hi!

Just my 2 cents. From what I gathered about the ESP32, only the ESP32-S2 supports Bluetooth HID Host. Can the S3 do that?

Jerther avatar Jan 12 '22 13:01 Jerther

Actually ESP32-S2 doesn't come with Bluetooth while it does have WiFi and USB but not the Bluetooth hardware itself. ESP nowadays has many various hardware, so it's easy to get confused. I've provided some hardware table here to give a better idea on their hardware capabilities.

name type wifi bluetooth
ESP32-S3 SoC IEEE 802.11 b/g/n; 2.4 GHz; HT20/40; up to 150 Mbps Bluetooth LE v5.0
ESP32-C3 SoC IEEE 802.11 b/g/n; 2.4 GHz; HT20/40; up to 150 Mbps Bluetooth LE v5.0
ESP32-S2 SoC IEEE 802.11 b/g/n; 2.4 GHz; HT20/40; up to 150 Mbps N/A
ESP32 SoC IEEE 802.11 b/g/n; 2.4 GHz; HT20/40; up to 150 Mbps BR/EDR + Bluetooth LE v4.2
ESP8266EX SoC IEEE 802.11 b/g/n; 2.4 GHz; HT20; up to 75 Mbps N/A

Actually they have over 144 variants of this, for the full list of capabilities, you can see from here: https://products.espressif.com/#/product-selector?language=en&names=

Regarding the ESP32-Sx series supporting USB HID, yes, ESP32-S2 and ESP32-S3 both supports USB HID, there's a good examples and documentation using TinyUSB with ESP32-S2 and ESP32-S3 here: https://github.com/espressif/esp-iot-solution/tree/usb/add_usb_solutions/examples/usb/device/usb_hid_device

From their example: image

Makes me wonder if they support USB HID composite device (mouse + keyboard) example so that we can support both mouse and keyboard at the same time.

Seeing that this project is more focused on Bluetooth HID proxy, I would say ESP32-S3 would be most suitable with USB OTG with HID examples and Bluetooth capabilities available as well.

leopck avatar Jan 13 '22 04:01 leopck

Sounds very promising then! Should you or @houkanshan make an all-on-one solution with an ESP32, I'll be happy go get my hand on one and do some tests with my two bluetooth keyboards (Logitech K810 and K380). If mouse support is added, I also have a Logitech M535 Bluetooth mouse.

Jerther avatar Jan 13 '22 13:01 Jerther

@Jerther I just realized that you were also asking about the BT HID host mode which is required to pair the keyboard/mouse into the ESP32, but doesn't seem like there's an existing example on BT HID host mode, but there's an example of using BT HID client mode (to act as a keyboard) https://gist.github.com/manuelbl/66f059effc8a7be148adb1f104666467

leopck avatar Jan 14 '22 09:01 leopck

Hi @leopck @Jerther , thanks a lot! ESP32-S3 looks really cool. I just ordered one, when it arrives I'll play with it and see what I can get.

houkanshan avatar Jan 16 '22 17:01 houkanshan

Please keep us updated, I am also interested in using the ESP32. Ordered the missing components for the ARDUINO version to play around with it but for sure would like a miniaturized ESP32 :).

Will keep an eye on this thread and maybe I can help with as well.

fkahhaleh avatar Jan 23 '22 03:01 fkahhaleh

@houkanshan @Jerther I found a code that has implemented a Bluetooth HID Host mode accepting keyboard as input into ESP32. It might be worth a look at their implementation.

https://github.com/bozont/Duke3D/commit/51f1ce4f3b74f16f1adfc6fefc9d6afce2ef82d8

Demo video: https://www.reddit.com/r/esp32/comments/mtcpug/duke_nukem_3d_with_bluetooth_keyboard_control/?utm_medium=android_app&utm_source=share

leopck avatar Feb 02 '22 13:02 leopck

@houkanshan Did you get your S3? How is it? I hope you have some good news ;)

Jerther avatar Apr 15 '22 00:04 Jerther

Hey @Jerther , I got it. But unfortunately I was not able to connect it to my Magic Keyboard (Bluetooth 3.0) so I did not continue at that time. I might try again later.

houkanshan avatar Apr 20 '22 03:04 houkanshan

@houkanshan I'd like to contribute but my knowledge and most of all my spare time are fairly limited. I'm still willing to get my hand on a proper ESP32 and do some tests for you, but I would need some directions. I have access to a logitech K810 and a K380.

If you're interrested, could you point me to the exact ESP32 make and model I should look for?

Jerther avatar Jun 23 '22 14:06 Jerther

Any progress?

If you're interrested, could you point me to the exact ESP32 make and model I should look for?

I think Wemos S3 MINI or C3 Boards are good candidates for this: https://www.wemos.cc/en/latest/c3/index.html https://www.wemos.cc/en/latest/s3/s3_mini.html

bam80 avatar Jan 29 '24 22:01 bam80