Skip to main content
Version: ACS CC

Mini Slot Machine

A miniature slot machine inspired by early electromechanical casino models.

info

Author: Androne Andrei
GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-andronedrei

Description

This demonstrative project functions around a Raspberry Pi Pico 2W. It drives three mechanical reels with stepper motors, plays sounds through a DFPlayer Mini, shows doubling process with leds, and displays live game information on a 1602 LCD. Software is implemented using Embassy and Rust.

Motivation

Nowadays, gambling has become an unhealthy addiction for many people, so I wanted to build a project that showcases how slot machines work today. Ever since most slot machines became fully electronic, the outcome of each game has been largely determined by the underlying software. Therefore, I created a machine that lets the user choose between two game modes (Fair – completely random; Unfair – large losses that generally do not create the same addictive behaviour).

Alongside its educational purpose, the project utilizes several elements such as UART communication for the MP3 player, I2C for the screen, and the Rust code needed to implement the two game modes.

Architecture

Diagram

Raspberry Pi Pico W 2 - RP2350

Role: Central component; controls everything else.

Mini MP3 player

Role: Provides music and sound effects, communicating with the Pico via UART and using its internal DAC to drive the small 2 W speaker.

Small speaker

Role: Effectively propagates the audio output from the sound module.

Step Motor 5V with Driver

Role: Spins the reels; communicates with the Pico through a ULN2003 driver using parallel transmission.

Small LCD screen with I2C adapter for easier communication

Role: Displays live game elements and allows the user to view selectable options.

Buttons

Role: Used for selecting options or for activating the spin and doubling features during gameplay.

Leds

Role: A pair of bi‑colour LEDs (simulating card‑colour betting) used for the gain‑doubling option if the player desires.

Log

Week 5 - 11 May

I bought all the necessary components and started testing the crates I can use in development. I also crafted some of the structural parts of my project, such as a slot machine wheel.

Week 12 - 18 May

I created custom structures to improve abstraction. I developed a system for precise control of the stepper motor’s rotation. I also built the initial phase of the project, which includes the connected wheel, spin button, and a screen to display income during play. I created the first part of the algorithms that simulate the game mechanics.

Initial Work

( See the link at the end of the page for further demonstration )

Week 19 - 25 May

Finished the project code, implementing the device at a high level as a state machine. Updated building components such as audio, bet LEDs, and random behavior. Also constructed a nice case to properly fit everything.

Building Case

Hardware

The electronics are simple and modular, centred on one Raspberry Pi Pico W:

Reels – Three 28BYJ‑48 stepper motors spin the reels through ULN2003 driver boards. The Pico sends signals and stops exactly on the right symbol.

Sound – A DFPlayer Mini holds MP3 files on a micro‑SD card. The Pico tells it what to play over UART (it just sends a number of the respective sound effect index). A small 2W speaker propagates the audio.

Display – A1602 LCD with a PCF8574 I2C backpack shows credits, mode, and symbols.

Controls – Three push‑buttons (2 for game control, one for reset) give input. Two bi‑colour LEDs flash alternatively in fast succesion to allow for betting on colour.

Power – Everything apart from motors runs from a 5 V USB supply (motors are powered separately). The Pico makes its own 3.3 V for logic.

Schematics

Schematics

Bill of Materials

DeviceUsagePrice
1x Raspberry Pi Pico 2 WMicrocontroller40 RON
1x Raspberry Pi Debug ProDebug Probe62 RON
1x Raspberry Expansion BoardQuad Expander Board80 RON
DFPlayer MiniMP3 Mini Player14 RON
50mm Speaker - 2W - 32ohmGeneric Mini Speaker5 RON
1602ALCD display29 RON
IO PCF8574Expansion module for Screen's I2C communication9 RON
3x 28BYJ-48 5V + 3x ULN2003Step Motor + Driver51 RON
2GB MicroSD CardCard for storing sounds effects20 RON
Breadboard Power SupplyComponent used for powering motors separately6 RON
Minor Components (buttons, wires, leds, battery, etc.)Taken from an Arduino Starter Pack-

Software

LibraryDescriptionUsage
embassy‑executorasync runtimeRuns cooperative tasks on the Pico
embassy-timetimers within async developementDifferent pauses
embassy-rpRP2350 hardware abstractionGPIO, UART, I2C, etc.
dfplayer-asynccrate for use of DFPlayer through UARTMusic player in my project
lcd1602-diverlcd1602 communicationLCD Screen with a PCF I2c expander
rand_pcgrandom elementsUsed in software part that controls game flow