Masterpiece

The Automatic chessboard

View Full Project Site

Skills Advanced: Arduino, Raspberry Pi, Python, Git, Stockfish, G-code, GRBL, A* Pathfinding

Objective: Program the logic and control methods for a physical Human vs. Computer chessboard. Select the appropriate electronic components to control a Core-XY gantry system for moving chess pieces.

In this project, a multi-disciplinary team of 4 other engineering students and I aimed to build an automated chessboard using a gantry system to move chess pieces using magnets embedded in each piece. We were excited to present a fully functional board capable of playing real-time inferred computer vs. computer and human vs. computer chess games.

To automate a chess game, a Raspberry Pi runs a chess engine, while an Arduino reads the sensors and drives the motors. The two microcontrollers use serial communication to pass commands and status checks. A Stockfish chess engine plans moves each turn based on the current board state, and has selectable skill levels. The software has fully custom A* path planning and G-code generation for all moves, including captures, promotions, castling, and en passant.

The 8x8 representation is constantly updated by the Python Chess library, and is then mapped into the correct spaces in the other grids. The important consideration for tracking the 10x12 and 19x23 representations is that pieces can simply disappear from the digital game when captured or promoted, so the custom order-of-operations planning and tracking are essential for every move since physical pieces can’t simply disappear from the board. For captures, the captured piece is moved to the next available capture space, followed by the capturing piece moving to its old square. For promotions, the pawn moves to the node next to the desired promotion piece, the promotion piece is moved to the appropriate end square, and the pawn is moved one final node over to the promotion piece’s original space. These algorithms ensure smooth operation that allows the board to make hundreds of moves and many games without any collisions or misplacing a single piece.

View Full Project Site

You can check out more about this project, some real-time footage, and the mechanical aspects using the button below!

I took a break from the mechanical roles and chose to spearhead the software and gantry electronics for the project to improve my Python and electronics selection/circuit design skills.

To execute the game correctly, the board has 3 internally tracked representations: An 8x8, a 10x12, and a 19x23 grid. The 8x8 board tracks the standard digital game with Python Chess, ensuring that it can be correctly parsed by both the library itself and the Stockfish chess engine. The 10x12 represents the physical board layout, accounting for additional capture and promotion spaces. Finally, the 19x23 grid represents a “node” representation of the board used for movement path planning between the squares on the board. This representation ensures that there is always a possible move path for a piece – even if every physical square around the piece is occupied, it can move along the edges of the square. For a given node, there are 8 possible nodes that a piece could move to around it.

Previous
Previous

CVT Guarding

Next
Next

CRoG