Now after the first day of constant copying and pasting, and having to change the folder I was using, my hand hurt and I was tired of the repetition so I got the idea. I had an idea earlier in the year to make a little keyboard that I could use for symbols when writing a lab report, like the ohm symbol, micro symbol, etc. Well I never did do that but I had all the parts for it so I decided to finally make this project and use it to help me at my job.
I would like to point to an episode of SparkFun's Engineering Roundtable that gave me the headstart to do this project. It can be found here.
Step 1: Materials
Small pushbutton, NO(already had)
USB cable(already had)
Ribbon cable with headers or jumper wires
Step 2: Setup
Once I found out which pin was which, I assigned each one to an Arduino pin.
Step 3: Connecting the Keypad to the Arduino
Before soldering the pins onto the keypad, I bent them at a 90 degree angle so they would fit better into the case. And be sure that you pick the correct pins from the keypad to put into the 5 pin and 2 pin headers for the Arduino, but if you do put the wrong ones, it is easy enough to adjust the Arduino code to compensate.
Step 4: Mounting the Arduino
After I had my Arduino in place where I wanted it, I slid the backplate on and marked where the USB port was. I then cut out the mark so that I could plug in a USB cable easily. I thought about making the USB cable permanently attached but I went with this way because I think that it gives it a cleaner look and makes it easier to transport.
A hole also needs to be made so you can easily reset the 16u2 USB chip. This hole can really go anywhere since the button is connected you wire.
Step 5: Adding the Reset Button
The pins that the button are attached to need to be bent to allow the case to close properly. I used a flat head screwdriver to gently bend them about 45 degrees. Be sure not to bend them too far or when you put the connector on, it may wedge the Arduino's reset button down and you could end up with random resets during use.
Step 6: Arduino Code
Step 7: Flip
After you have Flip installed, run it and have your Arduino plugged into your computer. Reset the Atmega 16u2. Click on you USB cable icon in Flip and select USB. Select the button that looks like an IC and choose the correct device. Now you're ready to load the hex file! Click File, Load HEX File and navigate to the keyboard hex file downloaded from above. After loading it simply press Run and wait for the process to finish. This usually only takes a few seconds. After the chip has been reprogrammed, kill power to the Arduino and start it back up. Now when you plug your Arduino Keypad into your computer it will be seen as a keyboard!
Step 8: Reprogramming
If you use an Aduino Leonardo or Micro I am pretty sure that the need to reprogram the 16u2 is obsolete, as they are only single chip boards.
Step 9: Updates
I have made one major update to the keypad since starting it. That is, I replaced the Arduino Uno with the Arduino Leonardo. REally all this did was eliminate the need for the reset button on the Uno's 16u2 USB controller. One drawback to this is that it uses a USB Micro connection, which doesn't stick out as far as the USB type B, making it a little bit harder to mount in the same case. Also, the DC power jack got in the way for me, so I just removed the whole thing. This replacement should make reprogramming it simpler.
I managed to avoid getting a whole new case and keypad. Luckily, SparkFun sell just the backplate for their project case, and it's cheap at only $0.50! I just took a new one of these and cut out a small hole for the USB micro connection. (SparkFun project box backplate)
The programming was changed slightly and I have included a blank template, one for use with the Leonardo and one for use without it. Some of the syntax is different, such as special characters. Reference for those can be found here.