checkMate is a pair of remotely automated companion chess sets that allows users to play chess on a physical board against an opponent anywhere in the world. Each piece has an embedded magnet, which triggers a Hall Effect sensor under each of the board’s squares. By detecting each magnet, the board is able to calculate each player’s move. This move is then mirrored on the opponent’s chessboard through the use of a two-axis CNC electromagnet. Through checkMate, we can provide the convenience of online gaming while maintaining the novelty of traditional chess play. This was my senior design project for the Mechanical Engineering department at UC Berkeley.
Reilly Marin | Ian Shain | Ben Tearle | Eric Tu | Jega Vigneshwaran
To move the chess pieces, we constructed a two-axis CNC controlled electromagnet under the chess board. This electromagnet would grab the magnetic chess pieces from underneath the board and drag them to new squares. Construction of the CNC was kept simple and low cost, with PVC angle stock and stainless steel shafts making up most of the material. Easy to machine and lightweight PVC sections allowed our design to remain relatively modular for addressing any necessary adjustments during calibration. We used linear bearings to help each platform travel along its axis of movement with ease, while timing belts ensured consistent and reliable distance control.
To track the movement of our pieces throughout the game, an array of 64 hall effect sensors, one per square, was setup directly beneath the game board. By embedding magnets into the base of every chess piece, we could then sense whether or not a particular square was empty or occupied. An Arduino Mega, fitted with a Mayhew Labs Mux Shield to accommodate the large number of inputs, was used to read all Hall effect signals and analyze what move was made by the player. This information could then be directly sent to the companion board to replicate the move. A separate “Taken” area on the board with its own Hall effect sensor is used for the player to indicate he/she is cutting an opponent’s piece by simply placing the taken piece in the area.
We wanted our product to have a very clean look and feel and so we housed all the electronics and the CNC in an enclosure beneath the chess board. From the outside, only the board, pieces, command panel, and power & computer cables were visible. In order to achieve the desired range of motion for the electromagnet to move to all the squares, the CNC footprint had to be larger than the chess board footprint. We enlarged the footprint of our chess board by cutting a decorative frame out of carved wood panels. We stained these panels and the exterior walls a deep espresso color to provide a nice contrast to the board.
We used a laser cutter to make the chess board to provide custom-sized squares that fit our sizing requirements. It also provided a sharp design by maintaining the wood grain. Below is a time lapse of the board being laser cut.
We constructed a control panel with a number of logical inputs to create seamless gameplay. We placed the board’s power button on this panel as well as “new game”, “turn complete”, and “check” buttons. To checkmate a player, the user simply holds down the “check” button.
Moving the Chess Pieces
We bought two sets of wooden chess pieces that were aesthetic and appropriately sized to use as our pieces. We put every piece on the lathe and cut out a cavity where we embedded magnets. We tested a handful of magnet sizes and strengths to find the optimal type.
We found that we were running into two problems with the chess pieces. The first was having too much friction between the pieces and the board so that the electromagnet could not consistently grab and drag the pieces. The second was not having enough friction between the pieces and the board, which resulted in pieces repelling other pieces on the board when they moved, or snapping together. To compensate for this, we weighed down the pawns (the lightest pieces) using clay in order to provide more friction with the board while sanding the remaining pieces in order to allow for better movement.
We designed our square size and piece diameters such that the pieces could freely slide in between other pieces along the chess board lines. This is how we moved the knights on the board. We also programmed our boards to account for various types of moves, such as square and diagonal moves.
Cutting a Piece
To cut a piece, we placed an additional Hall effect sensor in the graveyard of each board. When a player wanted to take their opponent’s piece, they would move their opponent’s piece onto the graveyard sensor, triggering the Arduino to read the board. Then the player would move their piece to the vacant square, and would complete their turn. By this logic, the Arduino would know what piece to move to the graveyard and what piece to move to the taken piece’s square.
Communication works in 3 stages:
- Arduino/Android to Computer
- Computer sends to Computer
- Computer sends to Receiving Arduino
Arduino/Android to Computer
Relevant Files: final_slave_android.py, final_slave_arduino.py, Android code, Arduino code
In this stage, a player either makes a move on the Android Application, or physically makes a move on the chessboard. The computer reads in both these moves and writes these moves to a text file (log.txt). The moves are sent in string format like so:
(e.g. A2B201 means send piece from A2 to B2, no piece is taken, opponent is now in check)
To read from the Android Application, the computer opens a Python socket and the Android App connects to it via a Java socket by specifying the IP address of the computer. Upon receiving a move, the computer writes the move received into the log file.
To read from the Arduino running on the board, the computer uses PySerial to read on the Arduino’s Serial port. Whenever the Arduino outputs a move, the computer reads the move with a python file and writes the move received into a log file.
The log file was chosen so that the communication between boards is modular and can easily accommodate other communication protocols such as an iOS app, or a computer chess program.
Computer to Computer
Relevant Files: final_master_client.py, final_master_slave.py
When a computer receives a move, it sends the move over the internet to the other computer using a python socket. To initialize the connection, one computer specifies the IP address of the other.
Computer to Receiving Arduino
Relevant Files: final_master_client.py, final_master_slave.py, Arduino code
The computer sends a move to the Arduino using a PySerial connection. The Arduino code listens on the Serial port for the move from the computer.
All code for communication, Arduino, and Android can be found at the following Github Repository: https://github.com/erictu/checkmate
We built a mobile app that can communicate with the network as well to remotely control both chessboards. This way, a user could make a move while on the go and that move would be cast on their own chessboard and their opponent’s.