[KongchangAI]
· 1 min read· 985 words

ESP32-S3 Open-Source Micromouse Firmware Deep Dive: From Perfboard to AAMC Third Place

ESP32-S3 Open-Source Micromouse Firmware Deep Dive: From Perfboard to AAMC Third Place

AAMC 2026 third-place Micromouse team open-sources their ESP32-S3 perfboard build and full firmware.

A team competing in UCLA's All American Micromouse Competition (AAMC 2026) took third place and open-sourced their complete technical solution. They abandoned custom PCBs and the standard STM32 in favor of an ESP32-S3 on hand-soldered perfboard, enabling 15-minute hardware iterations. Their stack includes flood-fill BFS path planning, a 200Hz bare-metal PID loop, trapezoidal velocity profiling for cell-merging on straights, and NVS Flash maze caching for a fast-run sprint strategy. The ESP32-S3's hardware PCNT peripheral handles quadrature encoder decoding without CPU overhead. A 0.96-inch OLED proved critical during the 5-minute competition prep window.

Micromouse — the classic and hardcore sport of building a tiny autonomous robot to explore and sprint through a 16×16 maze as fast as possible — sits at the intersection of embedded systems, robotics, and competitive engineering. Recently, a team that competed in the All American Micromouse Competition (AAMC 2026), hosted by UCLA IEEE, shared their complete technical solution on Reddit after taking third place. They open-sourced everything: firmware, schematics, and build logs.

What makes their story particularly compelling is that they broke convention — ditching the industry-standard STM32 in favor of an ESP32-S3, and ultimately competing with a hand-soldered perfboard build.

Reddit original post

From Clean PCB to Perfboard: A Pragmatic Choice for Rapid Iteration

The team started with a clean, custom PCB as their V1. But in practice, they quickly ran into a painful engineering reality: every time they encountered power-rail noise or needed to nudge a sensor's position, they faced a full week-long PCB re-spin cycle.

For a time-pressured competition project, that iteration speed is fatal. So the team made a bold call — scrap the polished PCB entirely and switch to raw perfboard with point-to-point soldering, even using a mechanical keyboard blue-switch clicker for mode selection.

They openly admitted that V2 looked like a "rat's nest." But it was precisely that flexibility — being able to desolder and reposition an IR emitter in 15 minutes — that got them to the competition floor. This decision is a vivid illustration of a core engineering principle: during prototyping, iterability beats aesthetics. The ability to fail fast and correct course quickly often matters more than theoretical perfection.

Why ESP32-S3 Instead of STM32?

In competitive Micromouse, nearly every serious team runs STM32. This team went the other direction, choosing ESP32-S3 with PlatformIO. The reasoning was clear-eyed.

Hardware Pulse Counter for Encoder Decoding

The team made full use of the ESP32-S3's hardware capabilities. They used the ESP32's hardware Pulse Counter (PCNT) peripheral to implement quadrature encoder decoding, offloading the work entirely from the CPU and preventing interrupt storms. This is a textbook example of "use hardware to unburden software."

NVS Flash Caching for Sprint Runs

Even smarter: they cached the maze wall data discovered during the exploration phase into ESP32's NVS (Non-Volatile Storage) Flash. This means that during the final fast run, the mouse can skip sensor-based wall detection entirely and drive full-speed based on the stored map. This "explore → memorize → sprint" strategy is a key differentiator in high-scoring Micromouse runs.

Motion Control and Core Algorithms

A mouse's performance ultimately comes down to the precision of its motion control and the intelligence of its path planning. The team put serious work into both.

Flood-Fill Algorithm and 200Hz PID Control Loop

Path planning uses a classic 16×16 flood-fill BFS solver — the standard Micromouse approach — to compute the shortest path from start to finish.

For the control loop, the team implemented a 200Hz PID cycle. Notably, the loop timing is driven entirely by micros() — no RTOS tasks, no delay() calls anywhere in the control path. This "bare metal" approach to timing, while primitive, guarantees determinism and real-time responsiveness by eliminating OS scheduling jitter.

Trapezoidal Velocity Profiling: Blasting Through Straights

The most impressive algorithmic work is their trapezoidal velocity profiling. A naive implementation would decelerate the mouse at every 180mm cell boundary, dragging down overall speed. Their approach merges consecutive straight-line cells into a unified acceleration corridor, letting the mouse accelerate continuously through long straights rather than braking at every cell boundary. This optimization is critical for fast-run performance.

IR Sensor Fusion and Gyroscope Yaw Hold

The sensing system uses four pairs of IR emitters/receivers (SFH4545 + TEFT4300) with lookup-table-based distance calibration, combined with an MPU-6500 gyroscope for yaw-hold. The quality of sensor fusion directly determines whether the mouse can stay stable at high speed.

The Scaling Challenge: From a 6×3 Home Grid to the 16×16 Competition Maze

The team shared a very honest lesson learned: they tested at home using a roughly $10 Home Depot whiteboard and 3D-printed walls, assembled into a compact 6×3 test grid. When it came time to scale up to the official 16×16 UCLA maze (256 cells), the challenges multiplied fast.

The core issue is error accumulation — millimeter-scale inaccuracies that are invisible on a small grid compound rapidly over long straights. A solution that performs flawlessly on a small test grid can cause wall collisions or disorientation in a full-size maze due to accumulated drift. This is a reminder for all hardware developers: there's often an unpredictable gap between small-scale validation and real-world deployment. Scaling itself is an engineering challenge.

The MVP of Competition Day: A 0.96-Inch OLED Display

The team specifically highlighted that the real "most valuable player" on competition day was the 0.96-inch OLED display. With only a 5-minute prep window at the event, being able to read battery voltage, IR sensor values, and the flood-fill map directly on the robot — without opening a laptop — made all the difference.

This detail seems minor but represents genuinely valuable competition hardware wisdom: building intuitive on-device diagnostics into your system can be decisive in high-pressure moments.

Open-Source Repository and Engineering Takeaways

The team has open-sourced everything — firmware, schematics, and build logs — in their GitHub repository (neuromouse26), and posted full competition run videos on YouTube. For anyone looking to get into Micromouse or embedded real-time control, this is an exceptionally practical reference.

From this project, a few broadly applicable engineering lessons emerge:

  • Iterability sometimes beats polish — perfboard is ugly, but it's flexible
  • Dig deep into your chip's hardware peripherals — ESP32-S3's PCNT and NVS delivered unexpected performance gains
  • On-device observability is invaluable — a tiny OLED screen is worth far more than expected under competition pressure

These lessons extend well beyond Micromouse and apply to embedded systems and robotics development broadly.

#Micromouse#ESP32-S3#flood fill algorithm#PID control#trapezoidal velocity profiling#AAMC 2026#open source robotics#embedded systems
Share:

Related articles