A handheld, retro-inspired Snake game console built with Arduino and open-source hardware. SnakeBoy combines embedded programming, hardware optimization, and mechanical design into an accessible and highly optimized gaming device.
Developed as part of the Creative Electronics course in the Electronics Engineering program at the University of Málaga.
SnakeBoy is a handheld console featuring the classic Snake game displayed on a 32×8 LED matrix. Built around an Arduino Leonardo-compatible board (Save Maker I), this project demonstrates practical embedded systems design with real-time gameplay, persistent high score storage, and optimized resource utilization.
- Demonstrate embedded programming and hardware optimization techniques
- Create a fully functional gaming device using accessible components
- Utilize open-source tools and methodologies
- Achieve minimal resource footprint (<15 KB Flash, ~2. 5 KB RAM)
- Real-time Gameplay: Responsive joystick and directional button controls
- Audio Feedback: 6 distinct melodies via PWM buzzer
- Persistent Storage: High scores saved in EEPROM memory
- Efficient Architecture: State-machine-driven game logic with zero blocking delays
- Compact Footprint: <15 KB Flash / ~2.5 KB RAM usage — highly optimized
- Custom Graphics: 7×5 pixel font and smooth menu animations
- Custom Enclosure: 3D-printed case with precision-engineered component cutouts
- Status Indicator: Visual feedback LED for game states
- USB Powered: Connected operation via 5V/1A USB power supply
| Component | Specification |
|---|---|
| Microcontroller | Save Maker I (Arduino Leonardo-compatible) |
| Display | 4× cascaded MAX7219 8×8 LED matrices (32×8 total resolution) |
| Input: Analog | PS4-style analog joystick with integrated L3 push button |
| Input: Digital | 4× tactile push buttons (Up, Down, Left, Right) |
| Audio Output | Passive buzzer with PWM modulation |
| Visual Indicator | Red 5mm status LED |
| Power Supply | External 5V/1A USB power supply (wired connection) |
| Component | Arduino Pin | Function |
|---|---|---|
| MAX7219 Data | D13 | Serial data input |
| MAX7219 Clock | D11 | Clock signal |
| MAX7219 Load | D10 | Latch/load signal |
| Buzzer | D12 | PWM audio output |
| Status LED | D7 | Visual state indicator |
| Joystick X-Axis | A0 | Analog X input |
| Joystick Y-Axis | A1 | Analog Y input |
| Joystick Button (L3) | D9 | Push button input |
| Up Button | D8 | Directional input |
| Down Button | D4 | Directional input |
| Left Button | D5 | Directional input |
| Right Button | D6 | Directional input |
Note: All digital buttons utilize the internal INPUT_PULLUP feature, eliminating the need for external pull-up resistors.
SnakeBoy-Arduino-Game/
├── arduino/
│ └── main/
│ │ ├── snake. cpp # Main game logic and state machine
│ │ ├── display.cpp # LED matrix driver and rendering
│ │ ├── inputs.cpp # Joystick and button input handling
│ │ ├── sound.cpp # Audio synthesis and melody management
│ │ ├── led. cpp # Status LED control
│ │ └── config.h # Hardware configuration and pin mappings
│ └── test/
│ │ └── test_display.txt
│ │ └── test_input.txt
│ │ └── test_led_buzzer.txt
├── 3D printer/
│ ├── case/ # OpenSCAD 3D models (parametric design)
│ │ ├── front_panel.scad
│ │ ├── back_panel.scad
│ │ └── button. scad
│ │ └── button. scad
│ │ └── button. scad
├── diagrams/ # Wiring and schematic diagrams
├── README.md # This file
└── LICENSE # CC BY-NC-SA 4.0 License
- Arduino IDE 1.8.0 or later
- Arduino Leonardo board or compatible (Save Maker I)
- MAX7219 LED matrix module (32×8)
- Joystick and push buttons
- Buzzer and status LED
- 5V/1A USB power supply
-
Clone the repository
git clone https://github.com/Hamza1803/SnakeBoy-Arduino-Game. git
-
Install dependencies
- Download the
LedControllibrary in Arduino IDE:Sketch → Include Library → Manage Libraries→ Search "LedControl" - Download the
MD_MAX72XXlibrary in Arduino IDE:Sketch → Include Library → Manage Libraries→ Search "MD_MAX72XX"
- Download the
-
Configure hardware
- Review
config.hand verify pin mappings match your setup - Ensure external 5V power is connected to the LED matrix
- Review
-
Upload firmware
- Connect your Arduino Leonardo board via USB
- Open
snake.cppin Arduino IDE - Select Board: Arduino Leonardo
- Click Upload
-
Connect power
- Connect the 5V/1A USB power supply to the designated connector
- The device should power on automatically
- Move: Use joystick or directional buttons (Up, Down, Left, Right)
- Start Game: Press any button or move joystick
- Pause: Press L3 button (joystick button)
- Game Over: Collision with wall or self triggers game over
- High Score: Automatically saved to EEPROM
Project Team:
- Hamza Lotfi
- Andreea Simion
Educational Institution: Degree in Electronic Systems Engineering University of Málaga, School of Telecommunications
- Full Tutorial: SnakeBoy – An Arduino-Powered Snake Game Console on Instructables
- MAX7219 Datasheet: Available from component suppliers
- Video Full Game : https://youtu.be/4og9s7oPVPE
This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license.
You are free to:
- Share and adapt the material
- Use for educational purposes
Under the terms that you:
- Provide attribution to the original creators
- Do not use commercially
- Share derivative works under the same license
For complete license details, see the LICENSE file or visit creativecommons.org.
- Verify external 5V power is connected with shared ground
- Check MAX7219 pin connections (DATA, CLK, LOAD)
- Test with the LedControl example sketch
- Calibrate analog input in
inputs.cpp - Verify A0 and A1 connections
- Check for loose wiring
- Verify buzzer polarity and D12 connection
- Check that
sound.cppis compiled
