This is a Star Wars theme inspired device that you can connect to your computer and it will act as a fully functional HID keyboard.
Features:
- 5 configurable buttons
- A safety switch with a safety LED
- 2 additional LEDs
- 3D-printable case
In the source code you can define what keycodes will be sent when the buttons are pressed. Check for the Key definitions
section and update the values for your needs.
Useful sources:
- Keyboard Modifiers in the Arduino Reference
- usb_hid_keys.h
- USB HID Usage Table
- USB HID Usage Tables specification
- Arduino HID Library Reference
- NicoHood HID Project
- PluggableUSB and PluggableHID howto low-level
This device acts as a HID keyboard when connected to your computer via USB. If the code is faulty there's a chance that it will send random keycodes to your computer that can make uploading a fixed code impossible.
Safety switch to the rescue! If the safety switch is not pressed the keyboard will not send any keycodes to your computer, but keeps the code running on the Arduino, so you can keep it powered and upload new code to it.
- 1pc Arduino Pro Micro - it has a
ATmega32U4
chip that provides the required USB capabilities. This board is available in two variants, I used the 5V version. - 1pc red LED
- 2pcs white LEDs
- 3pcs 220Ω resistors - you may need different values if you use different LEDs or the 3.3V Arduino Pro Micro
- 5pcs 12×12×7.3mm tactile momentary button
- 1pc 8×8mm push-button switch
- 5pcs M3x5 screws (4 for the cover, 1 for fixing the Arduino board)
- Wires
- Glue
- Optional: if you do not want to solder the wires directly to the Arduino you can use right angle pin headers and Dupont connectors. I used jumper wires.
The following image shows how the buttons and LEDs are named both in the wiring diagram and in the code:
Note that not all parts are functional, some are greeblies.
You can see the wiring in the Fritzing file in the wiring
folder:
Notes:
- The
H1
-H3
(horizontal) and theV1
-V2
(vertical) buttons are momentary buttons. - The
Armed button
is a latching switch. - You may need to adjust the resistors' values to the LEDs and the Arduino variant you use.
- The
LED V1
andLED v2
must be connected to PWM ports to be dimmable from code.
You can see how I did the wiring in the photos folder.
You will need the following filament colors if you do not want to paint them:
- Grey for the case bottom and the top and the button frames
- Matte Black for the top frames
- Glossy black for the round greeblie
- White and blue for the button caps and for the stripes
- Transparent red for the armed LED cap
- Silver for the data port greeblie's outer rims
- Gold for the data port greeblie's inner shaft
Needless to say you can choose different colors or paint the parts.
The 3D printable models are available on Thingiverse and also on PrusaPrinters. I designed the model in Fusion 360 and published both the source files and exported them in STEP format so you can customize it to your needs.
No parts require supports, but you have to rotate some parts upside down and lay the case bottom part to the print bed.
You can print most parts with 0.3mm layer height, but I recommend printing the data port outer rims and the case bottom with 0.2mm. Because the parts are designed to snap fit to each other make sure your first layer width is dialed in correctly or configure elephant foot compensation.
The 3D printed parts are designed fit tight tolerance, they should snap fit together, though you may need a little glue to keep them in place.
The button caps are designed with a slightly larger tolerance, but if you still experience some friction when pressing the buttons you can sand their sides.
The labels are not part of the 3D models, I used David Occhino's free Arubesh font to create them with my Silhouette Cameo and matte black vinyl. You can find the files in the labels folder.
Other sources for the Arubesh font:
You can create the stripes either with 3D printer, vinyl cutter or you can simply paint them.
It is very easy to create a HID device with the Arduino Pro Micro and there are many tutorials out there to get started:
- Turn your ProMicro into a USB Keyboard/Mouse SparkFun tutorial
- Custom Macro Mechanical Keypad with an OLED display.
Interestingly this board has a unique personality and reset is tricky:
- Pro Micro Hookup Guide with a Reset to Bootloader section.
- Getting Started with Arduino Micro with an Uploading Code section at the very beginning.
When you create a HID device having a physical button that prevents the device to send messages to your computer is a MUST. Otherwise updating the device can be a PITA if your code is buggy.
The tactile momentary button is not ideal for a keyboard. It is not as comfortable as real keyboard keys and the box makes its clicking sound much louder.
- MechanicalKeyboards for all the Click and None of the Clack guide on Reddit
- Mechanical Keyboard Guide
You can spend many, many, many hours figuring out how to dress your thing Star Wars style using shapes, stripes and of course greeblies.
External USB-connected numberic keypads are surprisingly cheap.
This project was inspired by David E. Madison's Building a DIY Stream Deck and The Smugglers Room. Thanks both for sharing their passion and knowledge with the community.
This project was created by György Balássy.