For a long time, I needed a simple device allowing me to send varying mouse and keyboard commands to test some of my web applications and games on browsers. Also, I could utilize such a device to test keyboard and mouse functionalities of new single-board computers, for instance, Raspberry Pi, without kvetching about my lack of a proper keyboard and mouse :) Thus, I decided to create this project. First of all, to be able to send keyboard and mouse commands via USB, I used an Arduino Pro Micro centered around an ATmega32U4 - an 8-bit AVR very similar to the ATmega328. The ATmega32U4 comes equipped with a full-speed USB transceiver, which can emulate any USB device. Huge thanks to PCBWay for sponsoring this project.
Then, I utilized the 4x4 matrix keypad design to send keyboard keys, supporting up to 32 keys with two dynamic keypad options. Finally, I used two joysticks as a fully-functional mouse, also controlling the dynamic keypad options and modifier keys. After completing my design on a breadboard and testing the code, I designed a controller-shaped PCB (Arduino-Based Mouse and Keyboard Controller) with an integrated 4x4 matrix keypad and two embedded joysticks, displaying Pikachu as its center logo.
Before prototyping my PCB design, I tested all connections and wiring with the Arduino Pro Micro on the breadboard. Then, I designed the Mouse and Keyboard Controller PCB by using KiCad. I attached the Gerber file of the PCB below, so if you want, you can order this PCB from PCBWay to create a stylish and fully-functional USB Keyboard/Mouse displaying Pikachu as its center logo :)
Before coding, we need to add and verify the Pro Micro board settings on the Arduino IDE. With the latest release of Arduino IDE, adding third party boards to the IDE is easily achieved through the Boards Manager.
⭐ Open up the Arduino IDE, then go to the Preferences (File > Preferences). Then, towards the bottom of the window, paste this URL into the "Additional Board Manager URLs" text box:
You can add multiple URLs by clicking the window icon and pasting one URL per line.
The controller lets the user move the cursor by the left joystick (J1) movements and click by pressing the left (J1) or right (J2) joystick buttons. The controller allows the user to choose between the dynamic keypad options (letter and number) and send modifier keys by the right joystick (J2) movements. The controller includes an integrated 4x4 matrix keypad. With the dynamic keypad options, the controller supports up to 32 keyboard keys. The controller is compatible with Raspberry Pi.