Building A Self-Playing Chess Board Robot

As popular as the game of chess is, it has one massive flaw. This being that it requires two participants, which can be a challenge. Although playing chess on a computer against an AI has been a thing for many decades, it’s hard to beat physical chess boards that give you all the tactile pleasure of handling and moving pieces, yet merging the two is tricky. You can either tell the player to also move the opponent’s pieces, or use a mechanism to do so yourself, which [Joshua Stanley] recently demonstrated in a video.

There are a few ways that you can go about having the computer move and detect the pieces. Here [Joshua] chose to use Hall magnetic sensors to detect the magnets that are embedded in the 3D printed chess pieces as well as their absence. These sensors are mounted to the back side of a PCB which is also the playing field, thus using the silkscreen for the board markings.

For the electromagnet that moves the chess pieces core x/y kinematics were used to move it underneath the PCB, engaging when moving pieces but otherwise deactivated. This is all controlled by an ESP32 MCU, while the computer runs the open-source Stockfish chess engine. As the human player changes piece positions this is detected by the magnet’s presence, with the change input into Stockfish.

As the demonstration at the end of the video shows, it definitely works, yet some issues remain. Ignoring the mistake with making the near-right corners black instead of white, the pieces are large enough that e.g. moving a knight piece between others pushes them to the side, requiring these to be put back in place.

There is also no way for the computer to detect which piece is placed where, which can be incredibly helpful on some commercial self-playing chess boards like this for new players, as well as to detect invalid moves, but this might be on the list for a potential V2 of this build.

Best part of this build is probably the use of a PCB for the playing field, which would allow you to go pretty crazy with custom designs and colors, especially now that some PCB places are offering multi-color silkscreens that allow for custom graphics.

12 thoughts on “Building A Self-Playing Chess Board Robot

  1. I think a robot arm would be the ideal way to accomplish this, it can take your pieces and not disturb any others while moving. Plus you have an opponent to look at, which can look back if you glue googly eyes to it.

    1. Apart from the mechanical fact that they’re less likely to topple if they’re wider on the bottom, they just don’t look right if you slim them down. Especially the bishop and pawns become harder to differentiate. The ratio between the diameter of the base and the width of the squares is one of the most consistent things between different chess sets.

  2. when i first read this, i had the thought that you could move the pieces back in place once they’ve been pushed out of the way. But that seems hard because it’s hard to know exactly how much they moved. After some time to meditate on it, i think the answer is to move the pieces out of the way first, move the knight, and then re-place the pieces.

    1. Agreed, I had the same idea while watching the video! Move the pieces out of the way then out them back. Would be nice if it was possible to do this simultaneously while you move the main piece, but that would require multiple electromagnets moving independently without clashing and gets very complex.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.