# Can I use the ESP32 with the keyboard library?

**URL:** <https://forum.arduino.cc/t/can-i-use-the-esp32-with-the-keyboard-library/1007445>\
**Category:** 3rd Party Boards\
**Created:** [June 28, 2022, 1:03pm UTC](https://forum.arduino.cc/t/can-i-use-the-esp32-with-the-keyboard-library/1007445 "2022-06-28T13:03:35Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![xsuertuo](https://avatars.discourse-cdn.com/v4/letter/x/48db29/32.png) [@xsuertuo](https://forum.arduino.cc/u/xsuertuo)\
**Post date:** [June 28, 2022, 1:03pm UTC](https://forum.arduino.cc/t/can-i-use-the-esp32-with-the-keyboard-library/1007445/1 "2022-06-28T13:03:35Z")

</div>

I want to know if it is possible to use the keyboard library with the ESP32 but I have not found information regarding that

---

<div class="post-metadata">

**Author:** ![cotestatnt](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/cotestatnt/32/238781_2.png) [@cotestatnt](https://forum.arduino.cc/u/cotestatnt)\
**Post date:** [June 28, 2022, 1:08pm UTC](https://forum.arduino.cc/t/can-i-use-the-esp32-with-the-keyboard-library/1007445/2 "2022-06-28T13:08:00Z")

</div>

No, that library is for board with ATmega32u4 or SAMD MCUs.

With ESP32 you could easily implement a BLE HID device, check a tutorial like [this](https://www.hackster.io/user0448083246/esp32-ble-hid-keyboard-37a103) for example.

edit:  
The [library](https://github.com/T-vK/ESP32-BLE-Keyboard) used in the example

---

<div class="post-metadata">

**Author:** ![xsuertuo](https://avatars.discourse-cdn.com/v4/letter/x/48db29/32.png) [@xsuertuo](https://forum.arduino.cc/u/xsuertuo)\
**Post date:** [June 28, 2022, 1:11pm UTC](https://forum.arduino.cc/t/can-i-use-the-esp32-with-the-keyboard-library/1007445/3 "2022-06-28T13:11:14Z")

</div>

But I have problems when connecting the esp32 via Bluetooth and I wanted to see if it was possible to do it via USB. use BLE keyboard library but connection fails

---

<div class="post-metadata">

**Author:** ![xsuertuo](https://avatars.discourse-cdn.com/v4/letter/x/48db29/32.png) [@xsuertuo](https://forum.arduino.cc/u/xsuertuo)\
**Post date:** [June 28, 2022, 1:13pm UTC](https://forum.arduino.cc/t/can-i-use-the-esp32-with-the-keyboard-library/1007445/4 "2022-06-28T13:13:40Z")

</div>

I wanted to use the ESP32 in this case because I don't have Arduino nano

---

<div class="post-metadata">

**Author:** ![cotestatnt](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/cotestatnt/32/238781_2.png) [@cotestatnt](https://forum.arduino.cc/u/cotestatnt)\
**Post date:** [June 28, 2022, 1:30pm UTC](https://forum.arduino.cc/t/can-i-use-the-esp32-with-the-keyboard-library/1007445/5 "2022-06-28T13:30:21Z")

</div>

> [@xsuertuo](#):
>
> I wanted to see if it was possible to do it via USB.

It's possible for sure, but not with the USB port used for flash programming: that port is connected to an USB/TTL converter. You need to emulate a HID device.

After a quick googling, I've found [this library](https://github.com/chegewara/EspTinyUSB) which should do what you are looking for.

---

<div class="post-metadata">

**Author:** ![xsuertuo](https://avatars.discourse-cdn.com/v4/letter/x/48db29/32.png) [@xsuertuo](https://forum.arduino.cc/u/xsuertuo)\
**Post date:** [June 28, 2022, 1:47pm UTC](https://forum.arduino.cc/t/can-i-use-the-esp32-with-the-keyboard-library/1007445/6 "2022-06-28T13:47:33Z")

</div>

With this I will be able to use the ESP32 in a USB keyboard? or will it still continue via bluetooth?

---

<div class="post-metadata">

**Author:** ![cotestatnt](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/cotestatnt/32/238781_2.png) [@cotestatnt](https://forum.arduino.cc/u/cotestatnt)\
**Post date:** [June 28, 2022, 1:51pm UTC](https://forum.arduino.cc/t/can-i-use-the-esp32-with-the-keyboard-library/1007445/7 "2022-06-28T13:51:05Z")

</div>

> [@xsuertuo](#):
>
> bluetooth

The library it's called EspTiny **USB** 😉

Check the readme in the repo and you will find all info needed.

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [June 28, 2022, 4:30pm UTC](https://forum.arduino.cc/t/can-i-use-the-esp32-with-the-keyboard-library/1007445/8 "2022-06-28T16:30:06Z")

</div>

Your topic has been moved to a more suitable location on the forum. _Installation and Troubleshooting_ is not for problems with (nor for advice on) your project 😉 See [About the Installation & Troubleshooting category](https://forum.arduino.cc/t/about-the-installation-troubleshooting-category/847458).

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [December 25, 2022, 4:30pm UTC](https://forum.arduino.cc/t/can-i-use-the-esp32-with-the-keyboard-library/1007445/9 "2022-12-25T16:30:50Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
