Introduction

The retro Snake game, revived for Arduino! Play using pixel graphics on an OLED, dodge your own tail, eat food, and watch your score climb, with authentic joystick controls for a true arcade experience.

Key Features

  • Retro pixel graphics on OLED display
  • Joystick-based movement and control
  • Score and high score tracking
  • Sound feedback with buzzer
  • Clean, modular code and open-source files

How It Works

Move the snake using the joystick module—each time you eat "food" the snake grows longer, but beware of crashing into your own tail or the walls! The OLED screen updates the snake's position, score, and high score in real time; a buzzer gives sound on food consumption and game over moments.

Components Required

Component Model/Size Description
Arduino (Uno/Nano) Uno, Nano Main controller board
OLED Display SSD1306, 0.96" or 1.3" Display game graphics
Joystick Module Analog, KY-023 Directional player control
Buzzer Piezo, 5V Sound for game events
Breadboard, Jumper Wires - Convenient prototyping

Pin Configuration

Module Pin Arduino
OLED I2C VCC / GND / SDA / SCL 5V / GND / A4 / A5 (Uno/Nano)
Joystick VRX / VRY / SW / VCC / GND A0 / A1 / D2 / 5V / GND
Buzzer + Connects to D9 (PWM)
Buzzer - Connects to GND

Component Details & Connections

Arduino Uno

Arduino Uno Board

The Arduino Uno is a popular microcontroller board based on the ATmega328P. It serves as the brain of this project, managing inputs, game logic, and display output.

OLED Display (SSD1306)

OLED SSD1306 Display

This 0.96-inch OLED module uses I2C communication. It provides crisp pixel graphics for the game. The display connects to Arduino's I2C pins (A4 & A5).

Connection: VCC → 5V, GND → GND, SDA → A4, SCL → A5.

Joystick Module (KY-023)

Joystick Module KY-023

The analog joystick acts as the input device to control the snake's movement by reading X and Y axis positions.

Connection: VRX → A0, VRY → A1, SW → D2 , VCC → 5V, GND → GND.

Buzzer

Piezo Buzzer

The buzzer provides simple audio feedback for game events such as food eaten and game over.

Connection: + → D9 (PWM pin), - → GND.

Wiring Diagram

See schematic below for full prototyping setup.

Wiring Schematic

Game Screenshot

Snake Game Screenshot

Demo Video