Building a dedicated game device is a rewarding way to sharpen your embedded design skills. This project walks through creating a two-player reaction time game using an ESP32, RGB LEDs, an OLED screen, and a custom 3D-printed enclosure. The goal is simple: wait for the signal, react as fast as you can, and beat your opponent.

We'll cover the electronics, mechanical design, firmware, and final assembly so you can replicate or adapt the build for your own prototypes.
Components and Tools
Here's what you'll need to build the reaction time duel:

- ESP32 development board (30-pin) ×1
- 22 mm single-touch buttons ×2
- 0.96-inch I²C OLED display ×1
- Four-pin common-cathode RGB LEDs ×6
- 220 Ω resistors ×6
- 10 kΩ resistors ×5
- Small single-touch buttons ×3
- Active buzzer (3–24 V) ×1
- Vero board (6×14 cm) ×1
- Jumper wires (male-to-male, male-to-female)
- Small 32-hole breadboards ×2
Essential tools:
- Hot glue gun or double-sided tape
- Zip ties
- Electrical tape
- Wire cutters or scissors
- Soldering iron, solder, and flux
Notes:
- The OLED used here has an SH1106 controller. If you use an SSD1306 display, treat it as an alternative and adjust the firmware accordingly.
- Ensure your RGB LEDs are common-cathode. Common-anode LEDs require firmware and circuit changes.
- In the prototype, shared RGB color channels use a single 220 Ω resistor. For better reliability, use individual current-limiting resistors per LED color channel.
- Check the buzzer's voltage and current requirements before connecting. A transistor or MOSFET driver may be needed.
Circuit Design: Vero Board Modules
Instead of integrating everything on one board, I built three small circuits on Vero board: two for the RGB LEDs and one for the three menu buttons. This keeps the build modular and simplifies mounting inside the enclosure.

RGB LED Circuit
Two identical boards were made, each driving three RGB LEDs for one player. Each board measures approximately 16.4 × 49.5 mm.
The red, green, and blue channels are tied together across the three LEDs, with a 220 Ω resistor on each shared color channel. Each LED's common pin is brought out separately via jumper wires, giving three independent enable connections per board so the ESP32 can control each LED individually.

A limitation of this prototype is the use of a single resistor per shared color channel rather than per LED. This can cause uneven current distribution among parallel LEDs, leading to brightness differences. For a more robust design, use separate current-limiting resistors for each LED's red, green, and blue channels.
Three-Button Circuit
The second circuit handles three small menu buttons: Mode, Select, and Start. The board measures about 34 × 26 mm.
Each button has its own signal line, while the other side connects to a common ground. When pressed, the signal is pulled to ground, and the ESP32 detects the input via pull-up resistors. Connections on the back of the board were made with soldered wire links. Three signal wires and a common ground are brought out for wiring to the ESP32.

That covers the small circuit modules. Next, we move on to the enclosure that holds everything together.
Enclosure Design and 3D Printing
The enclosure was designed in Fusion 360 with a clean layout and enough space for all electronics.
The overall enclosure measures 233.75 × 83 × 56.5 mm (L × W × H). The main body is divided into three sections: two small end compartments for the 22 mm player buttons and a larger central area for the ESP32 and breadboards.
Two openings are provided: one for the Micro-USB port to power the ESP32, and another to let sound from the buzzer escape. The lid has openings for the two player buttons, three menu buttons, and RGB LEDs. The OLED display sits on top of the lid, with a small opening below for its pins to connect electrically.

3D Printing
Both parts were printed on an Anycubic Kobra 3 using PLA filament and default settings. Total print time was about four hours.
Approximate print parameters and results:
- Filament: PLA
- Layer height: 0.2 mm
- Nozzle diameter: 0.4 mm
- Infill: ~15–20%
- Total print time: ~4 hours
- Main body mass: ~115 g
- Lid mass: ~35 g
- Total mass: ~150 g
The print quality is sufficient for a prototype, and PLA is a suitable choice for this type of project. Since the enclosure is relatively small and doesn't bear heavy loads, these settings fully meet the requirements.
Wiring and Component Layout
With the enclosure printed and the small circuit boards ready, it's time to assemble everything. I started by mounting components on the lid, then connected everything to the ESP32.
Component Mounting
I placed the two RGB LED boards, the three-button circuit board, and the OLED display on the lid. Hot glue was used to secure the boards, ensuring the LEDs and buttons align with their openings. The OLED display sits on top of the lid, with its pins passing through a small opening for electrical connections underneath.
Next, I placed the ESP32 development board on two small breadboards. This makes it easy to connect GPIO pins and distribute power and ground without soldering everything directly to the ESP32.
Connecting to the ESP32
Connections follow the schematic and pin assignments below, using a 30-pin ESP32 development board.
RGB color channels:
- Player 1 Red — GPIO 13
- Player 1 Green — GPIO 14
- Player 1 Blue — GPIO 16
- Player 2 Red — GPIO 17
- Player 2 Green — GPIO 18
- Player 2 Blue — GPIO 19
Each player's three RGB LEDs share the red, green, and blue control channels. Each LED's common pin has an independent enable connection, allowing the ESP32 to control all six LEDs individually.
LED enable pins:
- LED 1 enable — GPIO 23
- LED 2 enable — GPIO 25
- LED 3 enable — GPIO 26
- LED 4 enable — GPIO 27
- LED 5 enable — GPIO 32
- LED 6 enable — GPIO 33
Player and menu buttons:
- Player 1 button — GPIO 34
- Player 2 button — GPIO 35
- Mode button — GPIO 36
- Select button — GPIO 39
- Start/Reset button — GPIO 4
The first four inputs use external 10 kΩ pull-up resistors to 3.3 V. Pressing a button pulls the signal to ground. The Start/Reset button uses the ESP32's internal pull-up.
OLED display:
- SDA — GPIO 21
- SCL — GPIO 22
- Power — 3.3 V
- Ground — GND
The display uses an SH1106 controller and communicates with the ESP32 via I²C.
Buzzer:
- Red wire — GPIO 5
- Black wire — GND
When needed, I connected the buzzer through a suitable driver rather than assuming the ESP32's GPIO can supply its full operating current.
Before powering the device, check connections against the schematic, confirm power and ground are correct, and ensure there are no solder bridges or loose wires. Also verify that the LED common-anode wiring matches the LED type and circuit design.
Important: On the classic ESP32, GPIO 34, 35, 36, and 39 are input-only pins without internal pull-ups, so external 10 kΩ pull-ups are required. Also, GPIO 5 is a strapping pin and may cause a brief beep at boot depending on the driver circuit.
Code Setup and Initial Testing
With the hardware ready, it's time to bring the game to life. The complete firmware is provided, so you don't need to copy and paste code from the article.
I used the Arduino IDE to program the ESP32.
Required libraries and software:
- Adafruit SH110X — for communication with the SH1106 OLED display.
- Adafruit GFX Library — graphics library for Adafruit SH110X.
- ESP32 Arduino Core 3.x — provides ESP32 board support and includes the LED PWM functions used in this firmware.
Install the Adafruit libraries via the Arduino IDE Library Manager. To install ESP32 board support, open Tools → Board Manager, search for ESP32 by Espressif Systems, and install a compatible 3.x version.
Before uploading firmware, select your ESP32 board and the correct serial port.
Make sure the types.h file included with the firmware is in the same sketch folder as all other provided source files. The firmware uses the ESP32 Arduino Core 3.x LED PWM API, so older 2.x versions may require code modifications.
Upload and Test
After installation, open the provided firmware file, connect the ESP32 via USB, and upload the code.
After uploading, check the following:
- Does the OLED screen initialize correctly?
- Do the RGB LEDs respond to game states?
- Are all five buttons detected properly?
- Does the buzzer produce the expected sounds?
- Does the game correctly handle countdown, start signal, and result screens?
Using an SSD1306 OLED Instead
My display uses the SH1106 controller. If you have an SSD1306 display, install the Adafruit SSD1306 library and make the following firmware changes:
Replace:
with:
Replace the display object declaration:
with:
Change the display initialization call from:
to:
Finally, replace all SH110X_WHITE with SSD1306_WHITE and all SH110X_BLACK with SSD1306_BLACK in the firmware.
Switching to Common-Anode RGB LEDs
The current firmware is configured for common-cathode RGB LEDs, where enable pins are active-low. Common-anode LEDs require inverted RGB PWM values and opposite enable pin polarity.
Make four changes:
- In the setRGB() function, replace each ledcWrite() color value with 255 - c.r, 255 - c.g, and 255 - c.b respectively.
- In setPlayerLEDs(), change the active state from LOW to HIGH and the inactive state from HIGH to LOW.
- In clearAllLEDs(), change the enable pin state from HIGH to LOW.
- In setup(), initialize the LED enable pins to LOW instead of HIGH.
These changes assume the firmware uses 8-bit PWM values ranging from 0 to 255.
Once initial testing succeeds, you can proceed to final assembly.
Final Assembly
After all wiring and initial testing, it's time to put everything together.
- I first mounted the two player buttons in their positions on the enclosure, then installed the buzzer.
- Next, I placed the breadboards in the central compartment, inserted the ESP32, and adjusted wiring to ensure everything aligned properly.
- Once all components were in place, I carefully closed the lid, making sure no wires were pinched or caught between the two parts.
The original lid design used a snap-fit, but printer tolerances made it slightly loose when closed. To fix this, I applied a small amount of hot glue around the edges to secure the lid. Using hot glue instead of a stronger adhesive allows the enclosure to be opened later for repairs or modifications.
Game Modes and Gameplay
With the hardware assembled and firmware uploaded, you're ready to play. The device offers four game modes, configurable countdown, and an OLED interface for navigating menus and viewing results.
Starting a Match
When powered on, the device runs a brief LED color sweep and startup routine. Press the START button to enter the main menu.
Use the three control buttons to navigate the interface:
- MODE: cycles through available game modes.
- SELECT: opens the configuration menu.
- START: enters the selected mode and starts the game.
After selecting a mode, press START to reach the ready screen, then press START again to begin the round.
Round Flow
Each round follows the same sequence:
- Countdown: the display counts down from the set start value, accompanied by short beeps if sound is enabled. LEDs indicate countdown progress.
- Wait: the display shows a waiting message while the device generates a random delay. Players must avoid pressing their buttons during this period.
- Start signal: LEDs flash white and the buzzer sounds, prompting both players to react as quickly as possible.
- Result: the device determines the winner and displays reaction times. The winner's LEDs turn green, and the loser's turn red.
The random delay prevents players from predicting exactly when the start signal will appear.
Conclusion and Future Improvements
The reaction time duel started as a simple idea: use off-the-shelf electronics and a custom 3D-printed enclosure to create an interactive reaction time game. The final prototype integrates an ESP32, RGB LEDs, buttons, a buzzer, and an OLED display into a multiplayer game with multiple modes and configurable settings.
The project involved designing the enclosure, wiring and testing individual components, writing firmware, and integrating everything into a fully functional device. Although some adjustments were needed during enclosure assembly, the final prototype successfully combines hardware and software.
Future versions could improve by using a custom PCB instead of breadboards, refining enclosure tolerances for a cleaner snap-fit, or adding more game modes and performance statistics.
What this means for your build
- When prototyping with RGB LEDs, use individual current-limiting resistors per color channel to avoid uneven brightness and ensure consistent performance.
- Pay attention to ESP32 pin capabilities: input-only pins (34, 35, 36, 39) require external pull-ups, and strapping pins like GPIO 5 may cause unexpected behavior at boot.
- For OLED displays, verify the controller type (SH1106 vs. SSD1306) and adjust firmware libraries and initialization accordingly to avoid display issues.
- Consider the voltage and current requirements of peripherals like buzzers; use a transistor or MOSFET driver if the ESP32 GPIO cannot supply sufficient current.
- When designing enclosures for 3D printing, account for printer tolerances and design snap-fits with appropriate clearance, or plan for a temporary adhesive to allow later access.
Source: compiled from public web sources.