Intro: Keyboard Clicker
This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com). For this project I chose to make a physical keyboard clicker. The reason I chose to make this is primarily for an undetectable and random way to macro. What it does can easily be accomplished with software. However software can be detected. It also is far too accurate when in use, even with randomization. In the future I would like to improve upon this. Mapping the whole keyboard electronically to mimic button presses.
-A Small Breadboard
-Lots of Wires
-220 ohm resistor
You're also going to need access to a 3D printer. If you want to make edits you will need access to Inventor or another AutoCad software as well.
Step 1: Creating Your Box.
To make my own box I created a 3D model in inventor. Then I had the 3D printed out my school. The total cost was around $20. This would be cheaper if you have your own 3D printer. The file can for and the box top can be downloaded below.
If you want to make your own box there are a few things to keep in mind. You're going to want some sort of holder to keep the servos in. This prevents them from just pushing themselves up instead of clicking the keys. You're also going to want to take very accurate measurements of your keyboard. You need the hole spacing to be just right. Lastly make sure the servo arms have enough room when clicking the keys. If you don't they might hit the box. This is bad because it will slowly ruin the servo as well as move the box a bit with every click. Once you have your box 3D printed you're going to want to sand it. I'd start with a 60 or 100 to get the general shape you want. Then work your way to a 500 or more.
Step 2: Putting It Together.
Now that you have the box you're going to need to put it all together. This requires all six servos and IR sensor to be wired to your ardunio. The servos have to use the pins with the ~ on them. This is because these pins allow the ability to use analogwrite. This means your servos will be connected to pins 3, 5, 6, 9, 10, 11. The IR sensor doesn't require a specific pin so pin 2 is a good choice. Now you need to power everything. The arduino has a 5 V power outlet that works well for this. Since we have so many things to connect it is best to use a breadboard as a medium. So connect the 5 V to a breadboard then each servo to the same line. For the IR sensor you will want to put a 220 ohm resistor in series as well. This lowers the current on the sensor. Next we are going to do the same for ground. Connect the GND pin to the breadboard. Then connect the servos and IR sensor to this line.
While doing your wiring try to make a plan for how you want to do it. If not things can get messy easily. You want to avoid making messy wiring because it can get very confusing and lead to mistakes.
Step 3: Coding Your Box.
Now that you have everything printed and put together it is time to code. This is the most important part of the project as well as the most flexible. Without the code nothing will happen.
The first thing you'll need to do in your code is to include the standard servo library. Then you'll need to figure out the code your remote sends out for each button. You can do this using the arduino serial. Once you have your remote codes you can assign a name for them. Then name your servos and assign them to the pins they are connected to. Next use the servo library to designate them as servos. Now create your void setup. This is where the serial.begin should be as well. Use the attach code to attach your servos to a name. Then set your servos default position to ensure they start where you want them to. Now in the loop you are going to have to read the remote input using irrecv.decode(&results)). Then you can use that in your functions to determine what to do. Make sure you have your servos go down roughly 45 degrees and back up to mimic pressing a key. You can tweak the speed, press time and many other factors as you see fit. From here you can do whatever you want. Make them play a song or just keep your computer on.
I will include my code. I am not amazing at coding however so feel free to make your own. I am sure there are many ways to do what I did but better.
After you create your code you're all done. I hope you enjoy it and find a good use.