Accelerometer Controlled Gaming Remote
March 2019
The purpose of this project was to create an interface that would allow a user to interact with a virtual environment. Effectively, by programming an ArduinoUNO to communicate with a Python code, users can provide real-life inputs that would cause a virtual output to be generated. Skills in both design and coding were employed during this project, as both the Arduino and Python interfaces were used to code, and 3D printing, machining, CAD designing, and the like were used to design the physical controller.

Goals
The goals of this assignment are to familiarize ourselves with the Arduino UNO coding platform, specifically by analyzing inputs via a sensor. Next, these signals will be interpreted into signals to control a virtual environment using the Python interface. Employment of ergonomic principles will be used to create designs for controllers that are aesthetically pleasing, practical to use, and complete the task at hand. Finally, CAD and 3D printing software will be used to create the final prototypes.
The Assignment
Our team was tasked with creating a device that will interpret real life inputs from a sensor (acceleration, velocity, pressure, or any of the like) and use them to control a virtual interface. We used an accelerometer as a means of gathering real-life input. Using readings gained from the Arduino UNO from the accelerometer, a Python code was used to change such inputs into outputs shown in the virtual interface. Our team decided to use the tilt of an accelerometer to serve as key up or key down inputs on a keyboard that would effectively allow a user to play the game "Snake".
​
Personally, I took a large role in programming, testing, and debugging the code once the product was assembled.
Arudino Code
This code controls the information that the Arduino will sense and send to the Python code. It tells the Arduino to take tilt input from an accelerometer, map it into an array, and print values of 1-9 depending on the factor of tilt of the accelerometer. This array is then sent to the computer for the Python code to interpret.

Python Code
This code is run in Python, and reads the 1-9 values outputted by the Arudino Code. It translates these values into the press of either the up, down, left, or right key-presses on the keyboard depending on its value. This translation will allow the accelerometer in the controller to control the movement of a character in an online game that normally is controlled by keyboard control.

Original Design
The original design for this project was an accelerometer mounted inside a tilting joy-stick. The joy-stick base was CNC machined in EPIC, and the joy-stick itself was 3D printed. The ball of the joy stick was printed in two parts such that the accelerometer could be easily accessibly, and the two parts were sealed by velcro. The wiring connecting the arduino to the accelerometer was threaded throughthe joystick and into a black acrylic box where the arduino was stored. Essentially, by tilting the joystick in the "up", "down", "left", and "right" positions, the keyboard would be sent the corresponding signal, and the snake in the game would move accordingly.
Though the design worked functionally and was aesthetically pleasing, it was not original. Therefore the controller design must be redone. Photos of the original design are shown below.

Final Design
The final design for the product consisted of a 3D printed snake head that held the arduino in its mouth. The snake head attaches to the user's wrist via a velcro strap, and the user tilts their hand in the direction in which they would like the motion of the snake to go, and this triggers tilt of the accelerometer. The accelerometer tilt outputs values that the Python script interprets into a key press on the user's computer monitor.
​
Images and a video of the product working are shown below.
