Skip to main content
Version: FILS English

Project Name

3x3 SLOTS MACHINE

info

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 the st7789 and embedded-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​

Circuit diagram for the 3x3 Slots Machine showing connections between Raspberry Pi Pico W, display, buttons, and other components

Bill of Materials​

DeviceUsagePrice
Raspberry Pi Pico WThe microcontroller~40 RON
2.4-inch Arduino LCDDisplay for grid and symbols~40 RON
Arduino Audio Mono Amplifier TPA3118Drives speaker for sound effects~20 RON
EEPROM Module AT24C256Stores high scores or settings~9 RON
Breadboard KitPrototyping platform~22 RON
10 kΞ© ResistorPull-ups or signal conditioning~3 RON
Pushbuttons (x3)User input for spin, reset, etc.~β€” RON

Software​

LibraryDescriptionUsage
st7789Display driver for ST7789 or compatible LCDsUsed to drive the 2.4-inch Arduino LCD display
embedded-graphics2D graphics libraryDraws the slot grid, symbols, text, and minigame UI
randRandom number generationGenerates random spins and randomizes the correct button in the minigame
rp-picoRaspberry Pi Pico HALAccesses GPIO, SPI, IΒ²C, and other hardware features
at24c256 driverEEPROM driverStores high scores or player settings in the AT24C256 EEPROM
PWM or audio libraryAudio output controlDrives the audio amplifier for sound effects
  1. ST7789 Rust driver
  2. embedded-graphics examples
  3. Rust on Raspberry Pi Pico
  4. Random Number Generation in Rust
  5. AT24C256 EEPROM Rust driver
  6. TPA3118 Audio Amplifier datasheet
  7. Rust embedded HAL β€” general hardware abstraction library
  8. KiCAD tutorials β€” for making the schematics