Skip to main content
Version: FILS English

Sudoku Game

Play sudoku using a Raspberry Pi Pico 2W and a keyboard module

info

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​

alt text

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.

alt text

alt text

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.

alt text

Schematics​

alt text

Bill of Materials​

DeviceUsagePrice
Raspberry Pi Pico 2WThe microcontroller39.66 RON
Raspberry Pi PicoThe debugger30 RON
Keyboard moduleInput and other functionalities18.44 RON

Total comes up to 88.1 RON.

Software​

LibraryDescriptionUsage
embassy-rpHAL crate designed for the RP2040 and RP2350 microcontrollersgpio and uart for the keyboard module
embassy-timeused for timekeeping, delays and timeouts in embedded systemssyncronization of tasks
embassy-usbasync USB device stack for embedded devices in Rustconnectivity between pico and laptop
embassy-netno-std no-alloc async network stack, designed for embedded systemsnetworking
cyw43Rust driver for the CYW43439 wifi+bluetooth chipwifi connectivity
  1. Datasheet of Raspberry Pi Pico 2W
  2. Datasheet of keyboard module
  3. Embassy documentation
  4. Mathematics of Sudoku