DIY Games Console Making at Home Using Arduino

by Jhuman in Circuits > Arduino

9 Views, 0 Favorites, 0 Comments

DIY Games Console Making at Home Using Arduino

Games Console 5.jpg

If you love electronics, Arduino projects, and retro-style games, then this DIY project is perfect for you.

Supplies

  1. Arduino Nano
  2. 0.96" OLED Display (SSD1306, I2C)
  3. Push Buttons
  4. Diodes (1N4007)
  5. Potentiometer (10K)
  6. Resistors (100K, 390K)
  7. As required
  8. DC Jack / Signal Input
  9. Breadboard / PCB
  10. Jumper Wires
  11. As required
  12. 5V Power Source

What You Will Make

In this project, you will build a DIY Arduino Nano–based Game Console with:

  1. OLED screen graphics
  2. 4 physical game buttons
  3. Adjustable game speed
  4. Retro‑style gameplay

This console can run simple games like Snake, Dodge, or Racing games.

Understanding the Circuit

Screenshot 2026-01-03 182000.png

Discover Easy, Affordable, and Reliable PCB manufacturing with JLCPCB!Register to get $70 New customer coupons:https://jlcpcb.com/?from=EST Special Deal: Get a $30 coupon for JLCPCB premium 6-layer PCBs: https://jlcpcb.com/6-layer-pcb?from=getcoupon


This game console is built around the Arduino Nano, which controls the display, reads button inputs, and runs the game logic.


🔌 Power Section

  1. The entire circuit operates on 5V DC
  2. Power can be supplied via:
  3. USB cable
  4. External 5V regulated supply
  5. All GND points are common, which is very important for stable operation


🖥️ OLED Display Section (SSD1306 – I2C)

The OLED display is used to show game graphics, score, and menus.

Connections:

  1. VCC → 5V (from Arduino Nano)
  2. GND → GND
  3. SDA → A4 (I2C Data)
  4. SCL → A5 (I2C Clock)

Why I2C?

  1. Uses only 2 data wires
  2. Faster communication
  3. Saves Arduino pins

The OLED resolution is 128×64 pixels, perfect for retro-style games.


🎮 Button Input Section (KEY1–KEY4)

Four push buttons are used for game control:

  1. UP
  2. DOWN
  3. LEFT
  4. RIGHT / SELECT

Each button is connected through a 1N4007 diode.

Why diodes are used:

  1. Prevents back current
  2. Avoids false triggering
  3. Improves button reliability

The buttons are connected to Arduino digital pins D9–D12 and configured using INPUT_PULLUP, so no external pull-up resistors are needed.


🎚️ Potentiometer & Signal Input Section

A 10K potentiometer is connected to an analog pin:

  1. Middle pin → A0

This is used to:

  1. Control game speed
  2. Navigate menus
  3. Adjust difficulty level

A 390K resistor and DC input jack are included to safely accept an external control signal if needed.


Assemble the Hardware

Screenshot 2026-01-03 185609.png
  1. Place Arduino Nano on breadboard or PCB
  2. Connect OLED display carefully
  3. Solder diodes with correct polarity
  4. Attach push buttons
  5. Add potentiometer
  6. Double‑check GND and VCC connections

⚠️ Incorrect diode direction will stop button detection

Install Required Arduino Libraries

Open Arduino IDE → Library Manager and install:

  1. Adafruit GFX Library
  2. Adafruit SSD1306 Library

These libraries allow drawing graphics on the OLED display.

Upload the Arduino Code

  1. Connect Arduino Nano to PC
  2. Select Board: Arduino Nano
  3. Select Processor: ATmega328P
  4. Choose correct COM port
  5. Upload the provided game code

After upload, the OLED screen should light up.


#include <Adafruit_GFX.h>

#include <Adafruit_SSD1306.h>


#define SCREEN_WIDTH 128

#define SCREEN_HEIGHT 64

#define OLED_RESET -1

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);


// Button pins

#define UP_BTN 2

#define LEFT_BTN 3

#define RIGHT_BTN 4

#define DOWN_BTN 5


// Debounce timing

unsigned long lastInputTime = 0;

const unsigned long debounceDelay = 100;


// Snake grid and logic

#define GRID_SIZE 4

#define MAX_LENGTH 64


int snakeX[MAX_LENGTH];

int snakeY[MAX_LENGTH];

int length = 3;

int dirX = 1;

int dirY = 0;


int foodX, foodY;

bool gameOver = false;


void setup() {

Serial.begin(9600);


pinMode(UP_BTN, INPUT_PULLUP);

pinMode(LEFT_BTN, INPUT_PULLUP);

pinMode(RIGHT_BTN, INPUT_PULLUP);

pinMode(DOWN_BTN, INPUT_PULLUP);


if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {

Serial.println(F("OLED failed"));

while (1);

}


display.clearDisplay();

display.display();


snakeX[0] = 64; snakeY[0] = 32;

snakeX[1] = 60; snakeY[1] = 32;

snakeX[2] = 56; snakeY[2] = 32;


generateFood();

}


void loop() {

if (gameOver) {

display.clearDisplay();

display.setTextSize(1);

display.setTextColor(SSD1306_WHITE);

display.setCursor(30, 30);

display.println("Game Over!");

display.display();

delay(3000);

resetGame();

}


handleInput();

moveSnake();

checkCollision();

drawGame();


delay(150);

}


void handleInput() {

unsigned long now = millis();

if (now - lastInputTime < debounceDelay) return;


if (!digitalRead(UP_BTN) && dirY != 1) {

dirX = 0; dirY = -1;

lastInputTime = now;

} else if (!digitalRead(DOWN_BTN) && dirY != -1) {

dirX = 0; dirY = 1;

lastInputTime = now;

} else if (!digitalRead(LEFT_BTN) && dirX != 1) {

dirX = -1; dirY = 0;

lastInputTime = now;

} else if (!digitalRead(RIGHT_BTN) && dirX != -1) {

dirX = 1; dirY = 0;

lastInputTime = now;

}

}


void moveSnake() {

for (int i = length - 1; i > 0; i--) {

snakeX[i] = snakeX[i - 1];

snakeY[i] = snakeY[i - 1];

}


snakeX[0] += dirX * GRID_SIZE;

snakeY[0] += dirY * GRID_SIZE;


if (snakeX[0] == foodX && snakeY[0] == foodY) {

if (length < MAX_LENGTH) length++;

generateFood();

}

}


void generateFood() {

foodX = random(0, SCREEN_WIDTH / GRID_SIZE) * GRID_SIZE;

foodY = random(0, SCREEN_HEIGHT / GRID_SIZE) * GRID_SIZE;

}


void checkCollision() {

if (snakeX[0] < 0 || snakeX[0] >= SCREEN_WIDTH || snakeY[0] < 0 || snakeY[0] >= SCREEN_HEIGHT) {

gameOver = true;

return;

}


for (int i = 1; i < length; i++) {

if (snakeX[0] == snakeX[i] && snakeY[0] == snakeY[i]) {

gameOver = true;

return;

}

}

}


void drawGame() {

display.clearDisplay();


// Draw snake

for (int i = 0; i < length; i++) {

display.fillRect(snakeX[i], snakeY[i], GRID_SIZE, GRID_SIZE, SSD1306_WHITE);

}


// Draw food

display.fillRect(foodX, foodY, GRID_SIZE, GRID_SIZE, SSD1306_WHITE);


display.display();

}


void resetGame() {

length = 3;

snakeX[0] = 64; snakeY[0] = 32;

snakeX[1] = 60; snakeY[1] = 32;

snakeX[2] = 56; snakeY[2] = 32;

dirX = 1; dirY = 0;

gameOver = false;

generateFood();

}


How the Code Works (Detailed Explanation)

This project uses a simple but powerful Arduino sketch to create real-time gameplay.


📚 Libraries Used

  1. Wire.h → Enables I2C communication
  2. Adafruit_GFX.h → Graphics functions (pixel, line, text)
  3. Adafruit_SSD1306.h → OLED display driver

These libraries make it easy to draw game graphics on the OLED screen.


🧠 Display Initialization

  1. OLED resolution is set to 128×64 pixels
  2. I2C address is 0x3C
  3. Display is cleared and text color is set to WHITE

This ensures a clean screen before the game starts.


🎛️ Button Handling Logic

  1. Buttons are configured as INPUT_PULLUP
  2. When a button is pressed, the pin reads LOW
  3. Each button controls player movement direction

This logic ensures fast and responsive controls.


🎚️ Analog Input Logic

  1. analogRead() reads the potentiometer value (0–1023)
  2. map() converts this value into game speed delay

This allows real-time speed adjustment while playing.


🕹️ Game Logic & Movement

  1. Player position is stored as X and Y coordinates
  2. Button presses update these coordinates
  3. constrain() keeps the player inside the screen boundary


🖼️ Graphics Rendering

  1. Screen is cleared every frame
  2. Player is drawn as a small filled rectangle
  3. Score and text are updated
  4. display.display() refreshes the OLED

This loop creates smooth animation.


⏱️ Game Loop Timing

  1. delay() controls the game speed
  2. Speed changes dynamically using the potentiometer


Powering the Game Console

You can power the console using:

  1. USB cable (5V)
  2. External 5V regulated supply
  3. Battery pack (optional upgrade)

⚠️ Do not exceed 5V input

Testing the Game Console

  1. Press buttons → Player moves
  2. Rotate potentiometer → Speed changes
  3. OLED updates smoothly

If display does not work:

  1. Check OLED address (0x3C)
  2. Check SDA & SCL wiring


Customization Ideas

🔊 Add buzzer for sound effects

🎮 Add joystick module

🔋 Add Li‑ion battery + TP4056

📦 Design a 3D‑printed case

💾 Save high score using EEPROM

Final Result

You now have a fully working DIY Arduino Nano Game Console 🎉

This project is perfect for:

  1. STEM education
  2. Arduino beginners
  3. YouTube DIY content
  4. Retro game lovers


Conclusion

You have successfully built a DIY Arduino Nano Game Console using simple components and smart coding.

Through this project you learned:

  1. How to interface an OLED display
  2. How to read button inputs reliably
  3. How to use analog input for control
  4. How to draw graphics and build game logic