Intro: Capacitive Touch Keyboard Extension With Leonardo
The Arduino Leonardo is a wonderful microcontroller. In addition to maintaining the same form factor as the venerable Uno, it also has the ability to serve as a USB keyboard. This means that you can program your Leonardo to press specific keys or print strings in response to various stimuli.
Pair it with a few capacitive touch pads and you can produce a device that essentially adds four fully-programmable keys to your workspace! Use each key to type commonly-used phrases, perform specific macros, press hard-to-use key combinations, and so much more! This is an extremely simple project that's great for beginners. Below are the parts you'll need:
Step 1: Assembly
This part is exceedingly simple. All you need to do is insert the included JST cables into the sockets and begin wiring. All the black wires should be connected to ground, the red wires to 5V, and the green wires to pins 2, 3, 4, and 5. The Leonardo only has a few power pins so it's helpful to connect the ground and VCC wires together using a breadboard. For simplicity's sake I recommend that you arrange the pads in numerical order, starting with the pad connected to pin 2 on the left and ending with pin 5 on the right.
I also used some double-sided tape to hold the pads in place. You could accomplish this with a whole number of different household products.
Step 2: Example Sketch
Try uploading the attached software for this step to your Leonardo. Click on an empty text box and try pressing the pads to ensure that each one outputs a character. Go to http://www.apronus.com/music/flashpiano.htm and you can use each of the keys to play chords!
Step 3: Creating Hotkeys
This attached sketch allows Mac users to use their pads for some common keyboard combinations. You can find the full list of all key definitions at https://www.arduino.cc/en/Reference/KeyboardModifiers.
Step 4: Going Further
Of course, simple key combinations and strings are not the only uses for such a system. Coupled with a program such as Keyboard Maestro, you could get your keys to perform extremely complex tasks. I set up some of my keys to lock my computer, turn sound on/off, and open specific programs! Consider it a fully-programmable computer interface that you can design for any purpose.
That's it! I'd love to hear what you used this project for, so post a comment below. If you want to see more of my work you can visit www.AlexWulff.com