Automatic chess game

Hello,
I’m currently trying to make a chess game where the user plays against a computer. I am playing on a 3mm thick board (290*290mm) and 15mm of diameter chess pieces.
How does it work ? I placed a matrix of 8 by 8 reed switches to scan the position of each piece on the board. I got this part done. But I’d like my pieces to move automatically: under each piece I would put a magnet and under the board (and the reed switches) I would put a system with an electromagnet.
This system would basically be 3 rails: 2 for the y-axis and 1 (that would be on the 2 others) for the x-axis. On those rails, I would put a carriage that would be moved by a step-by-step motor.
My problem is that I have no idea of which motor take neither of which pulley choose.
As you can read, I did not buy any of these components for the moment, I’m looking for advice on the components I should buy and on the feasibility of this project.
PS: I would plug my computer to an arduino Mega and, via the serial port, an algorithm p’ my PC would communicate to the arduino were to move the pieces.
Here are the main components I already found:
The rails + carriage: Machifit MGN12H 250/300/500 / 550mm Guidage sur Rail Linéaire Guide Bloc de Guidage CNC Outil Sale - Banggood Mobile
Chess board:
https://toutpourlejeu.com/fr/jeu-echecs-et-jeux-dames/3535-jeu-d-echec-29-cm-plateau-32-pieces-bois-pas-cher-3431220095007.html?gclid=Cj0KCQjwrpLoBRD_ARIsAJd0BIWnx9vHF9UcLm8NjPggkUCwW0Qii40z-lRaBy_9EsM6q9Zl3eWBtrAaAspNEALw_wcB
Reed sensors:
https://www.amazon.fr/SODIAL-commutateur-capteur-interrupteur-miniature/dp/B01M2UXQWB/ref=mp_s_a_1_4?keywords=reed+switch&qid=1560604935&s=gateway&sr=8-4
Sorry for the french websites I hope I gave you enough information to help me.
Thank you for your help !

[EDIT]:
Here are the pieces I chose (I am not going to take the ones coming with the board):

How would you make a knight move? It can jump over other pieces.

And how do remove a captured piece from the board?

There would seem to be plenty of room to move pieces past each other on the same square - squares being 36x36mm while pieces are 15m diameter.

So you would need a system to guide pieces past each other while perhaps staying towards one side of a square and the moving pieces staying on the other side. Then you just need to deal with the moving mechanism getting past the wiring for the reed switches.

Maybe having a robot arm pick up the pieces and move them would be less problematic in terms of movement, example:

CrossRoads:
And how do remove a captured piece from the board?

The board having edges, I would move the captured piece on the edges and I would manually remove it.

CrossRoads:
Maybe having a robot arm pick up the pieces and move them would be less problematic in terms of movement, example:

I do have enough space between the pieces to pass a moving piece such as a knight. A robotic arm is a good solution but I'd like to keep the magical aspect of this project.
Does anybody have an idea of which sbs motors chose and how to place pulley on them ?

PaulRB:
How would you make a knight move? It can jump over other pieces.

The squares have a dimension of about 32mm (counting the edges) and the pieces have a diameter of 15mm (I edited my initial post) so a moving knight can pass between 2 other pieces.

Wouldn't it be hard to maintain concentration for 2 moves ahead with motors buzzing and mechanical apparatus squealing and clunking under the table? :slight_smile:

I think you could have the reed switches and their wiring, acting as sensors for the pieces, sandwiched between the playing surface and a bottom plate; then the electromagnet that moves the pieces will have a clean surface to move under and not get caught up on wires and reed switches.

You could replace the pen drawing head on a drawing robot like this
https://www.amazon.com/Acrylic-Drawing-Plotter-Structure-Engraver/dp/B06WP9LTVX/ref=sr_1_14?keywords=drawing+robot&qid=1560634141&s=gateway&sr=8-14
with the electromagnet and use that to move the robot pieces.

I googled drawing robot to find this on Amazon. You could also assemble your own version of one, with the electromagnet raised above the levels of motors and frame.

I saw this one yesterday for a little more

https://usa.banggood.com/EleksMaker-EleksDraw-XY-Plotter-Pen-Drawing-Writing-Robot-Drawing-Machine-p-1125222.html?gmcCountry=US&currency=USD&createTmp=1&utm_source=googleshopping&utm_medium=cpc_bgcs&utm_content=garman&utm_campaign=pla-usg-brand-eleksmaker-pc&ad_id=350580579796&gclid=EAIaIQobChMI4p2du-Xn4gIVDhgMCh2jbgucEAYYAyABEgLzWPD_BwE&cur_warehouse=CN

and the "eleksmaker mana se" card that drives it looks an awful lot like a Nano
http://wiki.eleksmaker.com/doku.php?id=eleksmana_se
that could be reprogrammed to accept commands from whatever is playing as the computer to do things like
"go to this position"
"energize magnet"
"go to this position"
"release magnet",
maybe zigzagging along to move bishops, or the queen, or a pawn taking diagonally, or moving twice to remove a captured piece.

This site seems to have info that could be helpful also

https://www.banggood.com/2-Axis-Stepper-Motor-Driver-Board-Controller-Laser-board-For-DIY-Laser-Engraver-p-1015557.html?cur_warehouse=USA

Yep, looks like a 328P and a CH340, so basically a Nano.

CrossRoads:
I think you could have the reed switches and their wiring, acting as sensors for the pieces, sandwiched between the playing surface and a bottom plate; then the electromagnet that moves the pieces will have a clean surface to move under and not get caught up on wires and reed switches.

Great idea, will do !

CrossRoads:
You could replace the pen drawing head on a drawing robot like this
https://www.amazon.com/Acrylic-Drawing-Plotter-Structure-Engraver/dp/B06WP9LTVX/ref=sr_1_14?keywords=drawing+robot&qid=1560634141&s=gateway&sr=8-14
with the electromagnet and use that to move the robot pieces.

The price of this (and other) drawing robots goes beyond my budget for this project.

Here is how my system works precisely:
Under the matrix of reed switches, there would be 2 travelling bars with carriages on them (links are at the end of this post). These 2 travelling bars would be parallel (and would take care of the y-axis). On the carriages of these 2 bars, I would place a third travelling bar (that would take care of the x-axis). At the end of the first bar, I would put a step-by-step motor with a pulley on it. I would also put a pulley at the other end of the bar, I would then link these to pulleys with a belt and attach to the carriage the ends of the belt. Like this, I can move my carriage with the sbs motor. As said previously, the third bar is on the 2 other carriages, so 1 is controled by a sbs motor but the other one would be "free" (to avoid an offset between the position of the 2 carriages). The third bar would work like the first (with a sbs motor, pulleys and a belt) to move the carriage with the electromagnet on it. I would then energize or not the magnet to move the pieces.
I think this system is the cheaper I can get for what I want to do. I was thinking of a Mega to control my chess game because the matrix takes 16 pins to control it.
I have no idea of what:

  • step-by-step motor (that needs to be cheap but enough powerful to move my carriages and take less than 1.5 sec, at least, to pass a square)
  • pulley (that can go on the sbs motor)
  • belt
  • electromagnet (enough powerful to move a piece but not to much powerful to attract all the pieces of the board when energized)
    choose.
    I really appreciate the time you are giving, and the help you are providing. Do you have any suggestion on what pieces I should choose ? Or an other µcontroller ?
    Thank you !
    Links:
    Travelling bars : Machifit mgn12 100-1000mm linear rail guide with mgn12h linear sliding guide block cnc parts Sale - Banggood.com

Did you see this thread ?

ard_newbie:
Did you see this thread ?

Arduino Due Chess Robot - Exhibition / Gallery - Arduino Forum

Thanks, awesome project but it uses an arm, which is probably more effecient and practical than my magnet system, but I am before everything else trying to give my project a magical effect.

Look for 28BYJ-48 steppers they are small and have decent torque, but they aren't very fast. The plus side is the ULN2003 boards you can find them with are ready to go in 5 minutes. I'm working on a project with them now. Arduino's built in library works well with them, but there are full libraries for them too. CheapStepper is a decent one.

As far as concerns about moving pieces just move them off to one side of the board and for knights program it to move pieces in front of the square out until there is an open path and then move them back. If you want to do that fast I would look at beefier motors. You basically have to weigh size and cost against speed.

One last thing to consider is how you will zero or home everything. anytime you want to store the position of your magnet you'll need to know how many steps you've taken and where you are on the board. Any time you plug in the board your motors won't know where 0 is. You'll need endstop switches or a laser/photoresistor setup. Whenever you trip one of those you'd set a value to 0 so you can always use it as reference like a 3d printer.

You may want to buy most of your parts based of 3d printers because your essentially making one and replacing the extruder with a magnet.

So you have chess pieces with magnets and an electromagnet that will drag a piece 3mm above across the board and it's not going to affect other pieces?

Maybe before building the rest it'd be a good idea to perfect that? You'd only need to magnet a few pieces and can move the coil by hand, saving parts and code and many hours time.

C_Laughrey:
Look for 28BYJ-48 steppers they are small and have decent torque, but they aren’t very fast. The plus side is the ULN2003 boards you can find them with are ready to go in 5 minutes. I’m working on a project with them now. Arduino’s built in library works well with them, but there are full libraries for them too. CheapStepper is a decent one…

I finally choose Nema 17 as stepper motors, they are a bit more expensive but way more powerful. I will control them with A4988s.
If you wan’t more information about the pieces, I choose, take a look a this thread.
Thank you anyway !
PS:

C_Laughrey:
One last thing to consider is how you will zero or home everything. anytime you want to store the position of your magnet you’ll need to know how many steps you’ve taken and where you are on the board. Any time you plug in the board your motors won’t know where 0 is. You’ll need endstop switches or a laser/photoresistor setup. Whenever you trip one of those you’d set a value to 0 so you can always use it as reference like a 3d printer.

Thank you, I hadn’t thought about this.

GoForSmoke:
So you have chess pieces with magnets and an electromagnet that will drag a piece 3mm above across the board and it's not going to affect other pieces?

Maybe before building the rest it'd be a good idea to perfect that? You'd only need to magnet a few pieces and can move the coil by hand, saving parts and code and many hours time.

It will not affect the other pieces because their will be more than 3mm between the magnets of the pieces and the electromagnet (at least 6 mm). And I can always put my electromagnet further.
As for putting magnets only on a few pieces, it won't work because I have to record where each piece is at any moment. Maybe I didn't understand your point...

You don’t. Only a few to test how a field strong enough to drag 1 piece between others won’t affect the others.

It will not affect the other pieces because their will be more than 3mm between the magnets of the pieces and the electromagnet (at least 6 mm). And I can always put my electromagnet further.

Did you test your idea or are you prescient?
The farther below the board the coil is, the more powerful you have to make it and the bigger the field will be.

But tell ya what, it’s your time and money so build it up and deal with any problems afterwards. You might as well do the same with the code, write the whole and only then start debugging. Just don’t expect me to help, okay?

If only the robot moves the pieces then it can remember where it put everything without 64 reed switches.

Or put a reed switch on the moving head and make it scan the board after the human moves.