Return to site

Esp32 Usb Keyboard

broken image


June 16, 2012

Allows an Arduino/Genuino board with USB capabilites to act as a Keyboard.

How to Use Bluetooth(BLE) With ESP32: #####NOTE#####The method shown in this Instructables is old and outdated. Watch this video for the latest method.#####While the ESP32 boasts an extensive feature list (Wikipedia), the biggest feature that draws the eye is the built-in blue. ESP32-S2 240MHz Tensilica processor - the next generation of ESP32, now with native USB so it can act like a keyboard/mouse, MIDI device, disk drive, etc! WROVER module has FCC/CE certification and comes with 4 MByte of Flash and 2 MByte of PSRAM - you can have huge data buffers; Lotsa power options - 6-12VDC barrel jack or USB type C or Lipoly battery. US$8.49 US$11.99 29% Off CardKB Mini Keyboard Module MEGA328P GROVE I2C USB ISP Programmer for ESP32 Development Board STEM Python 31 reviews COD US$13.28 US$15.32 13% Off 5Pcs ESP32 ESP32S 18650 Battery Charge Shield V3 Micro USB Type-A USB 0.5A Test Charging Protection Board Wemos for Arduino - products that work with official Arduino boards.

Converting a C64 Keyboard to USB with Arduino

After renovating some Commodore 64 computers, 'bisrhythm' found themselves with a few extras that were beyond repair. So instead of gathering dust in the cupboard, they have been modified to work with more contemporary PCs.


As the C64 keyboard is an 8x8 button matrix, the conversion was quite simple. The use of a virtual-USB library finalises the task and works well. Even the power LED can be illuminated for maximum realism.

When reproducing your own C64 keyboard there isn't that much circuitry to add to the keyboard. Therefore the use of one of our Arduino-compatible boards such as the Freetronics Eleven, and a ProtoShield would solve the problem nicely:

Amnesia memories game download.

So if you have your own C64 in terminal condition and want to convert it to a keyboard, the instructions, sketch and notes can be found here.

This library allows you to make the ESP32 act as a Bluetooth Keyboard and control what it does.
You might also be interested in:

Features

Esp32 Usb Keyboard

  • [x] Send key strokes
  • [x] Send text
  • [x] Press/release individual keys
  • [x] Media keys are supported
  • [ ] Read Numlock/Capslock/Scrolllock state
  • [x] Set battery level (basically works, but doesn't show up in Android's status bar)
  • [x] Compatible with Android
  • [x] Compatible with Windows
  • [x] Compatible with Linux
  • [x] Compatible with MacOS X (not stable, some people have issues, doesn't work with old devices)
  • [x] Compatible with iOS (not stable, some people have issues, doesn't work with old devices)

Installation

Can I use an USB Keyboard with RS232 on ESP32 ?
  • (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/

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 Hid

Esp32 read usb keyboard
  • (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/

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 Hid

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

ESP32 As Bluetooth Keyboard · GitHub

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

Esp32 Usb Keyboard Adapter

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!





broken image