Week 02
Embedded Programming
.jpg)
TLDR
I programmed a Seeed Studio XIAO RP2040 on the Quentin Board (QPad) to read capacitive touch pads and drive a 128×64 OLED, then used it to recreate the classic Nokia game Space Impact. The project covered capacitive sensing, GPIO input, display rendering, and real-time game logic.
Hardware
Board and Microcontroller
The Quentin Board serves as the controller body, bringing the touch pads, OLED connection, and GPIO routing together in a compact layout. The XIAO RP2040 sits at its center and handles touch sensing, input processing, and game control.
The XIAO RP2040 has 11 digital GPIO pins (D0–D10). Pins D0, D1, D7, D8, D9, and D10 read the six touch buttons, D4 (SDA) and D5 (SCL) drive the OLED over I²C, and the 3.3V, 5V, and GND pins supply power.
Soldering Parts
I placed the XIAO and the other components on the board and soldered each joint one by one, taking care not to bridge the small, closely spaced pads. I then checked every connection before powering the board.
Testing the Touch Pads
I tested each pad individually while monitoring the response, then tuned the touch threshold until every pad triggered reliably without false touches.
Software
Testing the OLED
I tested the display step by step. First, a simple text output confirmed that the OLED and the microcontroller were communicating.
Next, basic geometric shapes checked that graphics rendered cleanly.
Finally, a moving ball tested real-time position updates and motion control in an Arduino sketch.
Exploration
Space Impact
For the exploration, I recreated Space Impact, the side-scrolling shooter preinstalled on classic Nokia phones in the early 2000s. The player steers a spaceship with the touch pads and shoots at a boss monster that moves independently across the screen.
To get the graphics onto the OLED, I converted the PNG sprites into bitmap arrays with image2cpp so the Arduino code could draw them directly.
Animating the Spaceship
I animated the spaceship first, mapping the touch pads to movement and shooting.
Animating the Monster
I drew the boss in a pixel-art editor at low resolution so it stays readable on the 128×64 display, then turned the pixel pattern into an array for the Arduino code.
Final Result
In the full game, I added smaller enemies alongside the boss, each with its own movement and attack pattern. Projectiles, collision detection, and game states connect everything, so the game runs from the title screen through gameplay to game over and restart. I used Codex to help integrate all of these components into a single game.
The full game code.
Reflection
The biggest challenge was drawing on the OLED: its tiny pixel grid meant I had to redraw and simplify every sprite instead of reusing the original images. Hardware debugging was the other lesson, because the OLED did not work at first until I found and re-soldered several loose pins.