Skip to main content
Version: FILS English

RustBox

RustBox - The Rust Gaming Box

info

Author: Frimu Aurel-Viorel
GitHub Project Link: https://github.com/AurasV/RustBox-The-Rust-Gaming-Box

Description

Using the power of two screens, two joysticks and a few buttons, RustBox is a (mini) gaming console that can run several Singleplayer and Multiplayer (1v1) games:

Singleplayer games:

  • Brick Breaker
  • Snake

Multiplayer games:

  • Tic Tac Toe
  • Snake battle
  • Pong

Motivation

I have always wanted to create some portable gaming devices since I've first seen them on YouTube and other websites. Wanting to one up my roommate that made something similar - Rogue Rust

Architecture

Architecture

The STM32 Board is the whole gaming station and it connects to the rest of the components like so:

  • To the 1602 LCD Display using I2C;
  • To the Two Axis HW-504 Joysticks using ADC for the X and Y movements and using GPIO for the push button they each have;
  • To the built in button using GPIO
  • To the (Fake) Arduino using Serial

Log

Week 1

Got the rough outline of the components and planned what games I want to implement, ordered the components and started researching.

Week 2

Got the components and started doing the wiring and some tests, couldn't figure out how to get the STM32 to play nicely with the TFT screen. Started going insane trying different things / libraries to make it work.

Week 3

Tested TFT screen with an Arduino that I had from a previous purchase, it worked so switched to using the Arduino as a GPU and communicating between STM32 and Arduino via Serial. Finished the wiring and started work on the code, successfully making Tic Tac Toe work with the controllers and the screens.

Week 4

Made a main menu, struggled to find a decent enough speed that the Arduino could keep up with (text wouldn't appear / wouldn't be formatted if speed was too high, games would be too slow if the speed was too low)

Hardware

The hardware used is:

NUCLEO-U545RE-Q - STM32 Board - 1x
(Fake) Arduino from Plusivo - ATMEGA328 microcontroller - 1x
TFT IPS Display - GMT130-V1.0 with Driver IC - ST7789 using SPI - 1x
LCD 1602 Text Display - using I2C - 1x
HW-504 Joystick - 2x \

Schematics

KiCAD schematic:

Schematic

Bill of Materials

DeviceUsagePrice
NUCLEO-U545RE-Q - STM32 BoardThe MicrocontrollerLoaned from Class - 0 RON
(Fake) Arduino from Plusivo - ATMEGA328 microcontrollerTo control the TFT displayGot as Part of a Kit, Standalone Price - 47.47
Ecran LCD - 1602 IIC/I2CTo Display Simple Text21.04 RON
TFT Color Display - GMT130-V1.0 ST7789Showing the Actual Game40.99 RON
Two Axis Joystick - HW-504Used for Playing the Games5.35 RON x 2
Push Button - for BreadboardReset Button1 RON
Breadboard HQ - 830 PointsConnecting EverythingGot as Part of a Kit, Standalone Price - 9.98 RON
Female to Male Wires - 20 cmWires7.99 RON
Male to Male Wires - Various SizesWiresGot as part of a Kit, standalone price - 7.99 RON
TotalIf Hardware Obtained From Kits Are Accounted147.16 RON

Software

LibraryDescriptionUsage
embassy-stm32Hardware Abstraction Layer for STM32 microcontrollersUsed for GPIO, ADC, I2C, UART, and peripheral configuration on the STM32U545
embassy-executorAsync/await executor for embedded systemsUsed to run the async main function and manage tasks
embassy-timeTimekeeping, delays and timeoutsUsed for Timer::after_millis() delays throughout the game logic
embedded-hal-asyncAsync traits for embedded HALUsed for I2C trait bounds in LCD helper functions
embedded-io-asyncAsync traits for embedded I/OUsed for UART Write trait bounds in TFT display functions
heaplessStatic-friendly data structures that don't require dynamic memoryUsed for String used in UART
defmtEfficient, deferred formatting for logging on embedded systemsUsed for debug logging with info!() macro
defmt-rttRTT transport for defmtUsed to transport defmt logs over RTT to the debugger
cortex-mLow-level access to Cortex-M processorsRequired for Cortex-M CPU features and critical sections
cortex-m-rtMinimal runtime for Cortex-M microcontrollersProvides the startup code and interrupt vector table
panic-probePanic handler for probe-runHandles panics by printing via defmt and halting execution
  1. Rogue Rust
  2. I Made an Original Xbox Portable
  3. I Built My Own Steam Deck!