Skip to content

ifel/Web2HID

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web2HID

USB Keyboard with HTTP interface instead of keys.

It’s a microcontroller firmware that exposes a Wi-Fi web interface and emulates a USB keyboard when connected to a computer. Upon receiving an HTTP GET request, it sends the corresponding keypress to the computer.

Hardware

It is designed for ESP32-S2 / ESP32-S3 SOCs. Note, this project requires USB OTG support, and these models meet this requirement. See OTG models here.

It's been tested on Adafruit QT Py ESP32-S2. This board has a led, and this project uses it as a status indicator. If your board does not, you can easily disable this see options.

Warning

When you switch USB to the HID mode, the Serial console stops working, so you cannot see debug messages and cannot flash new hardware without resetting the board. Read below how to debug and flash the firmware.

Get started

  1. Install Arduino IDE
  2. Install required libraries:
    1. Adafruit Neopixel. Optional.
    2. Adafruit TinyUSB.
  3. Open this project in Adruino IDE.
  4. Put your SSID and WIFI password to definitions in the wifi_defs.h.
  5. Disable USB, see Configuration options.
  6. [Optional] Add key blocks, currently the board supports F5 and F8.
  7. Flash the firmware.
  8. Open Serial console, it will display IP address, when it's connected to WIFI.
  9. Send GET request (just open the URL in the browser or use curl command) to http://IP_from_serial_console/f5 to send F5 and http://IP_from_serial_console/f8 to send F8.
  10. If everything works as expected, you will see "Sent F5" in your browser and debug messages in the serial console, including request received.
  11. Once you're happy with the setup, enable USB and flash the board.
  12. You will still be able to see IP address in the Serial console (USB gets initialized after that), but it will not show any debug messages anymore.
  13. Have fun!

Configuration options

  • NeoPixel. If your board does not have NeoPixel, if you do not want to use it, simple comment "#define NEOPIXEL_SUPPORT" line at the beginning of the file. This will disable all NeoPixel functionality, and you don't need to install the library.

  • USB HID. When you start it for the first time, or you want to make changes and debug first, you may need access to the Serial console to see debug messages. Serial console on these boards connected via USB, so when USB is in HID mode, Seiral-to-USB stops working. Comment "#define SETUP_HID" line at the beginning of the file to disable USB HID and enable Serial console. In this mode, it will not be sending keystrokes, but sending code is pretty straightforward and does not need changes. Though you will see debug messages on the Serial console, and once you finish debugging, uncomment the line, so the controller will do what it's expected here.

Status LED

The code uses Adafruit's Neopixel LED to indicate status.

Booting:

  1. LED blinks red - waiting to connect to WIFI
  2. LED is blue - setting up keyboard

Work:

  1. LED is green - ready to process request
  2. LED is yellow - client connected, receiving/sending data via HTTP
  3. LED is blue - sending keystroke

Flash new firmware

As USB serial console does not work, the board needs to be reset to flash new firmware, please refer to you board manual. For Adafruit QT Py ESP32-S2 read the Factory Reset page.

About

USB Keyboard with HTTP interface

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors