Skip to main content
Version: ACS CC

Minesweeper

Classic implementation of the minesweeper game where the goal is to reveal all the cells without hitting a mine.

info

Author: Dobrin David-Andrei
GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-ddavid03dda

Description

Classic implementation of the minesweeper game where the goal is to reveal all the cells without hitting a mine. Also several difficulty levels that increase the number of mines on the map. The player can see in a menu the battery status and select the difficulty before the game starts and then play until he loses or wins.

Motivation

It was a favorite game I used to play as a kid when the internet was down. I wanted to build a physical version I could keep around the house—complete with sounds and vibration—to give it a fresh, tactile feel.

Architecture

Block-diagram of the Minesweeper hardware architecture

  • Raspberry Pi Pico 2 W as central control unit, running the game logic in Rust.
  • Vibration motor to signal when the player hits a mine (loss).
  • Buzzer for sound effects—menu navigation, tile selection, win/loss alerts.
  • ILI9341 LCD to display the menu, battery status, and game grid.
  • Buttons for cursor movement, selection, and menu control.

Log ­#

Week 5 – 11 May

Week 12 – 18 May

Week 19 – 25 May

Hardware

  1. Raspberry Pi Pico 2 W

    • Purpose: Main controller.
    • Function: Runs the Minesweeper game logic in Rust, reads button inputs, and drives the display, buzzer, and vibration motor.
  2. Vibration Motor

    • Purpose: Haptic feedback.
    • Function: Vibrates briefly when the player uncovers a mine (loss).
  3. Buzzer

    • Purpose: Audio feedback.
    • Function: Emits tones for menu navigation, tile reveals, and win/loss alerts.
  4. ILI9341 LCD

    • Purpose: Visual interface.
    • Function: Displays the difficulty menu, battery status, game grid, and end-game messages.
  5. Push-buttons (×5)

    • Purpose: User controls.
    • Function: Up, Down, Left, Right for cursor movement; Select for revealing tiles and confirming menu choices.

Hardware Overview

  • The Raspberry Pi Pico 2 W orchestrates all inputs and outputs, executing the Minesweeper logic.
  • Push-buttons let the player navigate menus and move the cursor across the minefield.
  • The ILI9341 LCD renders the game grid, menus, and battery level in real time.
  • The Buzzer provides immediate audio cues for safe tile reveals, mine hits, and victories.
  • The Vibration Motor delivers a tactile buzz when a mine is uncovered, reinforcing the loss event.

Schematics

Minesweeper KiCad schematic

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico 2 WMain microcontroller80 RON
Vibration motor moduleLoss feedback vibration15 RON
Colored wires male–male (40 × 10 cm)Wiring between Pico and peripherals5 RON
Colored wires male–female (40 × 15 cm)Wiring sensor/buttons8 RON
Colored wires female–female (40 × 15 cm)Breadboard‐to‐module wiring7 RON
Passive buzzer (3.3 V)Sound effects1 RON
NPN Transistor 2N2222 TO-92Driving buzzer/vibration motor0.17 RON
Breadboard HQ (400 pts)Prototyping4.50 RON
Resistor 0.25 W 2.2 kΩCurrent limiting0.10 RON
Diode 1N4007Flyback protection0.50 RON
40-pin male header, 2.54 mm (×5)GPIO breakout5 RON
ILI9341 LCD (2.4″, SD slot)Display67 RON
Push-buttons × 5User input10 RON

Software

LibraryDescriptionUsage
rp2040-halHardware Abstraction Layer for Raspberry Pi PicoGPIO, PWM, ADC, timers
embedded-halCommon traits for embedded hardware accessDigital I/O, SPI bus, delay timers
embedded-graphics2D graphics library for embedded displaysRendering grid, menus, battery indicator
ili9341ILI9341 TFT display driverSPI communication with the LCD
panic-haltMinimal panic handlerHalts MCU on unrecoverable errors
nbNon-blocking I/O traitsDebouncing buttons, reading battery level