The MagPi - July 2018

(Steven Felgate) #1

raspberrypi.org/magpi July 2018 33


GHOST CHESS Projects


>STEP-01
Enter the move
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.

>STEP-02
Calculating positions
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.

>STEP-03
Performing the action
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.

TIME TO


MAKE A MOVE


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.”

Moving pieces
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.”

There was a lot of difficulty


integrating all of the different


parts of the system


Sensors are
positioned below
each of the 64
squares. They detect
which squares are
occupied and feed
the information back
to the software
Free download pdf