OLED Tetris Game Using Arduino Nano

by DESHBOT in Circuits > Arduino

14 Views, 0 Favorites, 0 Comments

OLED Tetris Game Using Arduino Nano

WhatsApp Image 2026-09-18 at 10.23.43 AM.jpeg
WhatsApp Image 2026-09-18 at 10.23.21 AM.jpeg

The objective of this project is to create a small playable Tetris game using an Arduino Nano, a 128×64 OLED display, and two push buttons.

Supplies

des 1.jpeg
oled.jpeg
WhatsApp Image 2026-09-18 at 10.23.28 AM.jpeg

DESHBOT SHIELD

OLED DISPLAY

INBUILD BUTTON

Pin Connections

OLED Display

OLED PinArduino Nano

VCC - 5V

GND - GND

SDA - A4

SCL - A5

Buttons

ButtonArduino Nano

Left Button - D12

Right Button - D10

Other side of both buttons - GND

The buttons use the Arduino's internal INPUT_PULLUP, so external resistors are not required.

Working Principle


When the Arduino starts, the OLED displays the TETRIS title screen.

After the start screen, a random Tetris piece appears at the top of the game area.

The program continuously checks the two buttons:

  1. Press D12 → piece moves left.
  2. Press D10 → piece moves right.
  3. Press both buttons → piece rotates.
  4. The piece automatically moves downward.
  5. When the piece reaches another block or the bottom, it becomes fixed.
  6. The program checks for completed horizontal lines.
  7. Completed lines are removed and the player receives points.
  8. When the blocks reach the top and a new piece cannot be placed, GAME OVER is displayed.

Tetris Pieces

The program contains seven standard Tetris pieces:

  1. I
  2. O
  3. T
  4. L
  5. J
  6. S
  7. Z

The pieces are selected randomly using the Arduino's random() function.

Downloads

Conclusion


This project demonstrates how an Arduino Nano can be used to create a complete miniature game using an OLED display and two buttons. It combines graphics, button input, randomization, collision detection, rotation, scoring, and game-state management into a simple embedded-system project.