Button Simulating a Keypress

by Wouterv1 in Circuits > Arduino

63 Views, 1 Favorites, 0 Comments

Button Simulating a Keypress

Result.jpg

In this instructable we will be making a button that simulates pressing the space key on your keyboard. I was inspired by the game Rhythm Doctor to make this button, as it is a game requiring only the space key to play the game.

Supplies

20240628_112005.jpg
  • 1x Arduino Uno + Connecting USB cable
  • 3x Wires
  • 1x Button
  • 1x 330Ω Resistor
  • (Optional) 3D printer for casing

Script Files

First off we will need to download these files necessary to get the button to simulate the key we want to press.

It is important to note that I used Python to receive the Arduino's serials. So you will have to download python and import the "PySerial" and "Keyboard" library.

Note that in the python file I use a specific port to receive my signals from. You can edit the python file to change the COM4 port to the correct port your Arduino is plugged into.

Along with that you can also change the key that the button will simulate.

3D Print Files

We will also need a casing for our project. Here are 2 files that can be used in Ultimaker Cura to 3D print.

Circuit

Circuit.png

Putting Together

Result_Circuit.jpg

Once the print is done we can put it together. I used shortened wires to connect everything or else the wires wouldn't fit inside the casing.

I soldered the wires and resistor (as seen in step 3) and plugged these into the arduino. The small button will rest on top of the beam that was printed across the middle.

Lastly we can put our 3D printed button on top.

If everything is wired correctly, we can now connect the arduino to the computer and run the "SpaceButtomCOM4.py" mentioned in step 2.