Sudoku Game
Play sudoku using a Raspberry Pi Pico 2W and a keyboard module
Author: Laura Florentina Sandu
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-laurasandu13
Description
My project makes it possible to play Sudoku by inputting the numbers and moving from one cell to another by using a keyboard module. The game is visible on a webpage on the laptop. Games are previously added and players can choose what difficulty to play. Players will be able to start a new game, input numbers, use the undo and redo operations and check if their answers are correct.
Sudoku is a logic-based, combinatorial number placement puzzle. The objective is to fill the 9x9 grid with numbers so that each column, each row, and each 3x3 subgrid contain the numbers from 1 to 9 without repetition.
The game helps with cognitive stimulation by improving memory, concentration and logic, and also provides a calming effect and a sense of accomplishment.
Motivation
I have been playing Sudoku on and off since I was a little child, and over time, it became one of my favorite comfort games to play. The game is pretty easy and straightforward, and I thought it would be perfect to make it the subject of my project.
Architecture
Log
Before week 5 - 11 May
I had bought all necessary components way before and wired the Picos first. I flashed my debugger and then made sure everything worked by running the lab skeleton with the "Hello, world!" program.
Then I wired my keyboard module to make sure it worked properly, and wrote a program to get input from it in the terminal. After multiple tries and checks of the wiring and the code, I still didn't manage to do it.
Week 5 - 11 May
This week I finally managed to make the keyboard module work by continuously trying to find other solutions and methods to make it work.
Then I got started on the game logic.
Week 12 - 18 May
Week 19 - 25 May
Hardware
- Raspberry Pi Pico 2W - main microcontroller used for game logic
- Raspberry Pi Pico - debugger
- Keyboard module - number keyboard used for input and other controls
The pins of the keyboard module have a very interesting configuration. There are 9 pins, of which the first and last are NC (No Connect) pins. The remaining 7 pins each correspond to a row or a column. The picture below clearly shows the pin configuration.
Schematics
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico 2W | The microcontroller | 39.66 RON |
Raspberry Pi Pico | The debugger | 30 RON |
Keyboard module | Input and other functionalities | 18.44 RON |
Total comes up to 88.1 RON.
Software
Library | Description | Usage |
---|---|---|
embassy-rp | HAL crate designed for the RP2040 and RP2350 microcontrollers | gpio and uart for the keyboard module |
embassy-time | used for timekeeping, delays and timeouts in embedded systems | syncronization of tasks |
embassy-usb | async USB device stack for embedded devices in Rust | connectivity between pico and laptop |
embassy-net | no-std no-alloc async network stack, designed for embedded systems | networking |
cyw43 | Rust driver for the CYW43439 wifi+bluetooth chip | wifi connectivity |