Coder Life
Published in

Coder Life

Auto-play Chrome Dino Game

IoT Webduino challenge during my quarantine time

After back to Taiwan from Melbourne, I started home quarantine and found the Webduino package I bought when college in my room, so I decided to create an automatic play system for Chrome Dinosaur Game to pass this boring time.


Webduino Mark 1*1
Photocell (LDR)*1
SG90 Servomotor *1
Resistor *1
Male-Male Wire*6
A Google Chrome browser without the Internet!


  1. Setup the Webduino
  2. Circuit Design
  3. Setting the Photocell
  4. Setting the Servomotor
  5. Demo

Setup the Webduino

Follow this tutorial for setup the Webduino board. Notice that the SSID and PASSWORD on the webpage is your WiFi, not the Webduino Development Kit’s SSID and password.

Note: Let Webduino connect to the power directly, instead of plugging the USB into the laptop, otherwise the board WiFi will not be able to connect

Circuit Design

Before building the functions,

Connect the board via Webduino Blockly Editor

Open a Webduino blockly editor. Drag a “Board” block onto the workspace and fill in the name of your Webduino board. (Mine is GLny)

Setting the Photocell

Photocells are sensors that can detect light, each photocell is basically a resistor whose resistance value changes depending on the amount of light shining on it. We will use it to detect the coming plants in the dino game.

Firstly, open the Web Demo and choose “Show Text”, it will show the detected value of our photocell.

Environmental -> Photocell
Place a “set photocell” block onto the workspace and set the name to photocell as well as the analog pin to A3.

Place a ‘photocell detects” block below.

Show Text -> Show
Place a “Show” block with “photocell’s value” in do function.

Click the start button to test the value, as you can see, the numbers are after the decimal point, but we want them to be an integer. So let’s convert the value.

Advanced -> Math Conversion
We set a new variable ‘light’ to save the converted value, now we could get the number that minimum is 1000 and the maximum is 2000.

Setting the Servomotor

A servomotor is an actuator that can be rotated with precise control of angle from 0 to 360 degree. We will use it to press the space on the keyboard and make the dinosaur jump.

When does the servomotor need to press the blank key?

Yes, when plants are close to the dinosaur.

But how to let Webduino know that plants are coming? That is the task of the photocell! Since the background is white and the plant is black, when the plant passes the photocell, the detected value will be lower than the normal value, so please find out what the range is displayed in the web demo when the plants pass. (Mine is lower than 1150)

Standard -> Logic
Place the “If-do” block and variable “light” together to determine the operation of the servomotor.

If the value less than 1150, then let the “servo” move to 90 degrees then back to 0 degrees, in order to imitate the action of pressing a button.

Notice that the delay and angle values will vary according to each person’s environment and the physical settings of the device. You should perform various tests and adjust them to achieve the best setting.

It’s all done!! Let’s play, oh no no, let’s let the robot play!


Note: It does not work on night mode or flying birds. But I believe there are many ways to solve these issues, such as creating more condition settings for those situations.

Support my writing by becoming a Medium member today and getting access to an unlimited number of articles.




A place that share all value skills and techniques I learned in development.

Recommended from Medium

How Test4z Makes Batch Testing Easier

Web mapping: comparing vector tile servers from Postgres / PostGIS

What happens when you type in your browser and press Enter

Music Copyright Token Airdrop Event

Reliable ingestion from AWS S3 using Hudi

Floyd’s Nonsensical Stance on Dependency Injection

Cloud Native Principles — Containerization & Dynamic Management.

The Importance of Having a Good Sage 300 ERP Consultant

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Allie Hsu

Allie Hsu

a tech enthusiast who is keen to develop new skills

More from Medium


Making yourself at home with a introduction to Command Line Interface

A “welcome to our home” sign

Human-Computer Resemblance

CPU Scheduling Algorithms Visualiser