Simple Pico Custom Keyboard



This instructables show how to build a super simple custom keyboard.
This project only requires 2 components and even not require soldering.
Supplies

Raspberry Pi Pico RP2040 dev board
ST034 button module or any button module you have in hand
Why Custom Keyboard?

Tradition full size keyboard have 104/105 keys. However smaller size keyboard may miss some keys. For example, my currently using keyboard did not have a print screen key. It is a little bit clumsy when I need some screen capture for documentation. Same situation for missing HOME, END, PAGE UP and PAGE DOWN keys. So I would like to add some keys back.
Software Preparation
Please follow the installation instruction to install Arduino-pico support if not yet:
Assembly



Please follow the video for assembly. Something highlight, the Pi Pico pins have a GND pin in the middle between GPIO 2-9. So it needs to bend the pin headers a little bit to skip this pin.
Sample Program
I prepared a simple sample program based on Pico keyboard.ino example:
https://github.com/moononournation/PicoKeyboard.git
This sample program use an interrupt function stored the GPIO status while key pressed down (falling signal), then check the stored status in loop() function then trigger a key press to emulated USB keyboard.
For example, check K1 pressed:
if ((pin_status & (1ul << BTN_K1_PIN)) == 0) {
If K1 pressed, emulate a print screen key press:
Keyboard.press(KEY_PRINT_SCREEN);
delay(100);
Keyboard.releaseAll();
More key defination can be found at HID_Keyboard.h:
Advanced Use
You may already found fit can emulate more complicate key combination. E.g. Ctrl-K then Ctrl-D for the format shortcut in VSCode. In the Pico original keyboard.ino example, it even can emulate typing the password (But it is not a good idea through...).
Some new Windows notebook have a new special key dedicate for calling copilot.
Pushing a computer's integrated Copilot button is like pressing left-Shift + Windows key + F23 simultaneously.
The keys are hard to found from any keyboard in the market, but you still can emulate the new key by this custom keyboard.
Ref.:
Enjoy!

