|
NanoArduino
|
x 1 | |
|
OLED裸屏-焊接式, 白色 |
x 1 |
![]() |
arduino IDEArduino
|
🎮 DIY Arduino Nano Snake Game Console with OLED Display
🎮 DIY Arduino Nano Snake Game Console with OLED Display and Buttons
Do you love retro games? Want to build your own handheld Snake game console? Today, I'm going to show you how to make a DIY Snake Game Console using an Arduino Nano, 0.96” OLED Display, and just 4 buttons! Let’s dive into this fun and educational electronics project. 💡
🧰 Components Needed
- Arduino Nano
- OLED Display (0.96” I2C)
- 4 Push Buttons
- 4 × 10KΩ Resistors
- Breadboard & Jumper Wires
- USB Cable for Programming
🔌 Wiring Diagram
Below is the wiring diagram to connect the components. Make sure you follow this properly:
OLED Display:
- GND → Arduino GND
- VCC → Arduino 5V
- SCL → Arduino A5
- SDA → Arduino A4
- Buttons (with Pull-up Resistors):
- UP → Arduino D2
- LEFT → Arduino D3
- RIGHT → Arduino D4
- DOWN → Arduino D5
- Each button is connected with a 10K pull-down resistor to ensure stable readings.
💻 Arduino Code
You can copy and paste the code below directly into your Arduino IDE. This code draws a Snake game on the OLED display and lets you control it using the 4 buttons.
#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);
}
// Remaining functions: handleInput(), moveSnake(), generateFood(), checkCollision(), drawGame(), resetGame()
// (Included in full in the downloadable code)
🕹 How It Works
- The snake moves on a grid drawn on the OLED screen.
- You control its direction using 4 buttons (UP, DOWN, LEFT, RIGHT).
- The snake grows longer every time it eats food.
- The game ends if the snake hits the wall or itself.
🧠 Tips
- You can increase the difficulty by reducing the delay in the loop() function.
- Add a score system and show it on the display.
- Enclose the components in a 3D-printed or cardboard case for a portable console!
📽 Bonus: Video Tutorial
🎥 I'm also making a CapCut Bangla Tutorial Series on this. Stay tuned on my YouTube channel to watch the full build and see it in action!
📎 Conclusion
This project is a fantastic way to learn about Arduino, graphics, and game logic while having fun. Once done, you’ll have your very own handheld Snake Game Console that you built from scratch! 🚀
If you liked this tutorial, leave a comment, share it with friends, and subscribe for more awesome DIY electronics projects. ❤️
🎮 DIY Arduino Nano Snake Game Console with OLED Display
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.

Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW
ESP32-S3 4.3inch Capacitive Touch Display Development Board, 800×480, 5-point Touch, 32-bit LX7 Dual-core Processor
BUY NOW
Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW- Comments(0)
- Likes(0)

- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Estiak Khan
-
Make a 16-Channel Home IoT project using NodeMCU ESP32 WROOM Module If you're looking to build a versatile IoT device capable of controlling up to 16 appliances or devi...
-
DIY Pure Sine Wave Inverter Making At Home DIY Pure Sine Wave Inverter Making at Home Using EGS002 Module: A Complete GuideBuilding your own pu...
-
Build a MIND-BLOWING Mini Oscilloscope at Home with EST Projects Build a MIND-BLOWING Mini Oscilloscope at Home with EST ProjectsEver wondered how you can measure an...
-
Best IOT Project Making At Home using Microcontroller || PCBway https://www.pcbway.com/?from=technology4powerEvery electronic device needs PCBs. Are you looking for...
-
Universal Battery AutoCut Charge Controller with LCD - DIY at Home Are you looking to build a reliable and efficient battery AutoCut charge controller? Look no further...
-
PIC16F877A Trainer Board Build Your Microcomputer || Home-Made Microcontroller Master Trainer Tutorial Banglahttps://www.pcbw...
-
Autocut DC Mini IPS for DC 12V Load Autocut DC Mini IPS for DC 12V LoadIf you are looking for a reliable Autocut DC Mini IPS for DC 12V ...
-
Build a 12V Battery Autocut System with LCD Display Are you looking for an efficient and affordable way to protect and monitor your 12V battery system? ...
-
DIY Transistor Tester | Build Your Own LCR Meter at Home with Arduino Nano Are you fascinated by electronics and want to create your own tools for testing components? Building...
-
🎮 DIY Arduino Nano Snake Game Console with OLED Display DIY Arduino Nano Snake Game Console with OLED Display and ButtonsDo you love retro games? Want to bu...
-
DIY 150W IPS Making At Home with Auto Changeover System | Mini IPS 2025 How to Make an Automatic 150W IPS Using Two Circuit ModulesAre you looking for a reliable and effici...
-
DIY RTC Digital Clock with Professional PCB Design In this blog post, we will guide you through making a DIY RTC Digital Clock using an Arduino UNO and...
-
🚀 DIY Long Backup Mini DC IPS | Make at Home Using a UPS Transformer! 💡 DIY Long Backup Mini DC IPS | Make at Home Using a UPS Transformer! IntroductionBuilding a Mini DC I...
-
How to Make a Simple DIY Mini DC Automatic IPS at Home Looking for a reliable power backup solution for your DC appliances? Building a Mini DC Automatic IP...
-
DIY Easily Make a Universal Any Type of Battery Charge Controller At Home DIY Easily Make a Universal Any Type of Battery Charge Controller At HomeIf you’re into DIY electron...
-
Make a 16-Channel Home IoT project using NodeMCU ESP32 WROOM Module If you're looking to build a versatile IoT device capable of controlling up to 16 appliances or devi...
-
DIY Pure Sine Wave Inverter Making At Home DIY Pure Sine Wave Inverter Making at Home Using EGS002 Module: A Complete GuideBuilding your own pu...
-
Build a MIND-BLOWING Mini Oscilloscope at Home with EST Projects Build a MIND-BLOWING Mini Oscilloscope at Home with EST ProjectsEver wondered how you can measure an...
-
Best IOT Project Making At Home using Microcontroller || PCBway https://www.pcbway.com/?from=technology4powerEvery electronic device needs PCBs. Are you looking for...
-
Universal Battery AutoCut Charge Controller with LCD - DIY at Home Are you looking to build a reliable and efficient battery AutoCut charge controller? Look no further...
-
PIC16F877A Trainer Board Build Your Microcomputer || Home-Made Microcontroller Master Trainer Tutorial Banglahttps://www.pcbw...
-
Autocut DC Mini IPS for DC 12V Load Autocut DC Mini IPS for DC 12V LoadIf you are looking for a reliable Autocut DC Mini IPS for DC 12V ...
-
Build a 12V Battery Autocut System with LCD Display Are you looking for an efficient and affordable way to protect and monitor your 12V battery system? ...
-
DIY Transistor Tester | Build Your Own LCR Meter at Home with Arduino Nano Are you fascinated by electronics and want to create your own tools for testing components? Building...
-
🎮 DIY Arduino Nano Snake Game Console with OLED Display DIY Arduino Nano Snake Game Console with OLED Display and ButtonsDo you love retro games? Want to bu...
-
DIY 150W IPS Making At Home with Auto Changeover System | Mini IPS 2025 How to Make an Automatic 150W IPS Using Two Circuit ModulesAre you looking for a reliable and effici...
-
DIY RTC Digital Clock with Professional PCB Design In this blog post, we will guide you through making a DIY RTC Digital Clock using an Arduino UNO and...
-
Commodore 64 1541-II Floppy Disk Drive C64 Power Supply Unit USB-C 5V 12V DIN connector 5.25
124 1 2 -
Easy to print simple stacking organizer with drawers
74 0 0 -
-
-
-
Modifying a Hotplate to a Reflow Solder Station
1116 1 6 -
MPL3115A2 Barometric Pressure, Altitude, and Temperature Sensor
627 0 1 -
-
Nintendo 64DD Replacement Shell
478 0 2 -
V2 Commodore AMIGA USB-C Power Sink Delivery High Efficiency Supply Triple Output 5V ±12V OLED display ATARI compatible shark 100W
1398 4 3