Universal USB Keyboard With RGB Switches

338

10

2

Published

Introduction: Universal USB Keyboard With RGB Switches

About: I mostly do electronics, PCBs and simillar, but I also like metalworking, woodworking, fixing things and all sort of cool and stupid things :)

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.

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!

Share

    Recommendations

    • Water Contest

      Water Contest
    • Clocks Contest

      Clocks Contest
    • Creative Misuse Contest

      Creative Misuse Contest

    2 Discussions

    I have a couple of questions about your "Universal USB Keyboard with RGB Switches." Cool project, looks useful.

    In the text portion of the Instructable it talks about a TLC5904, while in the schematic it shows TLC5940, and it shows 2 28 pin ICs. Your PCB indicates only 1 IC with 24 pins.

    The other question I have is, I don't see the interface with the Arduino Pro Mini. You wouldn't happen to have a Fritzing of your diagram, and a more detailed PCB design?

    1 more answer

    Hi,

    Yes there was a typo. Already corrected. The correct one is TLC5940. I used 2 ICs because I needed 30 channels. (10 buttons with 3 colors each)
    The interface with Arduino is with serial interface with signals SIN XLAT SCLK, GSCLK, plus BLANK. The library handless all the stuff so you just need to wire it correctly. Look at the net names. Same names connect together through the schematic. i didn't use Fritzing, because it is too many wires and it would not be as easy to read. Just follow the names and imagine a wire between same names.