The board works like any other xy table, with a few key differences. First, the x axis has an extra servo attached to it, which raises and lowers a magnet. The magnet is attracted to pieces on the chess board above, allowing them to move. Second, embedded in the board are 64 magnetically activated reed switches, allowing the arduino to know the location of each piece.
What I love about this project is its adaptability. If you decide you're done with it as a chess board, it can instantly convert into a CNC mill by modifying a few pieces. I'll talk more about this possibility at the end.
All in all, though I learned a lot from this project and had fun building it, the board was not as successful as I had hoped. The magnets were way too powerful, so extra pieces would almost always drawn in when they shouldn't have. However, with a few thoughtful changes I think this could have been a better, more functional project. Until I build another, better board, though, I think this Instructable still serves as a pretty good guide to make your own chess robot.
Step 1: Parts and Materials
- 1 Arduino Uno or Diecimila
- 1 Arduino Mega
- 1 Mux Shield
- Motor Shield
- 1 Large chess board with pieces
- 64 NO Reed Switches
- 16 10K 1/4 Watt Resistors
- Roughly 90 feet of 30AWG Wire
This is the hookup wire for all of our sensors. Radioshack ≈ $16
- Neodymium Magnets to fit your pieces
- 1 Large Neodymium Magnet
- 2 Pairs of 24" Drawer Bearings
- 2 Stepper Motors
- 2 Vex Rack and Gear Sets
- 1 Standard Hobby Servo
- 1 2' x 2' Perf Board
- 1 2' x 2' x 1/2" MDF Board
- Various lengths of scrap 1"x2" wood
- 5 Minute Epoxy
- 1 Wood Saw
Step 2: Design and Code Explanation
You can see in the images below that each stepper motor can move freely about its axis thanks to the drawer bearings. On the Y Axis, each rail is connected with the wooden structure, so that the X Axis may sit atop it. Also on the X Axis is the servo that raises and lowers the powerful magnet, so that it may position itself before moving pieces.
Feel free to download the sketchup file and mess around if you're not sure of anything.
Another interesting element of this design is how to code talks with the arduino and motors. We need to address each square as a set of coordinates so that we may find slope and distance, however the traditional method of labeling squares A1, A2, etc. doesn't work particularly well in code. Standard (x,y) coordinates are much friendlier. Those coordinates, however, need to be in the form of a single number. What I ended up doing is assigning each square to a number, as you can see in image #3. Those numbers don't really work as coordinates on an 8x8 chess board, however, because we use a base 10 number system.
To solve that issue, we take the base 10 number of each square and convert it to base 8 using the modulus operator in C. 27, for example, is 33 in base 8, with the first digit being the x coordinate and the second the y. If you count over three squares and up three squares, voila! You end up on square 27. This converted coordinate system ends up looking like image #4.
Step 3: Mounting the Drawer Bearings (Y Axis)
The only reason I've made this its own step is that aligning the bearings perfectly is key. Should you fail to do this, and they both point slightly outwards, they'll stop at some arbitrary point and refuse to move once you connect them. Save yourself a lot of trouble and use something you know is square as a reference for alignment. The corner of a book is perfect.
Step 4: Building the Motor Mount (Y Axis)
Once you've cut the hole, slice the circle in half to get two mounts. This chipped the tips of my semicircle, so I used some 220 grit sandpaper to clean up the edge.
My steppers came with mounting screw holes, which line up well with the wooden frame. I used the smallest screws I could find. Mine fit so well that it wasn't necessary, but you might consider adding a bit of epoxy to strengthen the bond.
Step 5: Installing the Rack Gears (Y Axis)
Again, we use the epoxy to attach the gears onto the MDF. In addition to heavily applying epoxy to the board itself, make sure some is spread on the side of the drawer bearing, that way there is stability in two dimensions. Do your best to prevent epoxy from getting in places it shouldn't be -- you may gum up your motor.
It works out that the rack gears extend a little bit off of each end. This is a good thing -- it enables the gear to travel the full length of the board without running off. The stepper motor will be offset just enough that if the gears only covered the board's length the whole motor assembly would get stuck at one end.
Also install the circular gears onto your motor at this time. Mine had a set-screw, but you may wish to use some JB weld to hold your gear in place. If you go that route, the joint needs to fully cure before you try to use it, or you risk the gear popping off!
Step 6: Wiring and Mounting the Motor (Y Axis)
If your stepper motor has 5 wires, you're all set. If there are 6, however, it means you have to connect your center taps. Jason Babcock has a great tutorial on reverse-engineering your motors. In my case, however, the wires were the same color.
After extending the wires, the center taps go into the center of one of your motor hubs. The wires from one coil go to one terminal on the motor shield, and from the other coil to the other terminal. At this time we also hook up our 24v 1A power supply to the motor shield. If you get the polarity wrong on this, your motor shield is toast.
After trimming the motor mounting block to about 4 inches, it's time to attach it to our bearings. Mix up the epoxy, and liberally apply it to the area of the bearing the block will touch.
Also, if you have any pets, be sure to animal-proof the room you're working in. Cats seem to have an affinity for knocking over things that are drying.
Step 7: Mounting the Crossbars (X Axis)
Then we cut two 2' lengths of 1"x2" wood and mount them to the blocks with wood screws. Make sure these screws are in tight, or the bearings might not move at the same time. You might consider adding some wood-glue to lock them more tightly in place. While these cross bars need to be large enough to support our X Axis bearing, we want to use the least amount possible to avoid unnecessary weight. If the entire X assembly weighs too much, our Y Axis stepper motor won't have enough torque to move efficiently, or, if it's really heavy, at all.
Test that your bearings move evenly with each other. The crossbars should be as close to perpendicular with the bearings as possible.
Step 8: Mounting the Drawer Bearing and Rack Gears (X Axis)
This time, however, we have some options for mounting the rack gears. We can choose which side to mount them on. This is going to vary depending on how your motors are placed on their blocks. Once you've decided where to place them, though, they are glued in exactly the same way as on the Y Axis. Extend the rack gears slightly off of each end to make sure we have full travel on our steppers.
Again, make sure to try and keep any glue out of the sliding mechanism. If you do allow some glue to enter the mechanism, all is not lost. Fortunately for us, drawer bearings come in pairs, so we'll have one left over anyway. Mount it to the same screw holes and you're set! Just don't do it again! :)
Step 9: Attaching the Magnet to the Servo (X Axis)
If you're concerned about the torque of your servo, you might consider adding a counterweight to make lifting the magnet less difficult.
At this time you should also extend the leads on your servo motor. Do this the same way you did for your stepper, going one wire at a time and covering it with heat-shrink tubing or electrical tape.
Epoxy bonds best when there is a significant weight holding the two bonding surfaces together. Keep in mind that while 5 minute epoxy dries in 5 minutes, it may not cure for several hours.
Step 10: Wiring and Mounting the Motor (X Axis)
Using a piece of wire or cotton swab, carefully apply epoxy to the block where you've decided to attach your servo. If you aren't careful, some epoxy may end up on your stepper motor, rendering it useless. It's a real pain to clear mixed epoxy out of motors, so it's worth the extra time it will take. Firmly hold your servo in place for several seconds, and leave it clamped to dry.
Once your servo is mounted, we can attach the motor block to our bearings. Being cautious as to not get glue in the sliding mechanism and, like earlier, apply the epoxy to the exposed metal the block will touch.
After that is dry, wire the motor like you did before, extending each lead. This time, however, we'll connect it to the other motor terminal. Congratulations, the XY Table is done!
Step 11: Wiring the Sensors
Pull up resistors make sure we don't get false readings from our sensors. 48 of the 64 switches won't need pull up resistors, because the multiplexer has them built in. Unfortunately, we still have to solder 64 sensors. To make this go a lot faster, tin your wires before you try to solder them to the switches. Basically, just add solder to the wire alone before soldering with it. Label each switch with tape as it is completed to avoid a wiring nightmare later!
Hook up each switch to the Arduino as you go along. The multiplexer has a built in ground next to each input, which is really convenient.
To wire the pullup resistors to the built in pins, connect one resistor end to 5V and one to the pin you're using. Then, skipping the resistor, connect one end of your switch to ground and the other directly to your pin.
Find a comfortable chair, because this is going to take a while!
Step 12: Place the Magnets
Other than that, though, this only takes a few minutes.
Step 13: Code, Final Assembly + Reflection
The final assembly for this project is fairly simple. Find something to hold up your sensor grid, and lay that down. Next, place your chess board and pieces on top. You're done! Run the software and give it a whirl.
If you ever get bored of chess, it's really easy to make this into a CNC project. Replace that magnet with an X-Acto knife, flip the entire assembly upside down, and you have a stencil cutter! Replace that X-Acto knife with a pencil and you have a draw-bot. Modify the servo to activate a dremel and you have a CNC machine! The possibilities are, please excuse the cliché, endless!
In retrospect, there are changes I would make to this project if I revisit it. The magnets were waaaaaay too powerful, and would always pieces in that they shouldn't have. When all the pieces snap together, this would render a game unplayable. The mounting of the gears should be greatly improved; a few times the gears would pop off due to the heating of the stepper motors. Proper mounting with screws would fix this. Second, the board gets (fairly severely) out of calibration after a few moves, presumably due to skipped steps, and must be manually moved back to the origin to avoid misalignment. Some potentiometers allowing the board to know its absolute position would fix this. The rails, despite my best efforts, were misaligned, making the last couple rows of squares impossible for the stepper motors, causing them to skip steps and click loudly (bigger steppers would be better). Sometimes the motors would stop altogether and wouldn't be able to make it in those rear squares. Aligning the rails better would fix this. Often what would happen was that when the large magnet flipped over, a whole bunch of pieces would get drawn towards it (and it's a real pain to place all the magnets back inside the pieces if you haven't attached them). Ceramic magnets like the ones people stick to whiteboards might work better. Finally, the code could definitely be streamlined further; I completed this project when I was very new to C and Arduino.
Thoughts on the Epilog Challenge
It's kind of a funny feeling when as a maker you have something that can, well, build other things. An epilog laser would help me in some way with literally everything I make. With this laser I would, on a regular basis, cut solder stencils for surface mount work, make more elegant housings for my projects, and engrave logos onto personal laptops and cell phones. As a student, it would provide me with a small extra source of income from engraving the gadgets of others. Rapid prototyping circuit boards would allow me to take my work to the next level, rather than having to spend several hours etching a PCB just to find out one trace is routed incorrectly. This laser, combined with help from the awesome community here on Instructables, would help me so much in my pursuit of a career in engineering, my ultimate goal.
I'll leave it up to the merit of my Instructable, though, to decide whether I deserve this laser, not the list of sappy thing's I'd do with it. :D Instructables and Epilog have done something great here, and the projects created by this fantastic contest will set a standard of quality for years to come.
I hope you've enjoyed reading about this project as much as I enjoyed making it. Make sure to leave a comment if this has inspired you to build anything, I'd love to see what you've made!