In this instructable I will show you how to build your own custom USB keyboard that behaves just like a regular computer keyboard.
You can assign any key combination or sequence of keys to be pressed while pressing only one pushbutton.
You can use it to optimize your computer work by assigning various key combinations to just one physical key, so it makes your life easier.
You can make it a PC game controller.
You can even program it to write an essay by pressing only one key :) The sky is the limit.
I used it to control my CNC router manual movements, since I found using regular computer keyboard too bulky and cucumbersome to use.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: The Keyboard in Action
Here you can briefly see how the keyboard performs in real application.
Keyboard has 2 modes - step mode and continuous moving mode.
Step 2: Gather All the Stuff!
You will need:
- Arduino Pro Micro 32u4 which can mimic USB PC keyboard or mouse
- Pushbutton switches - I used ridiculously expensive(20$ a piece) NKK KP02 switches I got used from a friend. They are pushbutton switches with RGB LED inside. But you can use any pushbutton switch as you like, if you don't need the fancy LED effects. Or you can use some switches that have a hole for a regular RGB LED to slide in or next to it.
- TLC5940 IC (only if you need LED effects). I used the IC itself, but you can use the breakout board, If you don't plan to make your own PCB.
- 3d printer (optional)
- PCB making skills (optional)
- Basic electronics knowledge
- some time
- and nerves :)
Step 3: Schematics
Schematics are very simple.
I used some RC debouncing circuit for the switches(see image), so there is no need to worry for switch bouncing in the software. The LEDs in the switch have common anode.
For the TLC5940 LED drivers - I made my own PCB and I soldered the ICs directly on my PCB. The resistor from IREF to GND sets the current for driving LEDs.
If you are going to use breakout board, check the breakout board schematics. It should be pretty straightforward to connect the wires.
You probably don't need to use the 7 decoupling capacitors if you will use breakout board for LED driver.
Step 4: PCB and Enclosure
The PCB is not necessary step in this instructable, because I used non-hobby friendly programs and my switches are ridiculously expensive to buy, so I believe not many of you will actually make this very PCB that I made.
I encourage you to wire the project using breakout boards and protoboard wiring, or you can design your own PCB which will fit more affordable switches and LEDs.
I designed a quick pcb in Altium Designer. I used this program because I have a license, since I use it for work every day. I know this program is nowhere near hobby friendly price wise.
If anyone wants Altium or PCB gerber files say it in the comments and I will send them to you.
The box was drawn in Autodesk Inventor (also not hobby friendly program, but I use that at work too and I am used to it). If anyone wants .stl files for 3D print, please comment and I will send them to you.
Step 5: The Software
The code is made in arduino environment.
I used the Button library for managing all the buttons. It has nice features for reading buttons like key.uniquePress() and key.isPressed() for making our life easier.
Integrated arduino Keyboard library for making the board behave as PC keyboard.
TLC5940 library for controlling the led dimming and making all the nice fade ins and outs.
I attached the final arduino code. Keys are mapped similar to the regular PC keyboard in the code as per the attached image for easier handling.
The code can be easily modified for all sort of uses.
Step 6: Finished!
The keyboard works as a charm.
I used it to control my CNC router, but the possible applications are limitless.
Show me your ideas!
Participated in the