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 touchpads 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! Let's get started.
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.
Try uploading the above software 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!
The above sketch allows Mac users to use their pads for some common keyboard combinations.
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
Explore the features, specifications, and applications of Gravity CO2 sensors, including electrochemical, infrared, and photoacoustic NDIR sensors. Choose the right sensor for your needs.
Follow this step-by-step tutorial to connect the FireBeetle 2 ESP32-C5 to Home Assistant using MQTT. Learn to configure the Mosquitto broker, flash your board with Arduino, and display sensor data for your smart home automation projects.