With this game of chess by Tim Ness, Alex Angelov, and Alex Smith, the pieces appear to move by themselves. David Crookes checks it out
On 10 February 1996, a chess-playing computer called Deep Blue sent shock waves around the globe by beating world champion Garry Kasparov in the first of their six games. But the IBM machine did so without moving any physical pieces itself – a human noted the computer’s move and performed it manually on the board. Had Ghost Chess been around back then, however, such intervention would have been redundant.
Designed by final-year MEng students Tim Ness, Alex Angelov, and Alex Smith from the University of Glasgow, Ghost Chess makes use of a robotic arm connected to a Raspberry Pi running the world champion chess program, Stockfish (stockfishchess.org). It focuses attention on a physical board, using motors and an electromagnet to pick up, move, and place 3D-printed chess pieces within the squares depending on the moves dictated by both human and computer.
As such, it’s a mini-marvel – a prime example of a real-time embedded system. “We wanted to create something that was fun, memorable, and slightly more challenging – an ‘automatic’ 3D chess game from scratch,” says Tim. What’s more, they wanted to make it as unobtrusive as possible. “We kept the robotics underneath the board because it was an easier way of designing the system,” Tim adds. “It keeps all of the electronics and the moving mechanism out of the way.”
Indeed, the project is broken down into five layers: the chess pieces, the board, a matrix of sensors, the mechanical arm, and, at the bottom, the Raspberry Pi 3. Of those, the arm was the trickiest part to develop. “Creating a design without having access to expensive ball races/bearings was a real challenge,” Tim recalls.
T-slot bars bolted to a plywood base act as runners for two shuttles and these are hooked up to timing belts mounted through a couple of pulleys to a stepper motor, allowing the arm to move left, right, up, and down. Meanwhile, a matrix of 64 latching Hall effect sensors (one for each square and capable of varying the output voltage in response to a magnetic field) lets the setup detect which spaces on the board are occupied.
From that point on, it’s up to the software running on the Pi to work its magic. For this, the students coded their own program to work with the Stockfish API. It not only allows humans to enter their moves through a graphical user interface or via a command line, it also empowers the computer to decide where it needs to go.
“The RPi is a versatile platform for development which provides competitive input and output capabilities, compared to other devices,” says Tim. “We used Raspbian as the platform for development, which allowed us to create a GUI fairly easily and helped a lot with the development and debugging process.”
Once a move is decided, the software instructs the arm to make its way to a piece. It then turns on the electromagnet positioned on top of the arm, which attracts a button magnet fitted to the bottom of each piece. At this stage, the robotic arm can start to perform the move. Seeing physical pieces move across the board is far more satisfying than simply playing on a computer.
“There was a lot of difficulty integrating all of the different parts of the system and calibrating them in order to work as expected,” says Tim. “We think the trickiest part was trying to work on a tight budget and design solutions for different parts of the system, without breaking the bank, and we hope the idea will be passed on and upgraded during the coming years.”
Human players can make a move using Ghost Chess’s graphical user interface via an attached screen. The control software uses a fixed reference point as the origin of the board: the a1 square.
The co-ordinates of the piece to be moved are given and the distance to travel to reach that square is calculated. The arm is moved with stepper motors, so distances are calculated as steps.
The arm moves into position and the electromagnet is activated, attracting the piece. The distance to the new square is calculated. Once the move is made, the electromagnet deactivates and the arm returns to a1.