Piano Tiles – Arduino Hack

Another game has been going viral recently – Piano Tiles.

I tried playing it, and it sure is entertaining, but there’s no way I can beat some of my friends, they’re just too good (Sunny, I’m looking at you ๐Ÿ™‚ ). Not willing to throw in a towel that easily, I employed robots to do the dirty job. Results can be found below.

I used an Arduino Uno with a relay shield (makes for more compact package than having relays on breadboard), photoresistors to read the color (~light intensity) of the tile (black vs white), and strips of copper foil attached to the screen to simulate touch by grounding them. Algorithm is monitoring the timing between tiles, to account for increasing speed at which tiles move as the game progresses.

Reliably simulating touch was the toughest part – I tried a number of different approaches (pennies, washers and more), but 3-4 layers of copper tape seemed to work best. Just make sure that the glue on copper tape is also conductive (I used this one) and that you share the ground with phone (i.e. by connecting a stripped USB cable to the phone and getting the ground from there).

 

 

Photos:

ย ย 

 

YouTube video –ย compilation:

 

YouTube video – raw footage:

 

2 thoughts on “Piano Tiles – Arduino Hack

  1. Hi! I’m trying to build this click/touch mechanism of yours for another game (taps to riches) and I’m failing hard ๐Ÿ™ the code is pretty simple and the relay shield clicks nicely. but there are no touches registered on the phone and I don’t know why ๐Ÿ™ also, I don’t understand what you mean by sharing the ground… Can you help me and tell me how to wire it?
    I have this relay board (https://www.amazon.de/Neuftech-Kan%C3%A4le-Relais-Modul-Brett-Arduino-2/dp/B00PIMRGN4) and a nodemcu

  2. Hi Carl,

    The relays are fine, this board should work perfectly.

    I’m assuming you’re also using copper tape as “touch point”? Just double-check that the glue is also conductive, i.e. check continuity with multi-meter, to avoid surprises ๐Ÿ˜‰

    Now, the touch-points need to be connected to ground (through relays). And by “shared ground” I meant that there is a connection between the ground of your microcontroller (its power supply) and the ground of the device you’re trying to simulate touch on (i.e. phone).

    To achieve that, grab one of the USB cables used to charge the phone, then cut it, strip piece of insulation to expose the wires, and check which one is ground (to find that out, check the USB plug pinout for the type of cable you have for your device, and then simply check continuity from that pin to the wires that you removed insulation from, i.e. for USB Micro-B: http://www.hobbytronics.co.uk/usb-connector-pinout). Separate and insulate unused wires for safety.

    Make sure only ground is shared, DON’T connect the Vcc lines of your microcontroller and the device (you can damage both devices)!

    And quick and easy way to verify if the problem with touch is because of no shared ground: plug in both the devices to power outlets in your home (i.e. power microcontroller from wall outlet and plug in your phone to charger too) – as this way the ground becomes shared (in the wall… ๐Ÿ™‚ ).

    Hope that helps! Let me know if you have any additional questions.

Leave a Reply

Your email address will not be published. Required fields are marked *