
A Pi for the brain, an Arduino for the muscles
The Raspberry Pi reads the board, keeps track of the game and asks a chess engine what to play. It sends short text commands over USB to an Arduino, which drives two stepper motors, a servo that lifts the magnet, and a small blue LCD that tells jokes while it waits.
64 switches, only 16 wires
Every piece has a small magnet in its base. Under each square sits a reed switch: two metal strips in glass that snap together when a magnet is near.
Wiring 64 switches one by one would need 64 wires. Instead the Pi powers one row at a time and listens on the 8 column wires, sweeping the board many times a second.
It only knows “full” or “empty”
The switches can't tell a knight from a pawn. The Pi knows the position before your move, so it only needs to see which squares changed and check the result with the python‑chess rules.
Captures are the tricky case: the target square is full before and after. So the board remembers the order squares went empty. The one lifted first was the piece you took.
Small models at home, Stockfish in the cloud
Once your move is known, the Pi writes the position as a short text (a FEN) and hands it to an engine.
Mini models run right on the Pi with no internet. They are deliberately weaker, with a lower rating, so a beginner can actually win. For a real fight, the Pi sends the position to the Stockfish API and plays whatever the full‑strength engine answers.
Two motors, five bars, one point
Both motors stay fixed on the base. To reach a square, each side forms a triangle (a 22 cm link, a 27 cm link, and the distance to the target), and the law of cosines gives each motor's angle.
That's inverse kinematics. Near the middle the linkage has an under‑constrained zone where it could fold either way, so the robot uses a quick jerk and lets momentum swing the arms through. Try “follow me”.
A window into the robot's head
A small debugger app on the Pi shows everything live: the switch grid, the buttons, every message to and from the Arduino, and how long each part of the main loop takes. Most bugs were timing, not chess.
The hard parts were physical: magnets strong enough to drag a piece but not its neighbours, switches that flicker when a piece sits off‑centre, and motors that slowly lose their place without homing.