Skip to main content
Version: ACS CC

Beyond 2048

A project about mixing classic 2D games in a single one on Raspberry Pico, having 2048 in the main stage.

info

Author: Nenciu George-Robert
GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-robertnen

Description

The objective of the project is to show the knowledge gained throughout the semester by making functional hardware that runs games written in Rust. Starting with a 2048 games, it can be very fast changed to Tetris, creating more fun for the player.

Motivation

For many years I loved playing games, even it is not in a computer. While trying to prove what I learn this semester about Rust and hardware, I wanted to show that anyone can create a game on anything that has electricity.

Arhitecture

Architecture

Log

Week 28 April - 4 May

Forked the project and started the documentation. Added the bill of materials and the software most likely used.

Week 5 May - 11 May

Most time spend testing each component to be working and fixing small typos. I should not forget that I started to code and to add small functions.

Week 12 April - 18 May

Created basic logic after finishing with the hardware part. Everything is working very well and testing was taken more serious. Added logic for the SPI LCD module and for the buttons. Holding a button will execute it's command only one time. To do it more, the player has to press multiple times

Week 19 May - 25 May

Implemented a mechanic that prevents executing the same command when holding a button. It will happen only one time, after it will stop until a new button is pressed (or the same). The game is was created using a struct and an impl. There are tiles with numbers until 2^14 and it can go beyond it without any problem. The grid can be changed between 4x4, 5x5 and 6x6.

Hardware

This project is using the following components:

  • 2x Raspberry Pi Pico 2W for controlling the display and the results intended while pressing the buttons;
  • 1x 1.8" SPI LCD Module (128 x 160) to display the game;
  • 5x push buttons (4 for movements, 1 to change / reset a game).

Schematics

Schematics

Photos

Photo 1 Photo 2 Photo 3 Photo 4

Bill of materials

NameQuantityUsagePrice
Raspberry Pi Pico 2W2One for debugging (UART), the other for controlling
the architecture
39,66 lei
1.8" SPI LCD Module (128 x 160)1Display for game status, score etc.28,99 lei
Breadboard Jumper Wires Set66Connections between components (picos, buttons,
LCD, etc.)
7,99 lei
0.25 W 10K Ω Resistor10Pull-down resistors for buttons1 leu
2.54 mm Red Pin Headers3Headers for connecting Picos and LCD to the
breadboard
2.97 lei
Breadboard HQ (830 Points)2Main breadboard for connecting the buttons19,96 lei
400p HQ Breadboard1Auxiliary breadboard, likely for GPIO and others4,56 lei
6 x 6 x 6 Push Button84 for movement, 1 for reset / game switch, others
as spares
2,88 lei
Micro USB 1 m Black Cable1Power and programming for a Pico6,95 lei

Software

This is not final. This is most likely what I'll use after I get the last order of components which are missing.

CrateDescriptionUsage
rp2035-halHardware Abstraction Layer for the RP2035 microcontrollerDirect access to GPIOs, UART, SPI, I2C, timers, PWM, etc., on the Pico
embedded-halStandard traits for embedded peripherals (e.g., digital I/O, SPI, I2C)Foundation for cross-platform driver development and HALs
panic-halt (or) defmtpanic-halt: minimal panic handler; defmt: logging and debug outputHandling panics or enabling real-time logging/debugging
embedded-graphics2D graphics primitives for displays (no-std)Drawing shapes, text, images on the LCD
st7735-lcdDriver for ST7735-based SPI displaysCommunicating with and rendering to the 1.8" SPI LCD module
heaplessFixed-capacity data structures with no heap allocationQueues, buffers, or hash maps without dynamic memory
cortex-mLow-level access to ARM Cortex-M processor featuresAccessing special registers, enabling interrupts, etc.
cortex-m-rtRuntime support for Cortex-M processorsDefines the entry point, vector table, and startup code
usb-deviceUSB device stack for embedded systemsCreating USB peripherals (e.g., serial communication over USB)

I got inspiered from the links mentioned below:

  1. Lab 01 - Debug
  2. Lab 02 - GPIO
  3. Lab 05 - Serial Peripheral Interface
  4. 2048
  5. More than just 2048