The reliable Original Prusa MK4S is now available in discounted bundles with the MMU3 and Enclosure. Grab yours today!

Programable Button Box with encoder and screen

This is a 17 key button box with an encoder and an OLED screen. It utilized a $4 Raspberry Pi Pico as the brains.
31
68
0
1128
updated July 8, 2022

Description

PDF

This is a Button Box with 17 programable buttons as well as a rotary encoder and an OLED screen. This box is very customizable using some simple python code. You can program it to send individual key commands or program macros to send with the push of a button.

I used Thonny to put it all together but you can really use anything including a text editor like Notepad++.

Attn: You will also need the file font5x8.bin. Printables will not let me upload a bin file so I am including a link to the Git page. https://github.com/adafruit/Adafruit_CircuitPython_framebuf/blob/main/examples/font5x8.bin

The font5x8.bin file should be placed in the same spot as your code.py file. See font5x8_file_placement.pdf for a screenshot.

 

Printing: 

Since I didn't need a lot of detail, I printed at .3 layer height in PETG for the case and .2 for the knob.

 

Hardware:

1 - Raspberry Pi Pico

1 - KY-040 Rotary Encoder

1 - .96in. SSD1306 compatible display. I used this one: https://a.co/d/by2PZQ6

16 - keyboard switches. I used these: https://a.co/d/dBdjb3q

16 - keycaps. I used some that I had laying around but any will work as long as they're compatible with the switches you choose.

 

Code:

I've added all of the Python code that I used except the font5x8.bin file which you will need to get from Adafruit's Github since Printables won't let me upload it here.

You can modify any of the keys by replacing the command with any (single or combination) of commands from the attached Keycode.py file.

The current setup has the rotary encoder setup to control Volume up/down and the encoder button is setup for Mute/Unmute.

I also setup the keys to link to numbers and symbols but they can be easily changed to any combination of the keycodes found in keycode.py

 

*** Important note ***

You will need to make sure you have included all of the module files in a folder named \lib

within that folder you will also need to have a folder named adafruit_hid. The files should follow the structure in file_structure_for_modules.pdf.

in the \lib file you should have the following:

(folder named) adafruit_hid 

adafruit_framebuf.py

adafruit_ssd1306.py

 

in the \lib\adafruit_hid folder you should have the following:

__init__.py (When you download all of the files from Printables.com it will change the filename of this file. You will need to add two underscores to both sides of init.py to make it __init__.py.

consumer_control.py

consumer_control_code.py

keyboard.py

keyboard_layout_base.py

keyboard_layout_us.py

keycode.py

mouse.py

 

Wiring diagram:

I've included a wiring diagram based on how mine is setup for reference. 

Tags



Model origin

The author marked this model as their own original creation.

License


Highlighted models from creator

View more