How to win Chrome Dinosaur game with Arduino

Introduction

In this Project, we are going to make a How to Win Chrome Dinosaur game with Arduino. The dinosaur game, also known as the T-Rex game, is a popular and addictive game that can be played offline in the Google Chrome browser when there is no internet connectivity. In this game, the player controls a dinosaur and avoids obstacles by jumping over them. However, playing this game for a long can be tedious and tiring. Therefore, we designed an automated Dino game using Arduino that can play the game on behalf of the user.

Hardware Required

To make this project, we will need the following hardware components:

Components#Buy From Amazon
Arduino UNO1Buy Now
Servo Motor1Buy Now
LDR (Light Dependent Resistor)1Buy Now
Resistors 10K1Buy Now
Jumper WiresFewBuy Now
Breadboard1Buy Now

Setup LDR and Servo

This LDR-based detection system allows for easy triggering of a servo motor, which can be used to press the space button on a connected laptop. By positioning the LDR on the laptop screen rather than on the road surface, this setup provides reliable and efficient detection of changes in light levels. Once the LDR senses darkness, it sends a signal to the Arduino Analog Pin (A0), which then signals digital pin 9 to activate the servo motor.

The simplicity of this circuit makes it an excellent choice for beginners and experts alike. Share this project with your friends and family who use PC laptops or desktops to help them enhance their computing experience.

Automated-Chrome-Dino-Game-using-Arduino

Circuit Construction

The circuit for the automated Dino game using Arduino is straightforward and easy to build. First, we will connect the LDR to the analog input of the Arduino. Then, we will connect a 10K resistor in series with the LDR to create a voltage divider circuit. Next, we will connect the servo motor to the digital output of the Arduino using jumper wires.

Circuit Diagram

How-To-make-Automated-Chrome-Dino-Game-using-Arduino-Circuit

Working Explanations

The working of this project is based on the LDR sensor, which senses the change in light intensity caused by the obstacles in the game. When the dinosaur in the game encounters an obstacle, the game background changes from white to black. The LDR sensor detects this change in light intensity and sends a signal to the Arduino. The Arduino then triggers the servo motor, which makes the dinosaur jump over the obstacle.

Installing Arduino IDE Software

First, you will require to Download the updated version of Arduino IDE Software and Install it on your PC or laptop. if you Learn How to install the Arduino step-by-step guide then click on how to install Arduino Button given Blow

Installing Libraries

Now when you are Ready to upload the code, to the Arduino Board you will need first to add the Following Libraries in Arduino, If you Learn How to add the library in the Arduino step-by-step guide click on how to install the library Button given Blow

Code

//For more Projects: www.arduinocircuit.com

#include <Servo.h>
#define threshold 250
#define unpress_angle 70 
#define press_angle 36


Servo myservo;  // create servo object to control a servo
bool trig=true;

void setup() {          
  myservo.attach(8);  // attaches the servo on pin 8 to the servo object
myservo.write(unpress_angle);   
}

void loop() {

 myservo.write(unpress_angle);              // unpress the button
 delay(1);
 if(analogRead(A0)< threshold)
 {
  
      myservo.write(press_angle);          // press the button
    delay(100 );                       // waits 100ms for the servo to reach the position
                      
 }                     
}

Applications

This project can be used in various applications such as:

  1. Entertainment
  2. Education
  3. Skill development
  4. Research and Development
  5. Gaming

Conclusion

In conclusion, the automated Dino game using Arduino is an exciting and fun project that can be easily built with a few simple hardware components. It not only provides entertainment but also helps in skill development and research. This project can be expanded and modified to create more advanced and complex automated gaming systems.

Leave a Comment


error: