Introduction: One Arduino Playing the Chrome Dino Game on Another

Recently, I've seen a number of people set up an Arduino to automate the playing of the Chrome Dino Game in their browser. This got me thinking, it would be quite cool to get the game running on one Arduino and get another to play it.

I have previously set up an Arduino to run a simple version of the game, so it just needed a few tweaks to get running and ready to be controlled by another Arduino. The game is quite easy to set up and only requires an Arduino Uno and an LCD keypad shield.

The second Arduino uses an LDR to detect the light emitted by the LCD when a cactus passing by it and then uses the signal to drive a servo to push the jump button on the shield.

Supplies

For The Dino Game

For The Dino Game Player

Step 1: Solder the Components & Upload the Code

The wiring for the player Arduino is pretty straight forward and consists of basic starter circuits for the LDR, LED and servo. I soldered the components together using some ribbon cable and pin headers to make it easier to connect and remove them.

I initially included an LED to indicate when the LDR was triggered, but the light interfered with the LDR, so I removed it from the code. You can leave it out altogether if you'd like.

The code is a simple sketch which measures the light level from the LDR and if it is above a certain level, indicating that a cactus is passing the sensor, then the servo is moved slightly to press the jump button. The code can be downloaded here.

The servo was mounted on a block which positioned it just above the jump button so that it didn't need to move much to push it.

The LDR is mounted on the 7th character on the LCD on the bottom row, as close to the display as possible so that ambient light doesn't affect it too much.

Step 2: Playing the Game

To get the one Arduino to play the game on the other, power both on and then press the reset button on the game Arduino to start a new game. The player Arduino will automatically start playing when it senses a cactus pass the screen.

You may need to calibrate the light level detected by the LDR first to make sure that you've got the right light level. You may also need to adjust the servo travel limits.

The game keeps a high score while it is powered on, so you can play against the player Arduino and see who is better. You'll likely be able to play better in this setup as the LCD starts ghosting at higher refresh rates and you're able to anticipate the movements while the player Arduino cannot.

Enjoy playing and have a look at my blog post for more information on setting up the code - An Arduino Playing The Chrome Dino Game On Another Arduino