Arduino Uno Game Controller

About the project

A DIY game controller using Arduino Uno

Project info

Difficulty: Easy

Platforms: ArduinoPython

Estimated time: 1 hour

License: MIT license (MIT)

Items used in this project

Hardware components

Resistor 220 ohm Resistor 220 ohm x 4
Tactile Switch, Top Actuated Tactile Switch, Top Actuated x 4
Arduino UNO Arduino UNO x 1

Software apps and online services

python python

Hand tools and fabrication machines

cardboard cardboard x 1

Story

full video

Story

I saw some videos about game controllers and I wanted to make one. But I didn't know that I couldn't make them with Arduino UNO until I programmed it. The libraries used (keyboard.h) in those projects allow the 32u4 and SAMD based boards (Leonardo, Esplora, Zero, Due, and MKR Family) to appear as a native Mouse and/or Keyboard to a connected computer, so an Uno(ATmega328p) won't work directly. Hmm, but I know another way to do it that's what I am sharing here.

Making it possible

When I didn't know c++ I used to program Arduino using python. While using python the Arduino always transmits and receives data. So I can utilize that to make our USB Gamecontroller. For this project, we also need to install pyfirmata and keyboard(just open a command prompt and type "pipinstallpyfirmatakeyboard"). Before that, we also need to upload a sketch called standard frimata from Arduino ide to establish serial communication between the PC and the Arduino.

Circuit Diagram

just wire it up

ENCLOSURE

I first placed everything on a breadboard and then used cardboard to cover it and added a little flavor to it and placed the Arduino to the back of the cardboard.

1 / 3

Final Part

Just connect it to your computer and run the given python code then take a game and start playing voila!!!

SuperTuxKart

SuperTuxKart

SuperTuxKart

If you need further more explanation about the code and other kinds of stuff then try watching this video

full video

Final Output

Final output

Schematics, diagrams and documents

Schematic

just wire it up

Code

Python code for the controller

remember to install pyfirmata and keyboard

Credits

Leave your feedback...