Me and my son we were playing "Asphalt 8", a car racing game on a tablet computer. In this game you gain points/coins and you can buy new cars with these coins. One simple method to raise virtual money is to start a so called K.O. race (or elimination race) where the goal is to avoid the last position as the last one is knocked out every 30 seconds. However, if your car is eliminated you receive some points regardless of your position. So, starting a elimination race and losing it right away gives you money without actually having to concentrate on the race itself, all you have to do is repeatedly pressing some buttons. This, however, is a stupid and boring task that cries for automation. I attached a video showing the working robot player.
Step 1: Material
I mostly took material I already had at hand except for the stylus pen with a conductive tip that I bought for this project.
- 3 Servo motors (actually it should work with just two)
- Mini 2-Axis Camera Mount for SG90 Servo
- metal bar (perforated steel sheet) to elongate the servo arm
- Tablet stylus (conductive material on tip)
- wooden plank
- small screws
- ARDUINO nano clone
- blank soldering plate
Step 2: Mounting and Soldering
The servos have to build an arm that can move vertically and horizontally. I ordered a camera mount from China for ~3 Euro a few months ago, found it in my stack, and therefore used this for this project. Basically you can easily mount two servos without the above camera mount. Check out instructables for some ideas. I used a 5 cm piece of perforated steel sheet to elongate the servo arm and polymorph formable plastic (search instructables for polymorph if you do not know polymorph yet!) to glue the stylus to the arm. In addition I used polymorph to mount the third servo to the camera holding thingy instead of a camera.
The servos have to be wired to VCC and GND and the signal lines go to pin 10, 11, and 12 on the ARDUINO. I highly recommend using an external power supply for the servos! If you do so, make sure to connect grounds of both circuits (common ground).
Before screwing the arm to the wooden blank I made some tests with the software for fine tuning of the correct timing and arm position.
Step 3: Software
The software is straight forward giving the position of the servos and thereby clicking the buttons on the tablets with the stylus.
// Robot Tablet Player
// by Lars Lewejohann
Servo myservo; // create servo object to control a servo
myservo.attach(door1Srv); // attaches the servo on pin 10 to the servo object
myservo.attach(door1Srv); // attaches the servo on pin 11 to the servo object
myservo.attach(door1Srv); // attaches the servo on pin 12 to the servo object
for(int i=0; i<3;i++)
for(int i=0; i<4;i++)