ESP32 Mouse/Keyboard for BLE HID. ESP32 implementation for HID over GATT Keyboard and Mouse (Bluetooth Low Energy). Including serial API for external modules (compatible to Adafruit EZKey HID). Due to the wide variety of hardware & software combinations, it is. Feb 13, 2020 To me, pairing a readily available BT keyboard to an ESP32 would be much more useful, same for USB-HID Keyboards, i.e. With the ESP32 acting as a host Report comment Reply. ESP32 BLE HID Keyboard With a keyboard, you can control anything, from your phone, iPad, laptop. This will give Arduino the power it needs to control any screen. Advanced Full instructions provided 7,061. Bluetooth LE Keyboard library for the ESP32 (Arduino IDE compatible) - crackerboy/ESP32-BLE-Keyboard.
This library allows you to make the ESP32 act as a Bluetooth Keyboard and control what it does.
You might also be interested in:
See full list on github.com.
Features
- Send key strokes
- Send text
- Press/release individual keys
- Media keys are supported
- Read Numlock/Capslock/Scrolllock state
- Set battery level (basically works, but doesn't show up in Android's status bar)
- Compatible with Android
- Compatible with Windows
- Compatible with Linux
- Compatible with MacOS X (not stable, some people have issues, doesn't work with old devices)
- Compatible with iOS (not stable, some people have issues, doesn't work with old devices)
Installation
- (Make sure you can use the ESP32 with the Arduino IDE. Instructions can be found here.)
- In the Arduino IDE go to 'Sketch' -> 'Include Library' -> 'Add .ZIP Library...' and select the file you just downloaded.
- You can now go to 'File' -> 'Examples' -> 'ESP32 BLE Keyboard' and select any of the examples to get started.
Example
API docs
The BleKeyboard interface is almost identical to the Keyboard Interface, so you can use documentation right here:https://www.arduino.cc/reference/en/language/functions/usb/keyboard/
GitHub - Michalhol/ps2kbdlib: PS2 Keyboard Library For ESP32 ...
Just remember that you have to use bleKeyboard
instead of just Keyboard
and you need these two lines at the top of your script:
Esp32 Usb Keyboard
In addition to that you can send media keys (which is not possible with the USB keyboard library). Supported are the following:
- KEY_MEDIA_NEXT_TRACK
- KEY_MEDIA_PREVIOUS_TRACK
- KEY_MEDIA_STOP
- KEY_MEDIA_PLAY_PAUSE
- KEY_MEDIA_MUTE
- KEY_MEDIA_VOLUME_UP
- KEY_MEDIA_VOLUME_DOWN
- KEY_MEDIA_WWW_HOME
- KEY_MEDIA_LOCAL_MACHINE_BROWSER // Opens 'My Computer' on Windows
- KEY_MEDIA_CALCULATOR
- KEY_MEDIA_WWW_BOOKMARKS
- KEY_MEDIA_WWW_SEARCH
- KEY_MEDIA_WWW_STOP
- KEY_MEDIA_WWW_BACK
- KEY_MEDIA_CONSUMER_CONTROL_CONFIGURATION // Media Selection
- KEY_MEDIA_EMAIL_READER
There is also Bluetooth specific information that you can set (optional):Instead of BleKeyboard bleKeyboard;
you can do BleKeyboard bleKeyboard('Bluetooth Device Name', 'Bluetooth Device Manufacturer', 100);
.The third parameter is the initial battery level of your device. To adjust the battery level later on you can simply call e.g. bleKeyboard.setBatteryLevel(50)
(set battery level to 50%).By default the battery level will be set to 100%, the device name will be ESP32 Bluetooth Keyboard
and the manufacturer will be Espressif
.
Credits
Ble Keyboard
Credits to chegewara and the authors of the USB keyboard library as this project is heavily based on their work! Also, credits to duke2421 who helped a lot with testing, debugging and fixing the device descriptor!
Most people associate the ESP family of microcontrollers with WiFi, which makes sense as they’ve become the solution of choice for getting your project online quickly and easily. But while the WiFi capability might be the star of the show, the ESP32 also comes equipped with Bluetooth; we just don’t see people using it nearly as often. If you’re looking to get started using Bluetooth on the ESP32, then this simple wireless macro keypad from [Brian Lough] would be a great way to get started.
Esp32 Usb Hid Keyboard
From a hardware standpoint, this project is incredibly straightforward. All you need to do is connect a membrane keypad up to the GPIO pins on the ESP32. Adding in a battery is a nice touch, and you probably would want to put it into a enclosure of some sort, but as a proof of concept it doesn’t get much easier than this. In this case [Brian] is using the TinyPICO board, but your personal ESP32 variant of choice will work just as well.
The rest of the project is all software, which [Brian] walks us through in the video after the break. There’s a preexisting library for Bluetooth Human Interface Device (HID) emulation on the ESP32, but it needs to be manually installed in the Arduino IDE. From there, he demonstrates how you can build up a functioning keyboard, including tricks such as sending multiple virtual keys at once.
In the past we’ve seen the ESP32 used to create a Bluetooth game controller, but the ability to emulate a keyboard obviously offers quite a bit more flexibility. With a practical demonstration of how easy as it is to turn this low-cost microcontroller into a wireless input device, hopefully we’ll start seeing more projects that utilize the capability.