Introduction: Chess Robot
--This project was my graduation project at Kuwait University-College of Engineering & Petroleum--
Chess is a very famous and common game worldwide. The main purpose of the design is to develop a stand-alone chess robot using an intelligent system to provide more entertainment with low cost as much as possible for home use.
The system is designed such that:
· No external hardware or software is needed.
· The user interface is simple
· Low power, can run on batteries (6 v) or AC adapter (220-240 v)
Step 1: Basic Idea and Needed Components
The overall system has three major parts: the hardware circuits, the chess board, and the robotic arm.
The first element to design is the chess board. The chess board has 64 blocks (positions) where the check pieces (checkers) move on. In order for the system to determine their movement, there is a sensor underneath each block to sense whether a piece has moved or not. Then sensors will send the result to a controller and the controller will determine how the robot should move.
The robot is designed such that it can reach all the 64 blocks. The game starts with the player’s move, and then the sensors are be affected by that move. Finally, the controller will determine the player movement and tells the robot where to move.
we will need:
1-servo motors (for the robotic arm, basically 6)
2-reed sensors (64)
6-100 ohm resistors
7-1k ohm resistors
8-2.2k ohm resistors
10-3.3v voltage regulator
Step 2: Connecting the Reed Sensors
The first thing to design is the chess board. For an appropriate size, the board size is set to be 40 by 40 Cm, with 2 by 2 Cm for each square.
Under each square, there is a magnetic sensor called “Reed Switch”.
These switches are sensitive to magnetic fields. Whenever a magnetic field is sensed, the switch will turn on, otherwise it will be off. Operation of reed sensor is shown in fig (5). Inside the switch there are two pieces of metal. When a magnet approaches, the two leads will touch each other (attracted) which will cause a “closed circuit”, otherwise it is an “open circuit”.
Now, each checker has a small magnet beneath it that will affect the sensors. By moving the checkers around the sensors will be opened and closed accordingly.
Next, the circuit that will handle the 64 sensors is designed. As it described before, each sensor will cause either an open or closed circuit. Before connecting them to the microcontroller, some standards are set. In order for the microcontroller to determine whether the sensor is open or closed, the output of each sensor must be either 1 (high) or 0 (low). A circuit that accomplishes this task is needed. Without setting these standards, the sensors states will be “float” when they are open, and NOT zero. What is needed is to add a couple of resistors on each sensor, that will make sure that the output of the sensor is either 1 (high) or 0 (low).
Step 3: Connecting the Sensors to the Microcontroller
Now that the sensors are adjusted to 0 or 1, they can be connected to the main controller. However, microcontrollers in general can’t handle this huge amount of sensors (64). So, a decoding circuit is required. A multiplexer is used to do the decoding. A multiplexer (MUX) is a chip that acts as switch, where it connects multiple outputs to a single input and switches between them.
In the design, 4-multiplexers with 16 channels each (that is a total of 64) are used. Then a single output in addition to the “select” pins will be connected to the controller, occupying a total of 9 I/O pins
The decoding circuit takes the 64 input from the sensing circuit and decodes them to 9 outputs, which will be fed to next part of the design, the main controller.
Step 4: The Propeller Microcontroller
The controller specifications are very critical. The circuit of the controller includes the following:
· Fast microcontroller with 32-I/O, capable of handling the heavy artificial intelligence algorithms.
· Capability to drive high power servo motors.
· Capability to do video generation
By following the previous specifications, the microcontroller is chosen to be the “PROPELLER” microcontroller. The propeller is 32-bit multi-core system, running at 80 MHz. capable of video generation and parallel processing. It is powerful enough to run the whole system.
P0 to P8 are used for the multiplexers, P9 to P15 are used for controlling the servo motors
Step 5: The Circuit Designs and PCB's
Attached are the circuit designs (schematics+PCB) for the entire system.
Step 6: The Robotic Arm
I is not nessesary to design the arm by your self. You can buy it ready made if you want. There are many robotics arm that you can purchase from RobotShop or Trossen Robotics. The most important thing is that the size of the robot and the chess board are appropriately chosen.
After the design of the robot is completed and built, a control system is needed to move the robot to the correct position. The robotic arm control is an open loop, which means that there is no feedback from the arm to the microcontroller. However, the servo motor itself is a closed loop system; so, its stability can be ensured.
The control system is done using the Master-Slave method. The microcontroller will send commands to the robotic arm servo motors, and they will move accordingly.
Since servo motors receive digital signals with pulse durations, it is easier to use the durations instead of angles. All the positions (64) are found practically using a servo controller with special computer software that enables the control for each servo. Since the robotic arm is 4-DOF, 4-values are needed for each position, each value is for a single servo
For a smother movement, each block on the chess board has two robotic arm configurations: Position #1 and Position #2. A movement using these two positions is done in 4 steps:
1) The microcontroller tells the robotic arm to move to the specified block, at a HIGH vertical altitude (Position #1)
2) The microcontroller tells the robotic arm to move to the specified block, at a LOW vertical altitude (Position #2)
3) Pick up the checker
4) Return to Position #1 of the same block
5) To move the checker to another block, go to step 1.
Those positions are found practically after fixing the robot with the chess board.
Step 7: Software
One of the advantages of the system is that it is a stand-alone
system; no external software or hardware is required (no need to connect it to a computer). Therefore, the software that will be running the whole system is very essential, and runs at the heart of the system. Many aspects regarding the capabilities of the software are considered:
1. Determining the player’s movements.
2. Checking whether the player movement was legal, and notifying him if it was illegal.
3. Finding a suitable movement for the robotic arm.
The first step is to determine which piece the player is moving, and what is the destination. This is done using an algorithm that reads all the positions (using the sensors) before and after the player moves the piece. The algorithm will compare the data before and after the movement and looks for the positions that were changed. Once the algorithm finds the positions, it can set a movement as a ‘source’ to ‘destination’, which will then go to the next step: certification of the movement.
When the movement is checked, there can be one of two outputs:
· Turn on yellow LED’s if the movement was illegal
· Flash yellow-green-red LED’s if the movement was legal
If the player movement was illegal, the system will not proceed until the player corrects his/her movement. Once the movement is corrected (and checked again by the system) the system will proceed to the next step: finding a suitable movement for the robot.
Design of chess algorithms can be very challenging. Here I will attach the code used. It is a modified version of a chess algorithm developed for the Propeller microcontroller.