ESP32 OLED Chrome Dino Game

Wiring Schematic

View full-size circuit ↗
LT

YOUR PROJECT LEARNING PATH

Build it with confidence.

Progress saves on this device
01

Project overview

Know what you’re building before you start wiring.

Build a Chrome-style dinosaur game using an ESP32 development board and a 128×64 SH1106 OLED display. Touch controls let you jump over cacti and flying enemies while tracking score and remaining lives.

The game includes collectible hearts, buzzer effects, a Game Over screen, touch-based restart, progressive speed, and automatic display inversion. It runs locally on the OLED without Wi-Fi or an external computer during gameplay.

Before you power up

Disconnect USB power before wiring. Use a compatible OLED supply and check GPIO 12 boot behaviour with your buzzer connected.

PROJECT ROADMAP3 project stages
✓
Prepare your kitConfirm the components and tools
⌁
Assemble the circuitFollow the build steps in order
⌘
Upload and testCheck the output and resolve issues
Start the build
02

Components required

Gather these parts before you begin.

ESP32 Development BoardRuns game logic, reads the touch sensor, and drives buzzer sounds.× 1
SH1106 OLED Display128×64 I2C display renders the dinosaur, obstacles, score, and lives.× 1
TTP223 Touch SensorProvides a digital touch signal for jumping and restarting gameplay.× 1
BuzzerProduces game-event tones for jumping, collisions, hearts, and game over.× 1
Connecting WiresConnect display, sensor, buzzer, power, and common ground to the ESP32.× 10
USB CablePowers the ESP32 board and uploads firmware from the computer.× 1
03

Build the project

Work through one focused step at a time. You can revisit any step whenever you need.

STEP 010 / 5 complete
BUILD STAGE 0120% of guide

Prepare the ESP32 and OLED Display

Disconnect USB power and place the ESP32, OLED, touch sensor, and buzzer on a stable surface. Identify every module's power, ground, and signal pins before beginning the wiring process.

The display is a 128×64 SH1106 I2C module. Follow the supplied diagram and connect all grounds to ESP32 GND before applying power.

1 of 5
04

Software & tools

Install these before uploading the firmware.

Arduino IDEEdits, compiles, and uploads the ESP32 game firmware.
ESP32 Board PackageProvides ESP32 board definitions and build support in Arduino IDE.
Wire LibraryProvides I2C communication support for the OLED display.
SPI LibraryIncluded by the source headers but not used for the OLED connection.
Serial MonitorDisplays startup diagnostics when configured at 115200 baud.
05

Expected output

Compare your build with the result described here.

FINAL CHECKPOINT

After upload, the game begins directly on the 128×64 OLED, showing the dinosaur, ground, obstacles, score, and three starting lives. Serial Monitor uses 115200 baud for startup diagnostics. The splash screen is disabled.

Touching the TTP223 makes the dinosaur jump; collisions reduce lives, and collectable hearts restore lives up to five. Speed increases every 256 score points, capped at 48 FPS, while display inversion changes every 1,024 points.

06

Troubleshooting & fixes

Choose the issue that best matches what you’re seeing.

01OLED remains blank or graphics appear corrupted
Try these checks

Check the OLED supply, GND, SDA on GPIO 21, and SCL on GPIO 22. Confirm the module uses an SH1106 controller and verify the I2C connector and jumper wires.

02Touch sensor does not trigger jumps
Try these checks

Check TTP223 VCC, GND, and OUT connections. Confirm its output changes to HIGH when touched and that OUT reaches GPIO 4, then retest with stable USB power.

03Buzzer is silent or ESP32 fails to boot
Try these checks

Verify buzzer positive connects to GPIO 12 and negative to GND. GPIO 12 is an ESP32 strapping pin, so a connected module may affect startup; test boot reliability and use a suitable passive piezo buzzer.