← HTMAA

Week 03 · September 23 · Embedded programming

Embedded programming

Assignment

I assembled a QPAD-XIAO board around a Seeed XIAO RP2040, then programmed it in Arduino so the OLED, NeoPixels, and capacitive pads all talked to each other. I later ran a gridworld on the same board with a policy trained off-device.

Soldering

I started by assembling the board. The soldering iron at the REEF at Harvard was not good. I also could not use the EE lab, because I have never taken an electrical engineering class at Harvard. I went to MIT instead. The microscope there was very helpful, and the iron was very good.

REEF soldering bench at Harvard with helping hands holding a blue board
The REEF bench at Harvard.
Microscope view of two 10k surface-mount resistors soldered at R4 and R5
MIT microscope view of the 10k resistors at R4 and R5.

Program

After the board was together, I flashed Adafruit NeoPixel code to the XIAO RP2040 to confirm the LEDs worked. I then used Claude to write the OLED display code with Adafruit GFX and SSD1306. Last, I wired the capacitive pads to those functions so I could test the plumbing: a pad press should change the light mode, and the screen should show what the board is doing.

I did the work in the Arduino IDE. I compiled the sketch there and flashed it over a USB-C to USB-C cable.

The sketch runs three modes, Solid, Breathe, and Rainbow, and talks to the computer over USB as a UF2 device.

Assembled QPAD-XIAO board plugged into a laptop running Arduino code for the RP2040
The assembled QPAD-XIAO after flashing, with the OLED and NeoPixels on.

Doom

I also flashed Doom onto the RP2040. The OLED showed the title screen, but this was a standard porting job, so I stopped there.

QPAD-XIAO board running Doom on the OLED, held in front of a Harvard 2029 banner
Doom running on the QPAD-XIAO OLED.

Gridworld

CS1840 overlap: 16×8 OLED MDP. Q0 new map, Q1 auto/manual, Q2–Q5 nudge.

One path was tabular Q-learning on a local observation (neighborhood + goal heading), exported as a lookup table. It was not generalisable: 3% success on held-out maps. The agent got stuck in 1-cell squeezes and kept walking sideways into walls.

QPAD-XIAO running the Q-learning gridworld on the OLED
Q-learning on the board. 3% success, not generalisable.

I switched to a tiny net on the full wall grid, trained off-device by imitating BFS, then flashed the weights.