ESP32 OLED Car Racing 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 Wi-Fi-controlled car racing game using an ESP32 development board and a 128×64 SSD1306 OLED display. Control steering, acceleration, and braking from a phone or computer through a responsive browser interface.

The game includes rear and top views, enemy cars and scooters, collision detection, scoring, variable speed control, and automatic OLED address detection. WebSocket controls work locally without internet access or an external router.

Before you power up

Disconnect USB power before wiring. Use a compatible SSD1306 display and check all I2C connections before powering.

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 the racing game and communicates with browser controls.× 1
SSD1306 OLED Display128×64 I2C screen showing the road, vehicles, speed, and score.× 1
BreadboardSupports stable temporary wiring between the ESP32 and OLED display.× 1
Connecting WiresConnect the OLED power, ground, SDA, and SCL pins.× 10
USB CablePowers the ESP32 and uploads the game firmware.× 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 development board and OLED display on a stable surface. Identify the display pins carefully and inspect the wiring before beginning assembly.

The README specifies a 128×64 SSD1306 I2C display. The supplied circuit image shows the same display and lists no separate sensors or actuators.

1 of 5
04

Software & tools

Install these before uploading the firmware.

Arduino IDEEdits, compiles, and uploads firmware to the ESP32 development board.
ESP32 Board PackageProvides ESP32 board definitions and build support in Arduino IDE.
ESPAsyncWebServerHosts the browser controller and handles asynchronous HTTP requests.
AsyncTCPProvides asynchronous TCP networking support for the ESP32 web server.
Adafruit GFX LibraryProvides drawing primitives and text-rendering functions for OLED graphics.
Adafruit SSD1306 LibraryInitializes and updates compatible SSD1306 OLED displays over I2C.
Serial MonitorDisplays OLED initialization and Wi-Fi startup diagnostics at 115200 baud.
05

Expected output

Compare your build with the result described here.

FINAL CHECKPOINT

After startup, the OLED performs a self-test, displays the Wi-Fi name and password, and shows the controller address. Connecting a phone or computer loads the steering wheel, accelerator, brake, reset, and camera controls.

The OLED shows the road, player car, enemies, speed, and score. Rear and top views differ; top view includes cars or scooters. Passing an enemy adds ten points; collisions show Game Over, followed by automatic reset after about three seconds.

06

Troubleshooting & fixes

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

01OLED remains blank or initialization fails
Try these checks

Check VCC at 3.3V, GND, SDA on GPIO 21, and SCL on GPIO 22. Confirm the display uses an SSD1306 controller and has address 0x3C or 0x3D, then inspect Serial Monitor diagnostics.

02ESP32 Wi-Fi network or browser controller fails
Try these checks

Confirm the board starts its access point and connect to ESP32-CarGame-v4 using the configured password. Open 192.168.4.1 manually, then check WebSocket connection status and ensure the device remains connected to the ESP32 network.

03Steering or pedal controls respond incorrectly
Try these checks

Open the controller in landscape orientation. Drag the wheel horizontally and hold the pedals to send controls. If steering is reversed, change STEER_INVERT from 1 to -1 in the firmware and upload it again.