Ratatron is my micromouse: a small robot that has to find its way to the centre of an unknown maze, work out the fastest route and then run it as fast as it can. I started it at the end of 2016, and since then I’ve worked on it on and off, with long breaks in between. This year I finally picked it up again, rewrote the firmware from scratch hand in hand with Opus 5.5, and took it to OSHWDem 2026.

Ratatron

This photo is from its first competition, at OSHWDem 2017. Since then it has come back to OSHWDem several times.

The hardware is the same one I designed in 2017: a 3D printed chassis and a custom PCB with an STM32F103C8T6, two N20 motors with encoders and four Sharp IR sensors. There’s no gyro, so the heading comes only from the encoders and the walls.

Firmware

The new firmware does the full micromouse cycle. In the search it explores the maze with a weighted floodfill (a cost per cell and per turn, so it looks for the fastest route, not the shortest) until that route is verified. In the speed run it drives it in one continuous move: straights up to 900 mm/s and smooth curves at up to ~480 mm/s.

Opus at the wheel

The new firmware was written hand in hand with Opus 5.5: 233 commits in barely two weeks, ~7,500 lines of firmware, ~3,200 of tests and ~4,100 of Python tools. The repo has an AGENTS.md with the rules and a docs/ISSUES.md that works as memory between sessions: each session takes one issue and leaves it closed or with the next step written down. The strategy and control code is plain C without HAL, so it runs exactly the same on the PC, against a simulator and thousands of checks, including the 520 classic 16x16 competition mazes from micromouseonline/mazefiles.

Then I handed it the robot. Over Bluetooth, every move, test and parameter is a console command, and the robot sends text telemetry that a Python tool turns into a live map of the maze. Everything is plain text, which is exactly what an AI can read:

So Opus drove the robot by itself: it launched calibration tests, analysed the recordings (encoders, PWM and raw IR every few milliseconds) with a Python script, adjusted the constants and ran searches and speed runs. It’s safe, because the robot is inside a closed 4x3 maze at home and it can’t escape. The only thing Opus asked me, from time to time, was to charge the battery or to change the layout of the maze.

I set the goals and tuned a few things myself with my human eyes; the core of the algorithm is Opus’s work.

OSHWDem 2026

Ratatron took second place in the maze category at OSHWDem 2026! The trophy is a PCB shaped like a maze with a 7-segment display showing the position (easily hackable to show whatever position I want).

Ratatron with the OSHWDem 2026 second place trophy

The second place was thanks to the search, which was perfect. The speed run was another story: the robot crashed into a wall and, after a power cycle, it had no map at all. Here is the video of the DISASTER:

Back home, Opus found why the map was lost: a hard hit or a sudden motor reversal can cause a voltage spike in the motors, which leaves the HSI (the internal oscillator that times the flash writes) running ~8000 times slower, so the save never landed. It built a virtual-robot firmware and a stress test to reproduce it on demand, and fixed it.

It’s still far from a professional micromouse (no gyro, no suction fan, analog IR sensors), but it’s in the best shape it has ever been. Next stop: a new chassis, a Ratatron II with all the improvements I’ve missed in this one.

As always, everything is open source:

License

Software: GPLv3

Categories:

Updated:

Comments