Simon Says Game
Rust-based interactive memory game with lights.
Author: Toacă Andreia
GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-andreia-toaca
Description
The game "Simon Says" uses a Raspberry Pi Pico to create an interactive memory game involving lights generated by LEDs. The player must reproduce randomly generated light sequences in the exact order to advance through the levels. As the level increases, the game's difficulty also rises. Throughout the game, various messages are displayed on the screen to guide the player. Real-time feedback is provided, and mistakes are indicated by an error message and a distinct sound. The game includes a timer, requiring the player to complete each sequence before time runs out. There is also a limited number of attempts, and once these are exhausted, the game ends.
Motivation
The decision to develop a "Simon Says" game using the Raspberry Pi Pico was driven by the desire to combine embedded systems programming with an engaging and educational game concept. "Simon Says" is ideal for testing both hardware interaction (LEDs, buttons, buzzer, OLED display) and software logic (random sequence generation, timers, user input validation). The game offers a clear progression system through levels, which allows for scalable complexity and challenges. Additionally, it enhances the player's memory and reaction time, making it not just entertaining, but also cognitively stimulating. Implementing this game was a valuable opportunity to integrate real-time feedback, user interface elements, and embedded timing mechanisms - all within a fun and interactive project.
Architecture
The game is built around a Raspberry Pi Pico, which acts as the central controller. It receives input from four push buttons and generates output through RGB LEDs, an OLED display, and a buzzer. The diagram below illustrates how the components interact to implement the game logic.
- Four RGB LEDs will display a random sequence that the player must memorize.
- The OLED display will show messages.
- By pressing one of the four buttons, the player will try to reproduce the sequence step by step.
- The buzzer will emit sounds indicating whether the input was correct or incorrect, while the OLED display will provide real-time visual feedback.
- A countdown timer will limit the time the player has to complete each sequence.
- After a certain number of failed attempts, the game will end and offer the option to restart.
The entire interaction is cyclic:
- Wait for the player to press the Start button
- Generate and display sequence
- Wait for player input
- Provide feedback after each action
- Evaluate result and either advance level or reset
Log
Week 6 – 12 May
Week 7 – 19 May
Week 8 – 26 May
Hardware
The hardware setup consists of the following components:
-
Raspberry Pi Pico – the main microcontroller responsible for controlling the game logic and all connected peripherals.
-
Start button – used to start the game.
-
Four individual LEDs (Red, Green, Blue, Yellow) – used to visually display the sequences that the player must follow.
-
Four push buttons – allow the player to input the color sequence, corresponding to each LED.
-
Buzzer – emits audio feedback for correct or incorrect actions.
-
OLED Display – displays game-related information.
-
Breadboard and jumper wires – connect the components and help build the circuit.
-
Resistors – ensure current-limiting for the LEDs to prevent damage.
Schematics
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico 2 (RP2350, 2pcs) | The microcontroller | 79.32 RON |
RGB LEDs (4pcs) | LED sequence | 1.2 RON |
Push buttons (5pcs) | Player input | 1.8 RON |
Buzzer | Sound feedback | 1.40 RON |
OLED display | Display game feedback | 23.29 RON |
Resistors (220Ω, 4pcs) | Limit LED current | 0.40 RON |
Male Pin Header (40p, 2.54mm, 2pcs) | Connects Pico to breadboard | 1.98 RON |
Breadboard | Prototyping platform for wiring components | 14.28 RON |
Jumper wires(Male to Male, 10pcs, 10 cm) | Connections between Raspberry Pi Pico and breadboard | 2.85 RON |
Jumper wires(Male to Male, 10pcs, 20 cm) | Connections between Raspberry Pi Pico and breadboard | 2.53 RON |
Jumper wires(Male to Female, 40 pcs, 20 cm) | Connections between Raspberry Pi Pico and hardware modules | 7.99 RON |
Software
Library | Description | Usage |
---|---|---|
embassy-rs | HAL for RP2040 with async support | Core hardware abstraction |
embedded-graphics | Drawing library for OLED | Displaying messages |
ssd1306 | Display driver | OLED control |
rand | Random generation | Generate random LED sequences |