Introduction: Keyboard Shortcuts Using Arduino
I love keyboard short cuts, but hate having to look down at the keyboard to locate the appropriate keys. And sometimes I forget which keys I need to push for my shortcut to work. Should I have pressed Alt along with Page or should it have been Control?
And why press two keys, can’t I just press one key to do what I want?
I looked around for a keyboard with extra keys that were programmable but there are only a few, and the ones that I saw were about $150, so I decided to try to build my own. I only paid $9.90 for the Leonardo and $4.00 for the Mini so the whole project was only about $15!
Step 1: Parts List
Arduino Mini or full size Arduino such as a Uno if you like
About 600 mm or 2 feet of 4 core cable
Some thumb tacks (These are the keys)
1 x 1 MegOhm resistor for each button you need
1 x 100mm or 4 inches of wire for each button you need
1 x 50mm or 2 inches of wire
A small enclose to house your Uno and wiring (I used an Arduino Mini so housed mine in a small block of wood)
A cable clip
A “Proto Board” or a bit of perf board
Step 2: Circuit Diagram
Step 3: Prepare Your Housing
Depending on the housing that you are using, I will leave
that part up to you but here is what I did. I cut a piece out of one end of my piece of wood to fit in a Pro Mini, wiring and resistors.
On the underside, I cut some grooves with a router to fit
I marked out and drilled some small holes for the button
wires to push through.
Step 6: The Wiring
Solder the short lengths of wire to each thumb tack.
I covered the top side of the wood with some contact paper
and pushed the wire and thumb tacks into the holes drilled earlier. I pulled the wires tight in the grooves and covered the bottom of the wood with contact paper.
Solder the resistors to the other ends of the wire as in the
Join all of the ends of the resistors and solder to another
short length of wire like this.
Solder the lose wire (the one that is soldered to all of the
resistors) into Digital 4 on the Arduino and solder other ends of the resistors into their appropriate holes. Digital 4 is the only one that has to be soldered in the right place. If you find later that you have some of the other wires wrong, don’t worry, you can rearrange them in the code.
Solder some header pins to the bottom of the proto board.
You only need 4 but I added the others for a bit of stability. I secured the cable to the board with a couple of bits of wire.
Step 13: The Code
My Keypad sketch is a modification of Paul Badger's
CapitiveSense Library Demo Sketch.
I decided to use SoftwareSerial on digital pins 10 & 11 on the Pro mini. That leaves 0 & 1 free so that I can connect a FTDI programmer to those pins later for reflashing the board if needed.
There are lots of comments in the code.
Step 14: What to Do Next
Add more buttons for more short cuts.
Attach a small speaker to the Leonardo to give you an audio feedback that you have copied something.
Put a small cell phone vibrating motor in the keypad to give you haptic feedback.
I have the Leonardo on a short micro USB lead plugged in to the USB hub and about two feet of lead going over to the keypad. You could experiment by doing away with the Pro Mini and putting the resistors on the Leonardo and have long wires running to the keypad and onto the thumb tacks.