Two small robots, a camera on the ceiling, and a game of cat and mouse you play from a web page.
A one-evening proof of concept: two Kitronik :MOVE mini buggies driven by BBC micro:bit V1.5 boards over Bluetooth Low Energy, a Raspberry Pi 4 that runs the whole show, and ArUco markers glued on the robots so an overhead camera knows where each one is and which way it faces. Visitors join a queue, get a robot, and drive it with the arrow keys; alone, you play against an AI.
Shared as is, for information. It is a POC, not a product. The story of the evening, with diagrams: Two micro:bit robots play cat and mouse, built in one evening.
The robots wear their marker as a flat roof (print/mounting.svg). The overhead camera only needs to see each marker whole; the side cameras are for the show and the slow-motion replays.
micro:bit (MakeCode firmware) ──BLE UART 20 Hz──┐
micro:bit (MakeCode firmware) ──────────────────┤
▼
overhead camera (USB or phone MJPEG) ──► Raspberry Pi 4 ──WebSocket + MJPEG──► browser
side cameras (MJPEG, on demand) ──────► FastAPI server (telemetry UI)
firmware/(MakeCode, TypeScript): BLE UART link, raw servo speeds, accelerometer and temperature telemetry, a 400 ms watchdog that stops the wheels. Unused BLE services are disabled: with them, a V1 micro:bit runs out of RAM (panic 020).server/microbrawl/robots.py: one BLE link per robot (bleak), reconnects by itself, maps (left, right) to calibrated servo speeds.server/microbrawl/vision.py: ArUco detection (OpenCV,DICT_4X4_50, ids 1 and 2), homography from four clicked corners of the table to centimetres, position, heading and speed of each robot.server/microbrawl/game.py: cat and mouse referee (tag distance, roles, rounds, robots driving back to their start spots), edge guard, pause when a robot is flipped, off the table, unseen or disconnected, and a simple chase / flee AI.server/microbrawl/replay.py: every camera keeps its last seconds in memory; each tag is replayed in slow motion.web/: SpaceX-style telemetry page, English and French.edgecam/: a tiny on-demand MJPEG streamer for an old laptop's webcam.print/: the markers (A4, print at 100 %) and how to mount them as a flat roof on each robot.
- Build the firmware with MakeCode (
cd firmware && mkc build), thenscripts/flash.shcopies it to each micro:bit plugged in over USB. - On the Pi: a Python venv with
fastapi uvicorn bleak opencv-contrib-python-headless numpy(tested with OpenCV 5.0, bleak 3.1), thenscripts/deploy.sh(setPI=user@hostin an untrackedlocal.env). - Optional settings in
~/microbrawl/microbrawl.envon the Pi:MICROBRAWL_SKY(camera index or MJPEG URL),MICROBRAWL_CAMS(extra views),MICROBRAWL_ADMIN_KEY. - Open
http://<pi>:8080/?admin, calibrate the table by clicking its four corners, switch the robots on.



