BleKbdHost

BleKbdHost is a non-blocking BLE HID Keyboard Host (HOGP) library for ESP32 and M5Stack built on NimBLE-Arduino 2.5.2.

BleKbdHost turns your ESP32 into a central host (receiver) so you can connect off-the-shelf Bluetooth Low Energy keyboards directly to your embedded projects.

Key features

  • Pairing with BLE keyboards

    Connects to Bluetooth Low Energy keyboards that support the HID over GATT Profile (HOGP). Scans for new devices only during a timed window to prevent accidental pairing with nearby BLE devices.

  • Reconnection with paired keyboards

    Reconnects to saved keyboards using NimBLE security bonds, and caches device names in ESP32 NVS so your app can display them even while disconnected.

  • Non-blocking architecture

    Keeps your main loop() and UI rendering responsive by running BLE scanning, connection, encryption, and HID notification handling in a dedicated FreeRTOS background task.

  • State reporting for custom UIs

    Exposes connection state transitions (pollStateChange()), pairing countdown timers, active device names, and saved NVS device lists so you can drive displays or status LEDs directly from your main loop.

  • US and JIS (Japanese) keymaps

    Switches keymaps at runtime between US and JIS, including JIS-specific keys (¥, ろ, 半角/全角, 無変換, 変換, カタカナ/ひらがな, かな, and 英数) and 16-bit Consumer Control media keys.

Documentation contents

  • Get started

    Requirements, PlatformIO installation, quick start sketch, and connection state lifecycle.

  • Examples

    Build instructions, screen layouts, touch and button controls, and serial commands for QuickStart, M5Core2_Basic, and M5Core2_KeyInspector.

  • API reference

    Class methods, KeyEvent and PairedDevice structs, SpecialKey values, JIS character notes, and debug logging.

  • Compatibility and HOGP notes

    Tested hardware and keyboards, HOGP protocol details, multi-OS keyboard mode tips, limitations, and raw report inspection.

License

Released under The 3-Clause BSD License.