Autonomous Chess Playing Robot
Team Members 1. Amit Saharan 2. Gaurav Raj 3. Riya Gupta 4. Saumya Jaiswal 5. Shilpi Agrawal 6. Varun Gupta Mentors 1. Mukund Tibrewal 2. Hardik Soni 3. Zaid Tasneem
Abstract Our project Autonomous Chess Playing Robot [ACPR] aims at building a robot that will play against human in physical environment. Our project can be majorly divided into three subparts: Programming, Mechanical and Electronic Circuit design. Programming was implemented through Minimax search algorithm along with alpha-beta pruning. Mechanical part contains the 3-axis movement consisting of rack and pinion mechanism along with a gripper based on four bar linkage mechanism. And Electronics part comprised of designing and printing PCB and involved the use of LDR sensors [for detecting chess piece movement] and 8:1 multiplexor majorly.
Motivation The idea behind making a chess playing robot originally stemmed from our desire to make the game of chess more interesting and difficult. We looked at a few similar projects done previously to get an idea of what all it would involve. Initially, we decided to work with reed switches and magnets for moving our chess pieces. But that was found to be pretty complicated. Instead, the combination of a gripper mechanism and LDR switches to determine the position of each chess piece was found to be a good idea. So we decided to go with the same. Here are the links to some of the chess-playing bots we looked up before deciding to build our own: 1. http://www.instructables.com/id/how-to-build-an- Arduino-Powered-Chess-Playing- Robo/?ALLSTEPS 2. https://www.youtube.com/watch?v=4og3qconsa Q 3. https://www.youtube.com/watch?v=s22ruxnjyn Y
Our Work The work we did can primarily be divided into three parts, as mentioned in the abstract: 1. Mechanical work 2. Electrical Circuiting and PCB 3. Coding in C++ and working with Arduino
Mechanical Work
Design A 12 X 12 wooden chessboard lies on a wooden platform, flanked on each side by a vertical slider, rack and pinion. This mechanism on both sides together support a metal frame on top that carries the gripper and the horizontal slider. We used 3 stepper motors to facilitate motion along all the axes. The pieces are picked up using a mechanical gripper that travels up and down with the help of yet another rack-and-pinion set.
We first created the basic 3-D design of our mechanical model virtually using Autodesk Inventor. Have a look: This gave us an idea of what exactly we had to do and the measurements of the parts that were to constitute our bot. All the mechanical parts were cut and finished in the well-equipped 4-i and tinkering labs of the Institute.
1.Gripper This is the gripper we used to pick up the chess pieces: We were confused as to the mechanism to be used for moving the gripper. Finally, we chose a rack-and-pinion mechanism over the more expensive and complicated pneumatic cylinders. The gripping mechanism is a 4- bar linkage mechanism. The use of stepper motors was of great advantage to us as we required moving the gripper by exactly one square of the chess board at a time. This also called for exact dimensioning and meticulous calculations.
This is the Autodesk design of the gripper: It basically consists of a frame on which two gears and a stepper motor are mounted. Each gear has two metallic parts attached to it that actually grip the object. The motor is driven according to the instructions it receives from the C-terminal during the game. 2. Rack-and-pinion sets Four rack-and-pinion sets, each measuring 14 in length, have been used to achieve motion along the three axes. 3. Sliders
Four sliders were used, one each with every rack and pinion set to facilitate the movement of motors on them. They too measured 14 in length. Working There are two rack and pinion sets fixed to the wooden base, one on each side of the chessboard. Attached to each is a stepper motor mounted on a slider that moves along the Y-axis. The whole arrangement, on both sides of the chessboard, supports a metallic frame that carries yet another such arrangement that moves along the X- axis, and also carries another rack-and-pinion, slider and the gripper, all of which are constrained to move along the vertically downward direction. The gripper itself has a stepper motor attached to it that facilitates the opening and closing motion of its jaws. The chessboard is a 12 X 12 one, which means every square is 1.5 X 1.5 in dimension and has a circular hole at its centre. The gripper is made to move along the X and Y axes till it is hovering above the square from which it has to pick up a chess piece, slide down, pick up the chess piece, slide up, go to the destination square again by moving along X and Y, again slide down and then release the chess piece.
Electrical Circuiting and PCB
1.PCB A printed circuit board (PCB) mechanically supports and electrically connects electronic components using conductive tracks, pads and other features etched from copper sheets laminated onto a non-conductive substrate. This is the basic design of our PCB created using Altium Designer:
Our PCB has 64 LDRs and colour-coded resistors, one Arduino Mega 2560 ADK, two capacitors, one fuse, one diode, 9 multiplexers soldered to it. a) LDRs: Under each square of the chessboard is an LDRresistor combination. A light-dependent resistor (LDR) is a light-controlled variable resistor, whose resistance decreases with increasing incident light intensity. Which means, it gives different outputs, depending on whether it is placed under an open hole or there is a chess piece placed on top of the square, covering the hole and thus cutting off light reaching the LDR.
b) Mux: A multiplexer (or mux) is a device that selects one of several analog or digital input signals and forwards the selected input into a single line. The eight squares in a row give their respective outputs to the mux heading that row. The eight muxes heading each row, in turn, give their outputs to a single mux (mux 9). The muxes we used were all 16-pin ones with IC-SN74LS151N. For instance, to access square 4.5, you'll set the data selectors of mux-9 aptly to access 4th row and then set up data selectors of mux 5 to access 5th column.
Electric Circuit Diagram Output from LDR (eg S1.3) Mux in that row (eg mux- 1) Mux-9 Arduino Terminal Output from LDR (eg S1.3) Mux in that row (eg mux- 1) Mux-9 Arduino SN74LS151N c) Fuse + diode + capacitor circuit: It is a preventive circuit. Pin connections: Outputs of Row 1: Output of Pin# [of respective multiplexer] S1.1 4 [I 0 ] S1.2 3[I 1 ] S1.2 2[I 2 ] S1.4 1[I 3 ]
S1.5 15[I 4 ] S1.6 14[I 5 ] S1.7 13[I 6 ] S1.8 12[I 7 ] Similarly, the output of each row is defined. Output of 8 muxes to mux9 Mux# Pin# [of mux9] 1 12[I 7 ] 2 13[I 6 ] 3 14[I 5 ] 4 15[I 4 ] 5 1[I 3 ] 6 2[I 2 ] 7 3[I 1 ] 8 4 [I 0 ] Output of mux9 goes to arduino. Data Selector and Arduino connections Mux # Pin# of respective Pin of arduino mux Mux1 11[S 0 ] 51 10[S 1 ] 49 9[S 2 ] 47 Mux2 11[S 0 ] 45 10[S 1 ] 43 9[S 2 ] 41 Mux3 11[S 0 ] 39 10[S 1 ] 37 9[S 2 ] 35 Mux4 11[S 0 ] 33 10[S 1 ] 32
9[S 2 ] 31 Mux5 11[S 0 ] 28 10[S 1 ] 30 9[S 2 ] 32 Mux6 11[S 0 ] 34 10[S 1 ] 36 9[S 2 ] 38 Mux7 11[S 0 ] 40 10[S 1 ] 42 9[S 2 ] 44 Mux8 11[S 0 ] 46 10[S 1 ] 48 9[S 2 ] 50 Mux9 11[S 0 ] 27 10[S 1 ] 25 9[S 2 ] 23 Main output of complete chess board [i.e., mux9#5] is connected to A 0 of Arduino Mega. 2. Arduino Mega 2560 ADK The Arduino MEGA ADK is a microcontroller board based on the ATmega2560. It has 54 digital input/output pins (of which 15 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button.
3. Motors and Motor drivers The motors used in the bot are - 3 stepper motors (nema23), one high torque dc motor, and one plastic shaft dc motor. A stepper motor is a brushless DC electric motor that divides a full rotation into a number of equal steps. The stepper motor converts a train of input pulses (typically square wave pulses) into a precisely defined increment in the shaft position. Each pulse moves the shaft through a fixed angle.
Coding in C++ and working with Arduino
1. The code for the game The main code for the game was written in C++ and majorly followed the minimax algorithm with alpha-beta pruning, to provide artificial intelligence. You can have a look at the code here (https://drive.google.com/?authuser=0&urp=https://drive.goog le.com/?authuser%3d0#folders/0b_jgixxspcaly29rbgliu HFTaHM) or on our wiki (http://students.iitk.ac.in/projects/wiki/doku.php?id=2014robo :akash_deep_amit_saharan_ravindra_kumar_bangrawa_riya_ gupta_saumya_jaiswal_varun_gupta). Mini-max is a decision rule used in decision theory, game theory, statistics and philosophy for minimizing the possible loss for a worst case (maximum loss) scenario. Alternatively, it can be thought of as maximizing the minimum gain. Alpha beta pruning is a search algorithm that seeks to decrease the number of nodes that are evaluated by the minimax algorithm in its search tree. When applied to a standard minimax tree, it returns the same move as minimax would, but prunes away branches that cannot possibly influence the final decision. 2. Coding with ArduinoMega The output from pin no. 5 of mux-9 goes to the Arduino, which in turn, moves all the motors with the help of motor drivers that are connected to its pins. The codes for running all the motors, gripper, horizontal motion, vertical motion etc.
can all be referred to at https://drive.google.com/?authuser=0&urp=https://drive.googl e.com/?authuser%3d0#folders/0b_jgixxspcaly29rbgliuh FTaHM.