You are currently viewing Chrome Dinosaur game with Arduino

Chrome Dinosaur game with Arduino

Table of Contents

[1] Description

[2] Hardware Components & Software

[3] Arduino Code & working

[4] Output Video

[5] YouTube Video

[1] Description

Hello friends , this project is about game and I think everyone once play this Chrome Dinosaur Game at the time of internet problem. But what about, If this game can be played without any input? yes, you can make this with the help of Arduino and servo-motor. So in this project I am going to use servo motor to press my space/up button. So let’s start with this project.

[2] Hardware Components & Software


[1] Arduino

[2] Seven-segment LED

[3] Jumper Wires

[4] USB connector


[1] Arduino IDE

[3] Arduino Code & working

In this project I’m using LDR(Light Dependent Resistor) it has a properties to change its resistance when light fall on it, so this concept I’m using in this. As you can see when we play this Dinosaur-game there is a black movable tree comes at a particular time duration and the speed of these increases according to the level of game. So here as I said I am using LDR so this LDR should be kept on the screen so it can detect that black tree. Stick LDR on screen as given below in the image.

In this way when black tree not there then it will detect white screen as you can see in the above image and when it will detect as black spot for LDR so in this case LDR resistance will change. Now Let’s understand how Arduino code is working.

Arduino code :-

#include <Servo.h>
#define unpress_angle 0
#define press_angle 35
int ldr=A1;
int data; 
Servo myservo; // create servo object to control a servo
void setup() 
void loop(){
  myservo.write(unpress_angle); // unpress the button
     myservo.write(press_angle); // press the button
     delay(100); // waits 100ms for the servo to reach the position

In above code there is servo library which will help to move at a particular angle according to the input applied. As you can see there are two variable which holding two values first one is for unpress_angle and another one is for press_angle and these are may be different in your case. Here ‘data’ variable is receiving signal from LDR and then this signal setting the position of Servo motor according to the signal value, and this value also printing in the serial monitor by that we can set the threshold.

Here in my case I am getting sensor value 30-33 when there is no black tree and when LDR detect black tree it sending the value less than 30 so I have written this condition in my code check that.

Note :- If you are getting some problem to set LDR value then use Laptop/PC brightness control and then set according to your requirement.

After done with above part now click on upload button . After this you have almost completed ​with this project. Now let’s connect the circuit with Arduino.

Select Arduino Board
Select Arduino port number

Now connect circuit in this manner as given in below Circuit-Diagram. Here 330 ohm resistor connected between A1 and the ground. Before that select your Arduino board and port number as given in the below images.

After connection the whole setup will look like this. see below image for this.

Now we have completed . Below, with output video YouTube video also given , if you have any doubt or not understood well go and check out YouTube video.

[4] Output Video

[6] YouTube Video

Thankyou so much to read the article till now there is YouTube video on this project ,go through that video to understand the whole procedure in a better manner. There is link for video go and check it out.