Pico Snake Game
A game in rust that resembles the classic Snake Game from the Nokia 5110 phones era.
Author: Mihai-Septimiu Tigaeru
GitHub Project Link: https://github.com/UPB-FILS-MA/project-septimium
Description
This projects resembles the classic Snake Game from the old Nokia phones, having the same rules and mechanics. You control the Snake using a 2-axis joystick. Your score is updated live on a 4 digit display, that goes until 9999. For every interaction with "food", there is a buzzer which will play a sound. If you hit yourself, it's game over and you have to start again. You can also pass through walls. The game itself is displayed on an actual Nokia 5110 LCD display. Good luck and enjoy!
Motivation
I've chosen this project mainly because I've always wanted to create a fully functional game from zero, including hardware and I've always liked the idea of retro-themed stuff. Also, by looking on the internet and finding out that there's actual Nokia displays that can be easily used with microcontrollers I've instantly thought about one of the most popular Nokia games, Snake, and how cool it would be to recreate it using Rust.
Architecture
Log
Week 6 - 12 May
- Created the documentation of the project
- Added KiCAD Schematic
- Added 3 new libraries
Week 13 - 19 May
- Modified KiCAD Schematic
- Modified a library
- Managed to configure all the components of the project in Rust
- Finished Hardware
- Designed the aspect of the project
Week 20 - 26 May
- Modified new libraries needed for this project
- Finished Software
- Took new hardware pictures with working game
- Updated the final documentation
- Finished the whole project
Hardware
Pictures
Usage of components
- Joystick Module is used for controlling the snake (interacting with the game) and it's connected to ADC pins such that the analog voltage is converted to digital values.
- Passive Buzzer is used for beeping in various situations (sound feedback from the game).
- Nokia 5110 Display is used for displaying the game itself.
- TM1637 Module is used for keeping track of the score while playing.
- Raspberry Pi Pico H is used as the main component (microcontroller) responsible for processing input data.
- Breadboard is used for connecting every pin of the hardware components.
Schematics
Bill of Materials
Device | Usage | Price |
---|---|---|
Rapspberry Pi Pico H | The microcontroller | 40 RON |
2-axis (XY) Joystick Module | Game Interactions | 6 RON |
Breadboard 400 | Hardware Pins Connections | 9 RON |
Pasive Buzzer Module | Sounds | 4 RON |
LCD Nokia 5110 Display 84x48 | Game Displaying | 24 RON |
LED Display Module with Serial Interface (TM1637) | Score Counting | 11 RON |
Dupont Wires M-M | Connections | 7 RON |
Dupont Wires F-F | Connections | 6 RON |
Dupont Wires M-F | Connections | 6 RON |
Jumper Wires Kit | Connections | 9 RON |
Micro USB Cable | Power | 8 RON |
Software
Library | Description | Usage |
---|---|---|
embassy | Rust framework for embedded programming | Used for writing correct, safe and asynchronous code, particularly targeted at embedded systems |
pcd8544 (modified) | Rust crate for PCD8544 displays forked and modified so it is compatible with embedded-graphics | Used for initiliazing and writing on the PCD8544 display |
tm1637-embedded-hal | Rust crate for TM1637 microcontroller | Used for controlling the TM1637 module |
embedded-snake (modified) | Rust crate for Snake Game mechanics forked and modified so it has more functions | Used for implementation of the proper Snake Game |
rand | Rust crate for random number generating | Used for creating a random position for the "food" |
embedded-graphics | Rust crate for drawing graphics on small displays | Used for displaying the game |