This is my 2nd chess playing robot. Unlike the first one, this one works. You can play against it or against another human.
What was wrong with V1?
For starters V1 was a very low budget robot with regular motors and some encoders. It had an over complicated sensor array on the chess board to read the player's move. I never got this sensor array to work even with a lot of help from others. So the first thing I knew I did not want on this robot was sensors on the board. The second thing wrong with the V1 was its cheap motors. I tried to use these motors in sync with the encoders. It actually was some what decent, but at sometimes it was glitchy and inaccurate. So guess what, in V2 I scratched the encoders and I scratched using normal motors. When making V2 I salvaged the PSU and Arduino Mega from V1 to reuse.
How did this new design fix those problems?
The keypads on the new chess robot are used for moving pieces in two player mode and one player mode. I decided to have the robot move both players’ pieces. Not only is this cool, but it allows the robot to keep track of the pieces in one player mode so essentially by moving your piece, you are also letting the robot know where you are putting it. Well how does it know what piece it is? The pieces at the beginning of a chess game are always set up the same. So in the robot's code there are multiple arrays that store where the pieces start off at. When you make a move, the robot converts that move into a pointer for the array and then finds what piece lies on that spot. It then can move that piece in the arrays based off of where you move your piece. It does the same for its own pieces. It has a different array for each kind of piece (i.e. black rook array, white bishop array, black king array, etc.)
When it came to fixing the inaccuracies of the first version of the chess robot, I started to think about other ways of movement. The first that came to my mind was a CNC machine. CNC machines use stepper motors and a lead screw to move its multiple axis around. I kept the gantry crane design of V1 and used it on my new chess robot. This setup is much like a CNC machine, but instead of using a lead screw (I could not find any cheap lead screws), I decided to use a rack and pinion. This was purely because of price. I was able to find a cheap plastic rack and pinion, it was not easy though, it took me hours of searching google. I was able to find them in the UK. Shipping to the states was not all that bad either so I bought 8ft of the stuff.
With the original problems fixed, I had to figure out how to fix new ones.
The gantry has to have something to slide on. In my V1 design, the gantry crane was mounted to common drawer slides. I did not want this for V1. So what was I going to use? After multiple trips to the hardware store and multiple returns, I did not have anything that was going to work. So again I went back to Google. Well I found these things called linear bearings, but they too were very expensive - about $20 a piece. I would need at least 4. $80 for slides! That is ridiculous! Well after talking to an online friend of mine one night, he said he knew where to get cheap ones that would fit my budget. That’s when I was given this distributor. I was able to get those linear bearings that I needed for around $5.
What about the actual chess board?
I did not have a good chess board laying around the house. I wanted one that would be as nice as the robot I had planned. The chess board needed to be larger than any one I had ever owned. It needed to be large so that the gripper did not need to have incredibly small fingers to pick up the pieces without knocking over the chess piece next to it. The chess board also needed to have the chess notation on it. The keypad has buttons that correspond to the chess notation on the side of the chess board. I wanted anyone to be able to read the chess notation on the board and simply push the button that had the corresponding letter or number for the piece they wanted to move. I choose to go with this chess board and these chess pieces.
Parts List:
This is the first picture of it that was taken. Of course all the pieces you see below were cut out of the plywood board, then glued and nailed. You are seeing it after 1 coat of stain and 2 coats of lacquer. I used this stain that was suppose to be a one step process. It had stain and lacquer in it. But that just ended up making some spots really bad, and it was not even glossy like I wanted. So it ended up with some bad spots, and I had to go over it with real lacquer. If I did this again, I would not buy all in one stain and lacquer. In the picture you will notice doors without the handles yet. There are 4 doors so I can easily access the inside to put all the electronics inside and fix anything if I have to. At this stage it looks like it might become a coffee table.
I put a picture of the first stage of the chess robot V2 above, but the real first thing that I ordered where stepper motors. There is a little story of how this robot actually gained funds to start. I entered my maze robot into the local science and engineering fair, and would you believe I won an engineering award and $75. Not too long later, I am told that my plane made out of old computer parts won a $100 award in the recycled art show. I had $175 in my pocket so I did what any kid would do - I bought some stepper motors. After I acquired these, there was no turning back, I was going to make chess robot V2.
Next in my mailbox came the LCDs. I found these cheap ones on eBay and they had a funky orange back light so I bought them. I hooked them up and had the "hello, world!" code running in no time on my one of my Arduinos.
The chess board and pieces were next to come. Here you can see the chess board on the top of the robot. The robot's size was actually made around the chess board. Once I picked this board out, I just added a few inches on each side so I had room for the gantry's rail system. At the bottom of the picture is the beginning of a keypad. It’s just the angled piece that the keypad will be screwed on to. As you can see it is not mounted yet at this stage.
Later the keypad bases get mounted on with some brackets from the hardware store. Pieces to hold up the 3/8" rods are cut and drilled. You can see them mounted on the four corners of the robot. They are just angled for aesthetics. Also in this picture are the racks. They are lying on top of strips of wood that were cut to length. Later they will be glued and then mounted, but right now they are not.
The last parts to arrive were the buttons for the keypad. I did not know they were so small when I ordered them. I ordered 40 of these buttons from eBay for like $4, but after a month they had not arrived. I emailed the seller asking them why they had not arrived yet and their reply was something along the lines of "OMG really? I will send more right away." Well eventually I got them. The keypad was cut out of thinner plywood. I had to mark where all the buttons went and the LCD so the holes could be drilled.
Finally it was time to start the gantry. It was cut out of the same wood as everything else. The verticals of the gantry were cut tall enough to leave room for holes to be drilled for the 1/4" rods that the top axis would slide on. You can now see the first images of the gripper. The gripper was donated by an online friend.
Here is one of the finished keypads. Remember there are two keypads - one on each side. I went down to the craft store and bought stickers to put next to the buttons that correspond with the notation on the keypads. This is player-one's keypad, the only difference between this one and player-two's keypad is that this one has a switch in the top right for choosing between one and two player mode.
The wires for the keypad go inside the robot through a hole drilled behind the keypad. There are a group of wires for the row of buttons, for the column of buttons, and for the LCD. The two keypads' buttons will be wired in parallel. So each keypad has the ability to control the robot and this cuts down on the number of needed inputs. I made a simple board where one keypad plugs into one side and the other plugs into the other side. The connectors are wired together and out of the board comes one bundle of cables and then the cables are plugged into the Arduino as inputs. There are no pull-up resistors. I just used the Arduino's internal ones.
I went back to testing the rest of the stepper motors.
Finally that rack I talked about earlier is now glued onto the strip of wood and is mounted to the robot with some more brackets from the hardware store.
The stepper motors on each side were mounted with a strap going over them which was screwed onto two pieces of wood that sandwiched the motor.
Now this is a big leap in progress below. The top axis is on. Basically the top is a block of wood with four linear bearings on it. I probably could have just used two linear bearings on top and it would have worked just as well. There are two motors on top - one for moving the axis back and forth and one for lowering the gripper. The gripper is raised and lowered with a string (this was another idea taken from my first chess robot) on a spool. I used 40yr old braided fishing string. The gripper is guided by two 1/4" rods and it slides on them with two 1/4" linear bearings. Also I made my own cable carrier because they were expensive to buy. I found this site where many different CNC builders explain how to make your own. I used some plastic channel I found at the hardware store for $1 and tape to make mine. Below is a picture of myself soldering connectors onto the end of the motor wires so that they can plug into my motor driver board.
My motor driver board was just a board from radio shack that I used to solder connectors and distribute power to all the boards. I wanted the motor drivers I bought to be removable so if one went bad I could easily replace it. So I used female headers and male headers to make plugs. I also put 3 blue LEDs on the board to make the inside light up.
Here is the Arduino Mega and to the side of it is a little board that adjusts the contrast of the LCDs. It kind of looks like a mess but all the wires are labeled so it is well managed.