Project Name
3x3 SLOTS MACHINE
Author: Pitic Andrei
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-Pitic888
Descriptionβ
This project implements a classic 3x3 slot machine game using Rust, designed to run on a Raspberry Pi Pico 2W with a connected ST7789 display. The player presses a button to spin the reels, and the system randomly generates and displays symbols on a 3x3 grid. If the player lands matching combinations, they win points or they can risk them in a double or nothing minigame. The project also includes simple animations and sound effects to enhance the experience.
Motivationβ
The slot machine is a fun, interactive project that allows me to work with hardware (display, buttons, possibly a buzzer) and learn more about random number generation, graphics rendering, and game design on microcontrollers. Itβs also a great opportunity to explore how Rust works in constrained environments.
Architectureβ
Main Components:
-
Game Logic Module
Handles the core slot machine logic: spinning, random symbol generation, win condition checks, and score tracking. -
Display Module
Uses thest7789
andembedded-graphics
libraries to render the 3x3 grid, symbols, animations, and text. -
Input Module
Reads button presses from GPIO pins to trigger the spin.
-- Sound Module
Uses the Arduino TPA3118 audio amplifier to play sound effects for spins, wins, losses, and the minigame.
-
Memory Module
Uses the EEPROM AT24C256 to store high scores and possibly settings.
Flow:
Input (button press) β Game Logic β Display Update β (Optional) Sound Output
Logβ
Week 5 - 11 Mayβ
- Set up the Rust development environment for Raspberry Pi Pico 2W
- Created the project repository and initialized dependencies (
st7789
,embedded-graphics
) - Designed basic slot machine logic (reels, spin, random generation, double or nothing feature )
Week 12 - 18 Mayβ
Week 19 - 25 Mayβ
Hardwareβ
- Raspberry Pi Pico W as the main controller
- 2.4-inch Arduino LCD for displaying the slot grid and game information
- Arduino Audio Mono Amplifier TPA3118 for sound effects through a speaker
- EEPROM Module AT24C256 for saving high scores or settings
- Breadboard kit for prototyping the circuit
- 10 kΞ© resistor for pull-ups or signal conditioning
- Three pushbuttons for user input: spin, reset, and possibly menu navigation
Schematicsβ
Bill of Materialsβ
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico W | The microcontroller | ~40 RON |
2.4-inch Arduino LCD | Display for grid and symbols | ~40 RON |
Arduino Audio Mono Amplifier TPA3118 | Drives speaker for sound effects | ~20 RON |
EEPROM Module AT24C256 | Stores high scores or settings | ~9 RON |
Breadboard Kit | Prototyping platform | ~22 RON |
10 kΞ© Resistor | Pull-ups or signal conditioning | ~3 RON |
Pushbuttons (x3) | User input for spin, reset, etc. | ~β RON |
Softwareβ
Library | Description | Usage |
---|---|---|
st7789 | Display driver for ST7789 or compatible LCDs | Used to drive the 2.4-inch Arduino LCD display |
embedded-graphics | 2D graphics library | Draws the slot grid, symbols, text, and minigame UI |
rand | Random number generation | Generates random spins and randomizes the correct button in the minigame |
rp-pico | Raspberry Pi Pico HAL | Accesses GPIO, SPI, IΒ²C, and other hardware features |
at24c256 driver | EEPROM driver | Stores high scores or player settings in the AT24C256 EEPROM |
PWM or audio library | Audio output control | Drives the audio amplifier for sound effects |
Linksβ
- ST7789 Rust driver
- embedded-graphics examples
- Rust on Raspberry Pi Pico
- Random Number Generation in Rust
- AT24C256 EEPROM Rust driver
- TPA3118 Audio Amplifier datasheet
- Rust embedded HAL β general hardware abstraction library
- KiCAD tutorials β for making the schematics