All Projects → asterics → Esp32_mouse_keyboard

asterics / Esp32_mouse_keyboard

Licence: gpl-3.0
ESP32 implementation for HID over GATT Keyboard and Mouse (Bluetooth Low Energy). Including serial API for external modules (similar to Adafruit EZKey HID)

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Esp32 mouse keyboard

Esp32 Ble Mouse
Bluetooth LE Mouse library for the ESP32 (Arduino IDE compatible)
Stars: ✭ 180 (-57.14%)
Mutual labels:  esp32, ble
BlueRetro
Multiplayer Bluetooth controllers adapter for retro video game consoles
Stars: ✭ 520 (+23.81%)
Mutual labels:  hid, esp32
Openmqttgateway
MQTT gateway for ESP8266, ESP32, Sonoff RF Bridge or Arduino with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, Bluetooth, beacons detection, mi flora, mi jia, LYWSD02, LYWSD03MMC, Mi Scale, TPMS, BBQ thermometer compatibility, SMS & LORA.
Stars: ✭ 2,413 (+474.52%)
Mutual labels:  esp32, ble
Pedalinomini
Same features of Pedalino™ in a compact form.
Stars: ✭ 139 (-66.9%)
Mutual labels:  esp32, ble
Arduino-BLE-MIDI
MIDI over Bluetooth Low Energy (BLE-MIDI) 1.0 for Arduino
Stars: ✭ 133 (-68.33%)
Mutual labels:  esp32, ble
Blinker Doc
blinker中文文档
Stars: ✭ 139 (-66.9%)
Mutual labels:  esp32, ble
ESP32BleAdvertise
Simple library for BLE advertise using ESP32 in Arduino
Stars: ✭ 39 (-90.71%)
Mutual labels:  esp32, ble
Open Home Automation
Open Home Automation with Home Assistant, ESP8266/ESP32 and MQTT
Stars: ✭ 820 (+95.24%)
Mutual labels:  esp32, ble
esphome-components
ESPHome components
Stars: ✭ 62 (-85.24%)
Mutual labels:  esp32, ble
arduino-ble-gadget
Create your own Do-It-Yourself BLE enabled sensor gadget on the ESP32 platform.
Stars: ✭ 31 (-92.62%)
Mutual labels:  esp32, ble
Nimble Arduino
A fork of the NimBLE library structured for compilation with Ardruino, designed for use with ESP32.
Stars: ✭ 108 (-74.29%)
Mutual labels:  esp32, ble
Esp32 Ble2mqtt
A BLE to MQTT bridge running on an ESP32
Stars: ✭ 301 (-28.33%)
Mutual labels:  esp32, ble
Blinker Library
An IoT Solution,Blinker library for embedded hardware. Works with Arduino, ESP8266, ESP32.
Stars: ✭ 1,095 (+160.71%)
Mutual labels:  esp32, ble
Esp32 Blecollector
ᛡᛒ BLE Scanner + Data persistence on SD Card for M5Stack, Odroid-Go, ESP32-Wrover-Kit and other models
Stars: ✭ 145 (-65.48%)
Mutual labels:  esp32, ble
Esp32 ble wedo
A library to control LEGO wedo 2.0 with the ESP32 through Bluetooth low energy
Stars: ✭ 16 (-96.19%)
Mutual labels:  esp32, ble
ESP-Alerts-for-Android
Send Android Notifications to an ESP32 with OLED display
Stars: ✭ 42 (-90%)
Mutual labels:  esp32, ble
Esp32 Ble Keyboard
Bluetooth LE Keyboard library for the ESP32 (Arduino IDE compatible)
Stars: ✭ 533 (+26.9%)
Mutual labels:  esp32, ble
Esp32 ble arduino
The library source for the ESP32 BLE support for Arduino.
Stars: ✭ 552 (+31.43%)
Mutual labels:  esp32, ble
ESP32-USB-Soft-Host
An Arduino wrapper to @sdima1357's usb_soft_host esp-idf example
Stars: ✭ 119 (-71.67%)
Mutual labels:  hid, esp32
ESP32 BLE OTA Arduino
OTA update on ESP32 via BLE
Stars: ✭ 41 (-90.24%)
Mutual labels:  esp32, ble

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).

Compatibility

Due to the wide variety of hardware & software combinations, it is hard to guarantee compatibility. Nevertheless, we try to test this project with as much devices as possible.

Tested devices by the AsTeRICS team:

Device Mouse Keyboard
PC with CSR 4.0 BT dongle, Debian Bullseye yes yes
Lenovo T440s, Debian Buster yes yes
MacBook Pro (Mid 2012) - macOS Mojave 10.14 yes yes
PC with CSR 4.0 BT dongle, Win10 Build 2004 yes yes
Lenovo T440s, Win10 Build 2004 in VirtualBox no no
Xiaomi Mi A1 - LineageOS 16.0 (Android 9) yes yes
Asus Nexus 7 (2013) - Android 6.0.1 yes yes
iPad Air 2 (MGL12FD/A9 - iOS 13.3.1 yes (Assistive Touch) yes (Text input & accessible switch interface)
iPad Air 2 (MGL12FD/A9 - iOS 13.5.1 yes (Assistive Touch) yes (Text input & accessible switch interface)
iPad Pro 10.5" (MPHG2TY/A) - iOS 13.5.1 yes (Assistive Touch) yes (Text input & accessible switch interface)
iPad 6th Gen (MR7J2FD/A) - iOS 13.5.1 yes (Assistive Touch) yes (Text input & accessible switch interface)

Note: On some iPad devices, there might show up a notification in the Bluetooth menu, that this device may affect WiFi or Bluetooth performance. You could ignore this error, according to StackOverflow there is no clear reason for this message, maybe it is related to the additional WiFi interface of the ESP32 (other user report this error if a normal mouse has an additional USB-dongle).

Note: If you can report the compatibility status for a device, we would be happy to add a list of community tested devices, just open an issue with the label device-testreport.

Building the ESP32 firmware

Please follow the step-by-step instructions of Espressif's ESP-IDF manual to setup the build infrastructure: Setup Toolchain

With idf.py build or make you can build this project.

With idf.py -p (PORT) flash or make flash you can upload this build to an ESP32

With idf.py -p (PORT) monitor or make monitor you can see the debug output (please use this output if you open an issue) or trigger basic test commands (mouse movement or a keyboard key press) on a connected target.

Usage via Console or second UART

Control via stdin (make monitor)

For basic mouse and keyboard testing, some Bluetooth HID reports can be triggered via the keyboard when the make monitor console is running (see Espressif IDF docs: https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/tools/idf-monitor.html ).

Key Function Description
a Mouse left Move mouse left by 30px (MOUSE_SPEED define)
s Mouse down Move mouse down by 30px (MOUSE_SPEED define)
d Mouse right Move mouse right by 30px (MOUSE_SPEED define)
w Mouse up Move mouse up by 30px (MOUSE_SPEED define)
l Click left Mouse click right
r Click right Mouse click left
q Type 'y' (US layout) just for testing keyboard reports

Control via 2nd UART

This interface is primarily used to control mouse / keyboard activities via an external microcontroller.

Commands

Each command is started with a '$' character, followed by a command name (uppercase letters) and a variable number of parameters. A command must be terminated by a '\n' character (LF, ASCII value 10)!

Note: We do not test these on a regular basis!

Command Function Parameters Description
$ID Get ID -- Prints out the ID of this module (firmware version number)
$GP Get BLE pairings -- Prints out all paired devices' MAC adress. The order is used for DP as well, starting with 0
$GC Get active BLE connections -- Prints out connected paired devices' MAC adress. Ordered by connection occurance (first connected device is listed first)
$SW Switch between devices BT addr (001122334455) Switch between connected devices, the given BT addr will receive the HID packets
$DP Delete one pairing number of pairing, given as ASCII-characer '0'-'9' Deletes one pairing. The pairing number is determined by the command GP
$PM Set pairing mode '0' / '1' Enables (1) or disables (0) discovery/advertising and terminates an exisiting connection if enabled
$NAME Set BLE device name name as ASCII string Set the device name to the given name. Restart required.

HID input

We use a format which is compatible to the Adafruit EZKey module, and added a few backwards compatible features.

Mouse:

Byte 0 Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8
0xFD don't care 0x03 button mask X-axis Y-axis wheel don't care don't care

Keyboard:

Note: currently we only support the US keyboard layout.

Byte 0 Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8
0xFD modifier mask don't care keycode 1 keycode 2 keycode 3 keycode 4 keycode 5 keycode 6

RAW HID input from sourcecode

If you want to change anything within the sourcecode, it is possible to send an HID report directly via:

hid_dev_send_report(hidd_le_env.gatt_if, hid_conn_id,
                  HID_RPT_ID_MOUSE_IN, HID_REPORT_TYPE_INPUT, HID_MOUSE_IN_RPT_LEN, mouse_report);

Use according HID_RPT_ID_*/HID_*_IN_RPT_LEN, depending on input type (mouse, keyboard). The HID report data is located in array, passed as last parameter of hid_dev_send_report.

Mouse & Keyboard input from sourcecode

Please use the functions provided by esp_hidd_prf_api.c.

Credits and many thanks to:

  • Paul Stoffregen for the implementation of the keyboard layouts for his Teensyduino project: www.pjrc.com
  • Neil Kolban for his great contributions to the ESP32 SW (in particular the Bluetooth support): https://github.com/nkolban
  • Chegewara for help and support

and to Espressif for providing the HID implementation within the esp-idf.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].