Pico Simon
I’ve made this simple-to-build, Raspberry Pi Pico-based project in homage to the 80s memory game, Simon, in which the player is challenged with remembering an ever-increasing sequence of flashing lights and tones. (See step 3 below for a video of the game in action.)
Supplies
- Raspberry Pi Pico (x1)
- Breadboard (x1)
- Jumper wires (x14)
- Passive buzzer (x1)
- NPN transistor (x1)
- 1kΩ resistor (x1)
- 220Ω resistors (x4)
- Coloured LEDs (x4)
- Buttons (x5). Buttons with coloured caps to match the LEDs are preferable but not essential.
Note that all parts for the project can be found within the SunFounder Euler kit, which is available directly from the manufacturer or from resellers such as Amazon
Hardware Assembly
Assemble the hardware as illustrated in the schematic. By way of explanation:
- GPIO pins 17, 18, 19 and 20 are used to control output to the LEDs. Each LED has an associated 220Ω current limiting resistor.
- GPIO pins 12, 13, 14 and 15 are used to read the state of the colour buttons.
- GPIO pin 16 is used to send output to the passive buzzer via an NPN transistor with a current limiting 1kΩ resistor.
- GPIO pin 11 is used to determine when the game reset button is pressed.
Software
The game software is written in MicroPython and consists of three modules:
- pico-simon.py – Main module which instantiates an object of the Game class and calls the method to wait for the reset button to be pressed.
- game.py – Module which implements the Game class. It contains the game logic and manages interactions with the hardware via an object of the Hardware class.
- hardware.py – Module which implements the Hardware class and its associated interface with the hardware.
Source code is available for download via GitHub.
If you are unsure how to upload code to your Pico, I recommend using the Thonny IDE (see Getting started with Raspberry Pi Pico and Download and Upload the Code for useful pointers on how to get started).
Gameplay
The video provides a demonstration of the gameplay. An introductory power-on light and sound sequence provides a useful check that the hardware is working as intended. Following the initial fanfare, the player presses the reset button and the game begins. The player repeats the increasing sequence of lights and tones presented by the hardware. The game ends when the player makes a mistake – a game-over tone is emitted and the correct sequence is played. A new game is started by pressing the reset button.