Kenji Kozai: Web Keyboard

Web Keyboard

This project turns a Raspberry Pi Pico W into a web-based keyboard. Keyboard input from a webpage is captured and forwarded to the Pico W’s host device. (YouTube video)

The latest version has improved performance by using a WebSocket connection instead of HTTP GET requests sent from a JavaScript queue. A WebSocket implementation that can be run alongside an unmodifed HTTPD module was written on top of lwIP to support the lower latency protocol.

Keypresses received from the lwIP server are sent to the host device using the standard 8 byte HID keyboard boot protocol over TinyUSB. It would be possible to modify the USB Descriptor sent by the Pico W to one that supports n-key rollover (NKRO) so that if your keyboard supports NKRO, then all pressed keys (instead of the 6 plus modifier keys supported by the boot protocol) can be transmitted. A rudimentary mouse GUI with buttons for moving in the cardinal directions and for left and right clicks has also been included.

The networking information entered by the user is saved to the last sector of the flash. In the case that a static address incompatible with the network for the SSID/password is saved so that the Pico W establishes a connection as a Wi-Fi client but has an IP address that is unreachable from the network, reflashing the program UF2 file will not clear this part of the flash. The recovery method in this instance is to completely nuke the device flash before reflashing the program or setup a network with the same SSID/password combination that is saved but with an IP range that allows accessing the web interface to reset the networking information. An alternative reset feature similar to a “reset” button is a future nice-to-have.

Code Repository

Tags: