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 Leonardo

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.

Step 4:

On the underside, I cut some grooves with a router to fit
the wires.

Step 5:

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.

Step 7:

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.

Step 8:

Solder the resistors to the other ends of the wire as in the

Step 9:

Join all of the ends of the resistors and solder to another
short length of wire like this.

Step 10:

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.

Step 11:

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.

<p>How is it possible to run this on only the Leonardo and printing letters instead of commands?</p>
<p>I''m tring to make one of these for school that only needs one aurdino and only presses two keys (Windows Button and L) at the same time. Any recomendations?</p>
<p>Is two arduinos absolutely necessary? And can it work with one arduino uno?</p>
<p>&quot;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.&quot;<br><br>nope, only one is necessary, He just used 2 for simplicity in this case. I belive the uno can act as a keyboard cant it? If so, then yeh, this would work with the uno, but might need a few code mods...</p>
<p>Nope. Unos dont work as it. Take a Dua (or as i suggest) the cheap Micro.</p><p>I am using a micro for a 7x6-Keypad fully programmable (on the fly) over emulated USB-serial. As buttons i use peizo discs with a bit of added circuitry.</p>
<p>Hi Orngrimm,</p><p>could you let me know, how you attached 42 Keys to a micro as it has just 27 Pins?</p><p>I&acute;m new to the Arduinos and maybe its a dumb question. Would be nice if you can lead me to a tutorial or any other Information.</p><p>Thx :)</p>
<p>No such thing as dumb question! :)<br>The trick is to use them in a matrix-configuration. Sounds complex, but isnt:</p><p>- You have columns and rows. in my case 7 columns and 6 rows.</p><p>- Every switch &quot;sits&quot; on a junction of a row and a column and connects them if pressed.</p><p>- Now you simply set one column on high and check if and which row goes high. Lets say the 4th row goes high. Then you knwo: The 4th button on the 1st column is pressed.</p><p>- Now you go to column 2 and repeat the scan for this line. Lets say that no row goes high: You know: No button on the 2nd column is pressed...</p><p>- 3rd column...</p><p>...</p><p>- 7th column.</p><p>with such a matrix-method you can scan a total ammount of [rows] TIMES [columns] by using a total number of pins [rows] PLUS [columns]. In our case (7*6) i can scan for 42 buttons (7*6) by using only 13 pins (7+6).</p><p>See http://www.8051projects.net/keypad-interfacing/introduction.php for a nice graphic of a 4*4-matrix</p>
THX a lot. This should work for capacitive Buttons too I guess. I'll check that :)
<p>Yes. Matrix-Style also works for capacitive buttons. But you have to be carefull in the capacitance and resistance you have within the row- and Column-Switches: If they have too uch capacitance, oyu may have troubles in reading them correctly. Use high-Quality-FETs with very low capacitance or even use old fashioned relais :)</p>
<p>Hi Brinth and Dan</p><p>The Arduino website says that only the Leonardo and Leonardo Micro are capable of sending keyboard codes. I tried using my Uno, but when you select Uno as your board in the Arduino IDE, you get &quot;Keyboard was not declared in this scope&quot; when you try to compile the code.</p><p>Yes it does work if you connect the resistors straight into the Leonardo. My wires when testing were about 3 feet long. I found that when touching the outside of these wires I was affecting the capacitance, that is why I set the sensitivity quite high to 800, so that I wouldn't get false triggers. Another issue is that you need one wire for each switch so if you want 6 switches you would need 6 wires.</p>
<p>The Uno is not capable of emulating a USB-HID-keyboard on its own. It can be done, but needs a reflash of the Bootloader of your arduino. You dont want to do that since it would render the cool arduino-features null.</p><p>The Arduinos with Atmel32U4 can do it out-of-the-box like the Leonardo, Micro, and Due. the Tre (as soon as it comes out) will also have this feature.<br>Also the Yun should work but havent tried it.</p>
<p>Every Arduino with a Atmel 32U4 can do it in a single package like the Arduino Leonardo, Micro, and Due. The micro is of special intzerest since it has more than enough digital-ports to scan for a plethora of keys (if you do a matrix) and is cheap as hell (around 5$. free shipping from china).</p><p>Just scan the key, then use the sketach at <a href="http://arduino.cc/en/Tutorial/KeyboardMessage" rel="nofollow"> http://arduino.cc/en/Tutorial/KeyboardMessage </a> to do it.</p><p>the use of 2 arduinos for this (one for scanning, one for translating into USB-HID-Keyboard) is a bit over the top i think. But it works. So kudos on this cool project! :)</p>

About This Instructable




More by jjurotte:Keyboard shortcuts using Arduino 
Add instructable to: