กลับไปหน้ารวมไฟล์
play-dinosaur-game-using-arduino-and-python3-4b0caa-en.md

Project Description:

Most of us have played dinosaur game by google when our internet was not working and if you have not played this game don't worry now can but not in a conventional way pressing buttons but by using motion of your hand. So in this project using hand motion photo resistor sends values to arduino and arduino sends it to python3 and by using famous library of python pyautogui we can perform "up" arrow function :)

How I decided to make this project ?

Recently I watched a video on youtube regarding project which was about Arduino based Hand Gesture Control of Computer and I really wanted to make that project but currently I don't have ultrasonic sensors which was required to make that project. So I read all the stuff how that project works ? and then I thought I can also do that kind of work by using photo resistor (LDR) sensor. And then I decided let's control "up arrow" key and use it in dinosaur game. Most importantly beginners can also try this project which can increase their interest level.

Below is a video I watched recently

Now let's start to make it:

Things required to make this project:

  • One Arduno UNO board
  • Breadboard
  • Photo Resistor also known as LDR
  • 10k ohm resistor
  • Jumper wires

Thats' all

Schematic:

Information Regarding python3:

Now to make this project you need to install python3 on your system for that I recently uploaded a project "Python3 and Arduino Communication" and there I have uploaded stuff regarding how to install python3. If you want to get familiar with python3 and arduino I recommend you to check that project :)

Below is a link of "Python3 and Arduino Communication"

https://create.arduino.cc/projecthub/Jalal_Mansoori/python3-and-arduino-communication-c33192?ref=search&ref_id=python3%20and%20arduino%20communication&offset=0

Last Step is to install library pyautogui :

Now you need to install python library pyautogui which will perform "up arrow" function.

After you have succesfully install python3 on your system:

Follow these steps:

  • open command prompt by clicking run as administrator and write

cd C:\\Python37

  • Now you need to write below command

python -m pip install --upgrade pip

  • Now this is last command you need to write

pip install pyautogui

Demonstration Video

THANK YOU MAKERS :)

EXPANDED TECHNICAL DETAILS

Physical-to-Digital Interfacing

This project creates a unique way to play the classic "Chrome Dino" game using high-speed serial communication and automation.

  • Python Automation Bridge: A Python script runs on the PC, using the PyAutoGUI library to monitor a specific pixel on the screen. When the "Cactus" appears, Python sends a character (e.g., 'J') over a Serial link to the Arduino.
  • Hardware Triggering: (Alternative mode) Alternatively, an LDR sensor taped to the screen detects the cactus. The Arduino then simulates a "Spacebar" press via the Keyboard library (on ATmega32U4 boards) or sends a command back to Python to execute the jump.

Precision Timing

  • Low-Latency Loop: The code is optimized to ensure the "Detection to Action" time is under 10ms, allowing the Dino to jump perfectly even at high game speeds.

ข้อมูล Frontmatter ดั้งเดิม

title: "Play Dinosaur Game Using Arduino and Python3"
description: "A great project for beginners! You can play Dinosaur game not by pressing any keyboard buttons but by motion of your hand."
author: "Jalal_Mansoori"
category: "Gadgets, Games & Toys"
tags:
  - "arduino"
  - "tracking"
  - "kids"
  - "communication"
  - "games"
  - "python3"
views: 9759
likes: 7
price: 699
difficulty: "Easy"
components:
  - "1x Resistor 10k ohm"
  - "1x Arduino UNO"
  - "1x Breadboard (generic)"
  - "1x Photo resistor"
  - "1x Jumper wires (generic)"
tools: []
apps:
  - "1x Arduino IDE"
  - "1x Python3"
downloadableFiles:
  - "https://projects.arduinocontent.cc/b7c4eec9-5733-4297-8c23-fc20c0457776.py"
  - "https://projects.arduinocontent.cc/118ddaa0-a62a-43cb-b629-770f3d162451.ino"
  - "https://projects.arduinocontent.cc/b7c4eec9-5733-4297-8c23-fc20c0457776.py"
  - "https://projects.arduinocontent.cc/118ddaa0-a62a-43cb-b629-770f3d162451.ino"
documentationLinks: []
passwordHash: "b201d09043d3362171d2f8dbe3238ed4b43183c4e1452814d44eb2f21ef5aecc"
encryptedPayload: "U2FsdGVkX197NpuRXo/94MMzzJKg37NWUShx/hF1Re2jxBSNY7y2tKoc0YMkiwefDPddpkoGqxpC4FDMfID/bRKDx7tFNDdoqX+MHiIYHSU="
seoDescription: "Play Dinosaur Game using Arduino and Python3. Control the game with hand motions instead of a Keyboard. Perfect DIY project for beginners."
videoLinks:
  - "https://www.youtube.com/embed/F2TZuOhsjx4"
  - "https://www.youtube.com/embed/DNdKm7hIpZU"
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/play-dinosaur-game-using-arduino-and-python3-4b0caa_cover.jpg"
lang: "en"