Introduction: Arduino Simulation Computer Keyboard

About: ElecFreaks is an open design house founded in March 2011. Our goal is to create rapid prototypes and give small-batch manufacture solution for makers and startups. With over 50% staff as engineers and expanded…

As typical input device, keyboards have special advantages when used for interactions. To give a case for example, passing push-key events to flash via keyboard spares the entire process of going through cumbersome interfaces. Although it’s easily for us to come up with the idea of disassembling the keyboard to lead out the keys. But this method has the disadvantage that the key value cannot be changed dynamically. But if only we use a simulation computer keyboard, we can set the push-key time and key value freely. This tutorial, shows how to press a key to trigger an input “HELLO WORLD” into your computer screen via the simulation computer keyboard.


Step 1: Preparation

Step 2: Building Process

1. Follow the below circuit diagram to solder the resistor, USB cable and Dupont line onto the universal board.

Note: please refer to the Table 1 to find out what each color stands for.

After welding, the circuit should be like Picture 4.

2. Connect the Dupont line welded as the upper picture displays to UNO by referring to the Table 2.

NOTE: the wiring method in the second step is not fixed. If readers need to use other pins, it can be achieved by modifying the wiring definition of the USB pin in usbconfig.h in UsbKeyboard library.

3. Connect the number key to D1 pin on UNO as Picture 6 shows.

4. Download the USBKEY code to UNO. You need to note that for a successful compilation of USBKEY, it’s necessary to put UsbKeyboard files into the folder “Arduino IDE libraries” in advance.

5. After downloading the code, unplug the UNO code to download USB, plug in this simulation USB keyboard and then open a text on the PC end. Press the number keys on the UNO, the word “HELLO WORLD” will appear in the text, as shown in Picture 7.

So far, the building of Arduino simulaltion keyboards comes to the end. Readers can extend more complex, more interesting USB tools for interaction with PS from gaining a little bit inspiration from this simple enough USBkey.

Download the codes here:

USB Code
USB Keyboard

Click here to view more tutorials on Arduino.

After welding, the circuit should be like Picture 4.