Back to projects

Embedded Systems / AVR Firmware / Hardware Integration

AVR Dodgeball Game on Arduino UNO R3

Project Summary

A real-time embedded mini-game built on an ATmega328P-based Arduino UNO R3 using direct register-level firmware, a 1.44-inch SPI LCD, joystick input, buzzer audio, EEPROM high-score storage, and a multiplexed 4-digit 7-segment display.

Status
Completed coursework project
Role
Firmware + hardware integration + visualization
Stack
AVR C/C++, ATmega328P, SPI LCD, ADC, Timer ISR
Hardware
UNO R3, joystick, buzzer, 74HC595, 7-segment display

I. Overview

This project is a hardware-driven dodgeball game implemented on an ATmega328P microcontroller. The player controls a paddle near the bottom of a 128 × 128 LCD screen while four balls bounce around the display. The objective is to survive as long as possible; the score increases once per second during gameplay, and contact between any ball and the paddle ends the round.

The focus was not just the game itself, but the embedded system design behind it: direct I/O register control, timer-based task scheduling, SPI display output, analog joystick input, EEPROM-backed high-score persistence, and peripheral coordination on a constrained 8-bit microcontroller.

II. What I Built

I built a complete embedded game loop with cooperative firmware tasks for the ball system, paddle control, collision detection, reset handling, game-state management, buzzer audio, score counting, and 7-segment display multiplexing. The system uses a finite-state machine with start, playing, and game-over states, while hardware buttons and joystick input control gameplay and high-score reset.

Firmware Timer-driven cooperative task scheduler with multiple FSM-style tasks
Display system 1.44-inch SPI LCD for gameplay plus 4-digit 7-segment display for score and high score
Input system ADC joystick movement, joystick press high-score reset, and LCD right button start/restart
Peripheral control 74HC595 shift register, buzzer output, EEPROM storage, and register-level pin mapping
Resume skills Embedded C, microcontroller debugging, state machines, real-time task design, and hardware/software integration

IV. System Architecture

01

Input layer

The joystick uses ADC input for left/right paddle control, while the LCD right button starts or restarts the game and the joystick press resets the stored high score.

02

Game logic

The GameMaster FSM controls GM_START, GM_PLAYING, and GM_GAME_OVER states while separate tasks update balls, paddle motion, collision checks, and score timing.

03

Output peripherals

The SPI LCD renders the game, the buzzer plays background audio and collision feedback, and the 74HC595 drives the multiplexed score display.

04

Persistence

EEPROM stores the high score so the system can preserve progress across resets, making the game behave like a standalone embedded device instead of a temporary demo.

V. Firmware Task Model

Task 0 Ball — updates four bouncing ball positions inside the LCD area
Task 1 Paddle Control — reads joystick ADC direction and moves the paddle
Task 2 Collision Check — detects ball-to-paddle contact and triggers game over
Task 3 Reset — handles joystick-down high-score reset behavior
Task 4 GameMaster — controls start, gameplay, and game-over state transitions
Task 5 Buzzer — plays gameplay music and short collision beep effects
Task 6 Score Count — increments score once per second, capped at 99
Task 7 Display — multiplexes the 4-digit 7-segment display through the 74HC595

VI. Hardware Integration

The project required mapping firmware behavior to physical pins and peripherals. The LCD SPI bus used MOSI, SCK, CS, DC/A0, and RST connections; the buzzer used a timer-controlled digital output; the 74HC595 shift register drove the segment data; and analog pins handled joystick direction, joystick press, digit select, and the LCD right start/restart button.

Firmware-to-hardware mapping

Key signal assignments

ATmega328P
LCD SPI PB3/D11, PB5/D13, PB2/D10, PB0/D8, PB1/D9
Buzzer PD3/D3 timer output
74HC595 PD7/D7, PD6/D6, PD5/D5
Joystick ADC0/A0 direction, PC3/A3 press
Digit select PC4/A4 tens, PC5/A5 ones
Start/restart PC2/A2 LCD right button

Presenting the pin map clearly matters because this project is a hardware/software integration project, not just a graphics demo. Each visible component in the visual corresponds to firmware behavior in the embedded game.

VII. Technical Challenges

The main challenge was coordinating several peripherals without relying on high-level Arduino abstractions. The LCD, joystick, buzzer, EEPROM, shift register, and 7-segment display all had to share timing cleanly, while the game still needed to feel responsive. Breaking the firmware into tasks made the system easier to reason about and helped separate input handling, game state, display updates, and sound output.

Another challenge was making the project explainable. For a resume or portfolio, a finished board alone is not always enough; the viewer needs to see the firmware architecture, pin mapping, and hardware data flow. The interactive visualization was added to make the system readable even without the physical prototype present.

VIII. What This Project Demonstrates

This project demonstrates practical embedded engineering skills: using an 8-bit microcontroller under real hardware constraints, writing firmware around state machines and periodic tasks, debugging physical peripherals, and presenting the final system in a way that communicates both technical depth and product clarity. It is a strong resume project because it shows hardware control, firmware design, and system-level integration in one complete build.