Automatic Chess -- Subsystems

Mobirise Website Builder
Mechanical
Website Design

Mobirise is an easy website builder. Just drop site elements to your page, add content and style it to look the way you like.

Mobirise Website Builder
Software
HTML/CSS Coding

You don't have to code to create your own site. Select one of available themes in the Mobirise Site Maker.

Mobirise Website Builder
Electrical
Creating Your Brand

Select the theme that suits you. Each theme in the Mobirise Website Software contains a set of unique blocks.

Mechanical

The two goals for the mechanical subsystem was to find a way to move the pieces across the board, and build an external structure to house the components.

Mobirise Website Builder

FULL ASSEMBLY OF OUR HARDWARE SYSTEM. ITS MAIN COMPONENTS ARE TWO: THE BOX AND THE GANTRY.

Gantry Design

The first goal was done using an electromagnet moved by a two-axis gantry system, in turn controlled by two NEMA 17 stepper motors. We designed and 3D printed all mounts for the steppers, rods, electromagnets and bearings, allowing us to achieve very precise fits and iterate quickly between versions of the parts. The stepper motors themselves were connected to m8 “fast threaded” rods by couplings.This is what will move the electromagnet mount when the stepper motors are active. Two unthreaded rods were added to provide stability to the system.

Mobirise Website Builder

THIS IS THE FULL ASSEMBLY OF THE TWO-AXIS GANTRY SYSTEM.

Mobirise Website Builder

THIS IS USED TO HOLD THE BALL BEARING THAT ALLOWS ONE OF THE TWO RODS (Y-AXIS) TO SPIN WITHOUT RESISTANCE. THIS WAS DESIGNED SO THAT THE CENTER OF THE ROD WAS 25MM FROM THE GROUND, ALLOWING THE PIECES TO MOVE FREELY.

Mobirise Website Builder

THIS IS USED TO HOLD THE ELECTROMAGNET THAT MAKES THE PIECE MOVE ACROSS THE BOARD. IT IS STABILISED BY TWO RODS: ONE THREADED, CONNECTED TO THE MOUNT VIA A SPECIAL NUT THAT ALLOWS IT TO MOVE, AND ONE UNTHREADED, CONNECTED TO THE MOUNT VIA A LINEAR BEARING.

Mobirise Website Builder

THIS MOUNT GOES ON THE UNTHREADED SIDE OF THE Y-AXIS. IT HOUSES A STEPPER MOTOR AND AN UNTHREADED ROD, AND MOVES ALONG ITS AXIS THROUGH TWO LINEAR BEARINGS.

Mobirise Website Builder

THIS MOUNT GOES ON THE OPPOSITE SIDE OF THE Y-AXIS OF THE STEPPER MOUNT. IT HOUSES A BALL BEARING TO MAKE THE X-AXIS THREADED ROD MOVE FREELY AND A NUT TO CONNECT IT TO THE Y-AXIS THREADED ROD.

Mobirise Website Builder

THIS IS A SIMPLE MOUNT TO HOUSE THE Y-AXIS UNTHREADED ROD. THIS WAS DESIGNED SO THAT THE CENTER OF THE ROD WAS 25MM FROM THE GROUND, ALLOWING THE PIECES TO MOVE FREELY.

On a final note,we decided to make the playing field 20x20”. This is the standard size used in American tournaments and would allow our pieces enough space to pass in between squares without disturbing other pieces that may reside in those squares

Software

The code for controlling and tracking the flow of a game as well as directing the steppers and electromagnet is held in Python. The two Arduinos are responsible for implementing the commands sent from Python through Serial ports. One Arduino is responsible for motors and the other for the hall effect sensors.

The class that controls the game and keeps track of the player’s and AI’s moves is the Board class from the documented Python Chess Library. This library does the heavy lifting in terms of checking for invalid moves, wins, checkmates, etc. The Chess Drive Class translates chess moves (i.e. move x squares) to commands for the motors (move x steps) and calls the Motor Class to send those commands to the Serial Class which handles communication between our python programs and our Arduinos. The Digital Output Class controls the electromagnet, also using Serial to send information to the Arduino.

The sensor matrix switching is handled by the Arduino and transmitted to Python through the Serial Class. When Python then asks for an output from one of those sensors, the Arduino will automatically switch through all 64 states and print out the values as a Matrix, which Python reads and interprets.

We Implemented a MoveSensor class to handle translating the sensor inputs into moves. It stores the previous state of the hall effects and compares that to the current. When it does not see a magnet where there used to be one, we know a piece has been picked up. When it does see a magnet where there used to not be one, we know a piece has been set down. The MoveSensor class will keep track of the previous pick up. When a piece has been set down after that, it knows where the piece moved from and where it landed. To do captures, the MoveSensor keeps track of the last two piece pickups. If it detects two pickups before a put down, and the user puts down a piece on the most recent pick up square, it assumes a capture has been made. En passant and castling have not been handled, but could be with more time and a similar strategy to that as above.


The chess engine we used to be the AI chess player was the Stockfish 14.1 chess engine. Through the Pychess library and the UCI (Universal chess interface), the chess engine receives the moves of the player and responds accordingly. Then the engine’s move is translated to physical changes.

All links to external sources used can be found in Resources

Logic Diagram

Electrical

Mobirise Website Builder

Image Description

Chess Matrix

The 8x8 Hall Effect Sensor Matrix used two CD4051BE multiplexer/decoders to read the digital values of the A3144 Hall effect sensors. This was done by iterating through each of the rows of the matrix using the CD4051BE decoder feeding its output to transistors to only low one of the rows at a time to ground. This activated the hall effect sensors for that row and allowed only those sensors to control the column connected hall effect sensor outputs. The sensor output columns were then read using the CD4051BE multiplexer to iterate through each of the columns and read one sensor at a time. Below is a 2x2 Hall Effect Sensor Matrix illustrating how the multipliers and decoders selected which sensors to read.

Mobirise Website Builder

Image Description

Electromagnet

The electromagnet was controlled using a 2N3904 NPN switching transistor and was powered through a separate power supply at 12v. Below is the schematics for the electromagnet being switched off and on by a transistor.

Mobirise Website Builder

Image Description

Bump Sensor

The two Nema 17 Stepper motors were connected to A4988 Hybrid Stepper Motor Drivers on a Arduino CNC shield V3.0 mounted on an Arduino Uno R3. The stepper motors were powered from a 12v power supply.To allow the gantry to reset itself and return to a known position, two Hall Effect sensors were installed along the two axes along with magnets mounted to different assemblies for Hall Effect sensors to detect. The outputs Hall effect Sensors were read by the Arduino Uno R3. Below is an image of the schematics for the Hall effect sensors used to detect magnets mounted to the gantry system.

Mobirise Website Builder
Mobirise Website Builder

Carlo Colizzi 2024 - Olin College of Engineering

Landing Page Software