Skip to main content
Version: FILS English

Pong-Game

A multiplayer Pong game inspired by the classic consoles, bringing back the experience of playing with friends during your free time. Designed to capture the simplicity and fun of those timeless gaming moments.

info

Author: Militaru Luana-Maria
GitHub Project Link:https://github.com/UPB-PMRust-Students/project-lvanaaa

Description

This project is built using a Raspberry Pi Pico 2W, an LCD display, and two joysticks that control the paddles. A buzzer is triggered when the ball collides with the paddles or the top/bottom walls, while a life system is implemented using red LEDs.

Motivation

I have been passionate about games since I was little. I remember my classmates coming to school with handheld consoles, which had screens smaller than today’s phones and lots of buttons. I chose this project out of nostalgia for those old consoles. I aimed to recreate a classic atmosphere, with a buzzer that triggers when the ball hits the walls, and a physical life system using LEDs. The game itself is simple and doesn’t have a complex dynamic—it's a classic that many may have forgotten, but whenever we see it again, we can’t help but give it another try, whether it's to test our old skills or just for fun.

Architecture

Schematic Diagram

This is the diagram that illustrates the components and their connections.

Schematic diagram

Raspberry Pi Pico 2W

  • Role: Acts as the "brain" of the project — it controls all components: reads the joystick input, manages the LEDs and buzzer, updates the LCD display, and runs the game logic.
  • Connections: GPIO pins for LEDs and the buzzer. ADC pin for the joystick. SPI interface for the LCD display.

LEDs

  • Interface: GPIO
  • Role: Represent the players' lives. Each LED being turned on or off indicates whether a life is lost or remaining.
  • Connections: Each LED is connected to a GPIO pin configured as output.A current-limiting resistor (220Ω) is placed between the GPIO and the LED. Left lives: GPIO4, GPIO5, GPIO6. Right lives: GPIO7, GPIO8, GPIO9. Win LED left: GPIO2. Win LED right: GPIO3.

Passive Buzzer

  • Interface: PWM
  • Role: Emits a short sound when the ball collides with a paddle or the top/bottom walls, providing sound feedback during the game.
  • Connections: Connected to a GPIO pin configured for PWM (Pulse Width Modulation). PWM controls the frequency and duration of the sound. PWM Channel: 5A, GPIO10.

Joysticks

  • Interface: ADC
  • Role: Controls the paddle's vertical movement (up and down, only Y-axis connected).
  • Connections: The Y-axis output of the joystick is connected to an ADC (Analog-to-Digital Converter) pin on the Raspberry Pi Pico 2W. The X-axis is not used in this project. Left joystick: GPIO26. Right joystick: GPIO27.

LCD Display

  • Interface: SPI
  • Role: Displays the Pong game, including the ball, paddles, and background.
  • Connections: Connected via the SPI protocol to the Pico:
    • CS (Chip Select): GPIO17
    • CLK (Clock): GPIO18
    • MOSI (Master Out Slave In): GPIO19
    • MISO (Master In Slave Out): GPIO16
    • DC (Data/Command): GPIO15
    • Reset: GPIO14
    • Power supply connected to 3.3V and GND.

Log

Week 5 - 11 May

After the project was approved, I gathered all the necessary components and started working on the hardware. I also began designing a 3D model for the game’s case, but I decided to put it on hold for the moment, as I wasn’t yet sure how I wanted the components to be positioned in the final setup. I completed the hardware assembly and began researching the crates I intended to use for the software development.

Week 12 - 18 May

Week 19 - 25 May

Hardware

The hardware setup consists of a Raspberry Pi Pico 2W microcontroller as the core unit, interfacing with multiple peripherals. Two analog joysticks, each connected through the ADC pins, are used to control the paddles' vertical movement. An LCD display, communicating via the SPI interface, visually represents the game elements such as the paddles, ball, and background. A passive buzzer, driven using PWM signals, provides audio feedback during ball collisions with the paddles or the screen edges. The life system is physically implemented using multiple red LEDs connected to GPIOs, which decrease as players lose lives. Additionally, two green LEDs are used to indicate the winner by lighting up next to the victorious player at the end of the match.

Schematics

KiCad Scheme

TinkerCad Scheme

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico 2WThe microcontroller39.66 RON
2 x Biaxial Joystick ModuleJoystick10.70 RON
2.8" SPI LCD Module with ILI9341 Controller (240 x 320 px)LCD Display69.99 RON
Passive Buzzer ModuleBuzzer1.69 RON
6 x 5 mm Red LED with Diffused LensRed LED2.34 RON
2 x 5 mm Green LED with Diffused LensGreen LED0.78 RON
15 cm 10p Male-Female WiresMale-Female Wires4.45 RON
10 cm 40p Male-Female WiresMale-Male Wires5.99 RON
8 x 220Ω ResistorsResistors0.80 RON

Software

LibraryDescriptionUsage
embassy-rpAccess to the pheripheralsInitializing and interacting with peripherals
embassy-executorAn async/await executor designed for embedded usageUsed for asynchronous programming
embassy-timeTimekeeping, delays and timeouts.Used for delays
embassy-syncSynchronization primitives and data structures with async supportUsed for providing channels, mutexes, signals, etc
ili9341Driver to interface with the ILI9341 TFT LCD displayUsed to controll the display
embedded-graphics2D graphics library that is focused on memory constrained embedded devicesUsed for drawing and writing on the display
embedded-hal-asyncAn asynchronous Hardware Abstraction Layer (HAL) for embedded systemsProvides a standard way to use hardware asynchronously across different embedded devices
gpioGPIO managementUsed for controlling GPIO pins
adcADC driverUser for controlling the joysticks
pwmPWM moduleUsed for controlling the buzzer
  1. Arduino Pong Game!