2023 Chess Engine & Robotics

Automatic Chess Playing Robot

A robot that plays chess against you. AI pieces move themselves while sensors detect your moves.

The Challenge

Creating an autonomous chess-playing system presented several key challenges that required innovative solutions across multiple engineering disciplines. The primary goal was to develop a mechanism that could move chess pieces without human intervention while maintaining the authentic feel of playing chess.

The system needed to reliably detect player moves, integrate a chess AI with physical movement systems, and build a robust physical structure to house all components. Most importantly, it had to create a seamless user experience that preserved the tactile and visual aspects of real-life chess playing.

First Chess Robot Drawing

First Chess Robot Drawing

The Solution

We developed an integrated system featuring a two-axis gantry system with an electromagnet to move the AI's pieces, an 8×8 hall-effect sensor matrix to detect player moves, and integration with the Stockfish 14.1 chess engine via UCI. The solution includes custom 3D-printed components for precise fit and rapid iteration, along with a robust software architecture to coordinate all systems.

The mechanical subsystem was designed to move pieces across the board with precision and reliability. Two NEMA 17 stepper motors control an electromagnet through a two-axis gantry system, using M8 "fast threaded" rods connected to steppers via couplings for precise movement. The system features custom-designed and 3D-printed mounts for steppers, rods, electromagnets, and bearings, with unthreaded rods added for additional stability during movement. The 20"×20" playing field matches American tournament standard dimensions.

Gantry System Assembly

Two-Axis Gantry System Assembly

How It Works

The system architecture consists of three main components working together. Python controls game flow using the Python Chess Library, handling move validation and AI integration. The Chess Drive Class translates chess moves to motor commands, while the MoveSensor class interprets player actions from the hall-effect sensor data.

An 8×8 Hall Effect Sensor Matrix reads sensor values, while the electromagnet is controlled via a switching transistor. Two NEMA 17 Stepper motors control the gantry movement, enabling precise piece positioning across the entire board.

Chess System Logic

System Logic

Development Process

The project was developed over three main sprints, each building upon the previous work. Sprint 1 focused on concept development, initial testing with a DC motor and temporary electromagnet, and exploration of LED matrix technology to understand the basic requirements.

Sprint 2 involved the first draft of the box design, iteration on 3D-printed mounts, and transition from a 2×2 test matrix to PCB design for the full 8×8 sensor matrix. This phase was crucial for understanding the physical constraints and electrical requirements.

Sprint 3 encompassed the final assembly of the gantry system, completion of the hall effect sensor matrix, and integration of all subsystems. This sprint included significant troubleshooting of motor control issues and optimization of movement parameters to achieve reliable operation.

Hall Effect Matrix Schematic

Hall Effect Sensor Matrix Schematic

Key Subsystems

The mechanical system features a two-axis gantry with NEMA 17 stepper motors, custom 3D-printed mounts for all components, and an electromagnet mount with dual-rod stabilization. Linear bearings ensure smooth movement across axes, while ball bearings minimize rotational friction for precise positioning.

The detection system uses A3144 Hall effect sensors to detect magnets in chess pieces, with a CD4051BE multiplexer/decoder system for efficient sensor reading. The MoveSensor class interprets pickup and placement actions, with special handling for piece captures and moves, and position determination through matrix scanning.

The control system integrates the Python Chess Library for game state management, Stockfish 14.1 chess engine for AI decisions, and serial communication between Python and Arduino. A CNC shield with A4988 stepper drivers manages motor control, while transistor-controlled electromagnet activation enables piece movement.