Thanks to visit codestin.com
Credit goes to github.com

Skip to content

kojedt/BLE_kb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Here’s a clean, professional, and technical-style README.md you can use directly for your GitHub repository of this BLE keyboard ESP32 project 👇

🧠 ESP32 BLE Keyboard

This project turns an ESP32 into a Bluetooth Low Energy (BLE) Keyboard (HID device) capable of sending keystrokes, system, and media control commands to a paired device such as a computer, smartphone, or tablet.

It uses the BleKeyboard library for Arduino to emulate a standard Bluetooth keyboard.


⚙️ Features

Function Description
BLE Keyboard Emulation ESP32 acts as a standard Bluetooth keyboard (HID).
Automatic Text Sending Sends "Hello world" every loop when connected.
Keyboard Key Events Sends standard keys such as Enter, Ctrl, Alt, Del, etc.
Media Key Events Controls system media keys such as Play/Pause.
Connection Detection Operates only when a BLE client is connected.
Debug via Serial Prints log messages on the serial console for debugging.

🧩 Example Operation

When powered on:

  1. ESP32 starts advertising as a BLE keyboard.
  2. You can pair it with your computer or phone (shows up as "ESP32 Keyboard").
  3. Once connected:
    • Types "Hello world".
    • Presses Enter.
    • Sends Play/Pause media key.
    • (Optionally) Sends Ctrl+Alt+Del combination.

🧰 Hardware Requirements

  • ESP32 development board (with BLE support)
  • USB cable for programming
  • (Optional) Push button or input device if adding manual triggers

🧾 Software Requirements

  • Arduino IDE or PlatformIO

  • BleKeyboard Library
    Install via Arduino Library Manager or clone manually:

    https://github.com/T-vK/ESP32-BLE-Keyboard
    

🧱 Code Explanation Main Sections

  1. Initialization BleKeyboard bleKeyboard;

void setup() { Serial.begin(115200); Serial.println("Starting BLE work!"); bleKeyboard.begin(); }

Starts the BLE service and serial logging.

  1. Main Loop if (bleKeyboard.isConnected()) { bleKeyboard.print("Hello world"); bleKeyboard.write(KEY_RETURN); bleKeyboard.write(KEY_MEDIA_PLAY_PAUSE); }

Checks if connected.

Sends text, Enter key, and Play/Pause media key.

  1. (Optional) Modifier Keys bleKeyboard.press(KEY_LEFT_CTRL); bleKeyboard.press(KEY_LEFT_ALT); bleKeyboard.press(KEY_DELETE); delay(100); bleKeyboard.releaseAll();

Demonstrates sending multiple modifier keys (e.g. Ctrl+Alt+Del).

🧪 Example Serial Output Starting BLE work! Sending 'Hello world'... Sending Enter key... Sending Play/Pause media key... Waiting 5 seconds...

🧩 Future Enhancements

Add GPIO trigger button to send keystrokes manually.

Add custom key sequences from configuration file or serial input.

Extend to BLE Mouse or BLE Gamepad mode.

⚠️ Notes

Some key combinations (e.g. Ctrl+Alt+Del) are blocked on Windows for security reasons.

BLE HID may not be supported on some Android versions without user permission.

Works best with ESP32-WROOM, ESP32-S3, or similar boards supporting BLE.

🧑‍💻 Example Use Cases

Wireless automation keyboard

Presentation or media remote

Test keyboard input automation

Security and accessibility tools

Author: JExplorer Platform: ESP32 BLE HID (Arduino / PlatformIO) Repository: https://github.com/kojedt/ESP32-BLE-Keyboard

About

ref from T-vK/ESP32-BLE-Keyboard

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages