Introduction: Arduino Plays Stick Hero
Are you a gaming freak? Want to top the high score list? If your answer is yes you are at the right place.
Can all this be achieved with you sitting idle and your phone doing all the talking? Yes it can be done and we’ll show you how. You can see the video demonstration above.
Stick hero is one of the world famous, time eating game with over 10 Million Downloads. To download the App on your smart phone click here.If you are new to the game, have a look at the game play here.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Components and Software Required
Single Strand Wires, Coins, Relays are used to simulate the touch on the capacitive touch screen of phones and tablets. Arduino is used to control the duration of the touch. Tripod, for holding a phone above the camera.
Matlab: Used for Image Processing.
Arduino IDE: For programming the Arduino.
IP Cam: It is an android app which enables us to use our smartphones cam as a web cam.
Step 2: Setting Things Up
This project involves three basic steps:
1. Detect the black pillars
2. Determine the amount of time the screen is to be touched
3. Simulate touch on the tablet/phone
Step 3: Detecting the Black Pillars
This is done by using Matlab. The image that is captured from the IP Cam is processed and the locations of the black pillars are determined. The distance between the black pillars is calculated and the corresponding data is sent to the Arduino through serial communication.
The source code for the above processing can be found here.
Step 4: Determining Duration of Touch
Based on the data arrived from Matlab, the duration of the touch is adjusted such that the stick exactly falls on the adjacent pillar.
The source code for the arduino can be found here.
Step 5: Simulating Touch
For this we have to understand how capacitive touch screens work. The electrodes apply a low voltage to the conductive layer creating a uniform electrostatic field. When a finger hits the screen a tiny electrical charge is transferred to the finger to complete the circuit creating a voltage drop at that point on the screen. The location of this voltage drop is recorded by the controller and this is how a capacitive touch screen works.
We are going to use this concept, except that in the place of a finger, we use the ground pin on the arduino to transfer the charge on the screen. To have more surface area on the display of the screen, we use a coin.
Relays are directly connected to the output pin of the Arduino. It is equivalent to a touch if the voltage given is high as there is a path for the current to flow to the ground. It is equivalent to not touching if the voltage given is low.
Run the test_relay code at this link to see if the electronic touch is simulated properly.
Step 6: Other Resources
This is an open source project, the code and schematics can be found in the below link: https://github.com/psurya1994/arduino-plays-stick-hero