Skip to main content
Version: FILS English

Arcade Game

A slots machine inspired from the game GTA Online, in which the symbols are represented by the logos of programming languages.

info

Author: Pruteanu Ionut-Gabriel
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-Gabyyi

Description

The project uses two Raspberry Pi Pico 2W as the control units, along with two displays — a main display showing the slot machine game and a secondary display showing the winning combinations. The balance is simulated using an RFID card reader and a memory module. For an even better simulation, LEDs and a passive buzzer are used for audio-visual effects.

Motivation

I have always been passionate about video games, especially open-world games like GTA Online. The project and its design are inspired by the slot machines from the Diamond Casino, a classic place to spend time with friends or other players. The slot machine project is a fun one that draws positive reactions from everyone, as each person wants to try their luck. The LED animations and the sound when pressing the spin button, along with the LED animations and sound effects when winning, create a complete slot machine experience. It brings the excitement and atmosphere of a real casino into a fun and interactive project.

Architecture

Schematics Diagram

The diagram shows all the components and its connections.

diagram

Raspberry Pi Pico 2W:

  • Purpose: Controlls all the components and runs the game.
  • Connection: SPI for the displays and rfid, GPIO for the LEDs and buttons and PWM for the passive buzzer.

ILI9341:

  • Purpose: Displays the slot game, balance, bet amount, last win and encouraging messages after a loss and win message after a win.
  • Connections: via SPI
    • CS (Chip Select): GPIO17
    • CLK (Clock): GPIO18
    • MOSI (Master Out Slave In): GPIO19
    • MISO (Master In Slave Out): GPIO16
    • DC (Data/Command): GPIO14
    • Reset: GPIO15
    • Vcc 3.3V_OUT and GND

ST7735:

  • Purpose: Displays the winning combinations of symbols.
  • Connections: via SPI
    • CS (Chip Select): GPIO13
    • CLK (Clock): GPIO10
    • MOSI (Master Out Slave In): GPIO11
    • MISO (Master In Slave Out): GPIO12
    • DC (Data/Command): GPIO14
    • Reset: GPIO15
    • Vcc 3.3V_OUT and GND

RFID MFRC522:

  • Purpose: Simmulates the input/output of the balance.
  • Connections: via SPI
    • SDA: GPIO13
    • SCK (Clock): GPIO10
    • MOSI (Master Out Slave In): GPIO11
    • MISO (Master In Slave Out): GPIO12
    • RST: (Reset): GPIO21
    • Vcc 3.3V_OUT and GND

AT24C256:

  • Purpose: Stores the balance.
  • Connections: via I2C
    • SDA: GPIO26
    • SCL: GPIO27
    • Vcc 3.3V_OUT ad GND

Buttons:

  • Purpose: Controlls the input of the slots machine.
  • Connections: via GPIO
    • SPIN: GPIO6
    • BET: GPIO7
    • BET MAX: GPIO8
    • CASHOUT: GPIO9

LEDs:

  • Purpose: Visual effects for enhanced experience, the LEDs cascade when the spin button is pressed and flash when a win is hit.
  • Connections: via GPIO
    • Yellow: GPIO2
    • Green: GPIO3
    • Blue: GPIO4
    • Red: GPIO5

Passive Buzzer:

  • Purpose: Visual effects for enhanced experience, the LEDs cascade when the spin button is pressed and flash when a win is hit.
  • Connections: via GPIO
    • Vcc 3.3V_OUT and GND

Log

Week 14 - 20 April

I bought the required componenets and and started working on the display interface. I played with the display learning how it works and I managed to create a basic slot game interface that will guide the project development. I also created the led task which provide a cascade animation of the leds when the spin button is hit.

Week 21 - 27 April

I implemented a basic slot game, that uses colors instead of symbols. This will be changed into actual symbols that will be programming languages logos. I introduced a new led flickering animation that play when a win is obtained.

Week 28 - 4 April

I added the buzzer and here i ran into some problems. Initially the buttons were sending messages through signal. I changed this to channels, but the problem was that the code was randomly choosing to run either the led task, either the buzzer task, but never both at the same time. I changed again the communication method to publisher which sends explicit messages and finnaly the code was running as intended, when the spin button is pressed the led animation and buzzer starts playing and when a win is hit both the led animation and buzzer sound play.

Week 5 - 11 May

I added the RFID module, which is used for reading the card UID. Based on this UID, the slot machine assigns an associated number that simulates the card's balance. The UIDs and their associated balances are stored in external EEPROM memory, which simulates the real behavior of a card. The EEPROM is used because RFID cards do not have internal memory and cannot store information on their own. Additionally, EEPROM memory allows the storage of card UIDs and balances even after a fresh upload of the code to the Raspberry Pi Pico 2W.

Week 12 - 18 May

I completed the actual slot game, replacing the colors with actual symbols and i defined the winning combinations rules. I also connected the second display which shows the winning combinations and their value. I also assembled the project in its final version.

Week 19 - 25 May

Made small fixes. Now, if the slot machine loses power, the balance is saved to memory.

Hardware

The project uses two Raspberry Pi Pico 2W microcontrollers: one dedicated to running the main game logic and another to handle a secondary display. This dual-microcontroller setup addresses both pin limitations on the main board and compatibility issues between the embedded graphics libraries of the two displays. The system features two SPI-driven TFT displays: an ILI9341 screen for high-resolution color graphics in the main game, and a smaller ST7735 screen for secondary display. RFID functionality is provided by an MFRC522 module, used for reading RFID tags. Data storage is supported by an external EEPROM memory chip, useful for saving card details permanently, even after flashing the Pico again. The setup also includes eight LEDs paired with eight resistors for visual feedback, along with four push buttons to allow user interaction.

Initial prototype:

harware

Final project:

hardware_assembled

final_project

3D Model:

3D-model

Schematics

Main Circuit:

kicad1

Secondary Circuit:

kicad2

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico 2WThe microcontroller x239.66 RON
ILI9341Main display69.99 RON
ST7735Secondary display27.99 RON
RFID MFRC522Card Reader9.99 RON
AT24C256Stores the balance8.99 RON
Passive BuzzerAudio Effects1.69 RON
Red Cap Buttonx41.99 RON
LEDsx8 (from kit)26.99 RON
220Ω Resistorsx8 (from kit)26.99 RON

Software

LibraryDescriptionUsage
embassy-rpAccess to the pheripheralsInitializing and interacting with peripherals
embassy-executorAn async/await executor designed for embedded usageUsed for asynchronous programming
embassy-timeTimekeeping, delays and timeouts.Used for delays
embassy-syncSynchronization primitives and data structures with async supportUsed for providing channels, mutexes, signals, etc
ili9341Display driver for ILI9341Used to controll the main display
st7735Display driver for ST7735Used to controll the second display
embedded-graphics2D graphics library that is focused on memory constrained embedded devicesUsed for drawing and writing on the display
embedded-hal-asyncAn asynchronous Hardware Abstraction Layer (HAL) for embedded systemsProvides a standard way to use hardware asynchronously across different embedded devices
gpioGPIO managementUsed for controlling GPIO pins
pwmPWM moduleUsed for controlling the buzzer
smallrngRandom number generatorUsed for slots simulation
mfrc522RFID readerUsed for reading card UIDs
  1. Personal Repo
  2. Youtube video