What components do I need for sensing the ID of chess pieces (Year 12 project)

BobTPH

Joined Jun 5, 2013
8,957
My solution in #24 and #26 is a lot simpler to implement than RFID even it could be made to work. I would use a micro on each board that could be queried with I2C, so only 2 I/O lines needed for the entire system.
 

panic mode

Joined Oct 10, 2011
2,747
RFID is simple and reliable but requires reader on each of 64 fields. you can also have each piece have own MCU and LED that when "asked" broadcasts own ID. this means each of 64 fields would only need to have an LED. perhaps an IR led. it would send pulse of light to initiate reading on own field, then used as a photodiode to receive coded message from piece (if one is present).
using pulse of IR light to trigger chess pieces means they do not need individual power switch, they could be in sleep waiting for an interrupt. then they can send code (few bits) and go back to sleep.
 

MrAl

Joined Jun 17, 2014
11,474
This seems very promising, after all you can get 25mm vinyl disks with NFC chips very cheap, and the size will fit the base of a nicely sized chess piece.

But there are 64 squares on the chess board, that would mean 64 sensors which is not a trivial undertaking. A camera seems to make the most sense when the 64 distinct locations is considered.
Hi,

Yes 64 squares is a lot, probably cries out for a manufacturing process. People have done more, but it's not easy.

The chess machines i used to play back in the 80's all had a switch under each square. It was just a membrane keypad in the shape and style of a chess board. I think i still have one of those things.
These only sensed the movement though, and had some other membrane switches for other things like take back, promotion, etc.

Back in the early 90's i think it was, i interfaced my TRS80 with one of those machines. It sensed the movements and key presses and logged the game onto a 5.25 inch floppy. That was quite an undertaking too. From that experience though i know the best way to handle multiple squares it to use a matrix and sense which point in the matrix is being disturbed. It's easy with switches, it's just multiplexing, but if we could come up with a way to identify the pieces too with that kind of setup that would be very interesting i think. Engineers come up with some very amazing things maybe there is a way, we just didnt think of it yet.

With the switch matrix chess board the computer inside forces the player to make distinct moves, and does not allow illegal moves. For example, when a player presses down to make a move the rank and file LEDs light up, then when he presses down on the "To" square and it records that and checks it for validity and promotion and en passant. It also checks for the 3 move repetition and 50 moves automatic draw rule.

All this means there is some real programming to be done with this project as well as the physical aspect. Since i have coded a fairly elaborate chess program that plays on the PC computer, i have run into a number of things that come up that have to be dealt with. Once of the sort of difficult parts is knowing how all the pieces are allowed to move, and checking for blocked squares as the computer can not allow a move that "jumps" over other pieces if their move function do not allow that (only the Knight is allowed). It is interesting though.

So there would have to be a lot of programming to go with it.
As to the board, maybe we can think of a matrix method that can also identify pieces, although if the program closely checks all moves from the very start, i dont think identification is really needed. None of the switch matrix types need that except for promotion where the user has to press the button for the piece he wants to promote to. The program does the rest, and it works pretty well as it just informs the player if they make a move that is not allowed, then the player has to make a different move.

Unless there is a different reason for identifying the pieces i would say you dont have to.
 

MrAl

Joined Jun 17, 2014
11,474
I am making a chess board with integrated AI for a year 12 school project and I am not sure what kind of components I will need to use to be able to sense what pieces are where at the start of each turn. I was thinking of using RFID but the range is too long I also thought about using smart card chips, but I couldn't find a source for just the identification chips in them.

Any suggestions for what kind of components to use would help or any source for the ID chips.
Im not sure if anyone mentioned this yet but unless there is a different reason for identifying the pieces i would say you dont have to.
You identify by programming and not allowing moves that are invalid. That means your program does all the work, and the board can be just a matrix of switches like most other electronic chess playing computers have.
That means only 16 connections to the board for the squares so it simplifies the whole thing.
If you intend to use AI anyway, then that AI should be able to do what other chess computers do already, which is keep track of all the pieces as they move.

If you intend to include Fisher Random Chess you also have to have a way for the user to set up the board, or automatic random setup. This would also apply if you intend to allow someone to set up a game that has been played before, which is very typical among chess players, so they can continue or just analyze the position.

Good luck if you intend to get the device to PLAY chess too. That is, decide on moves for one side and try to win the game. That's not an easy task. Probably better off starting with an open source chess program and modifying it to fit your requirements.
 

MrAl

Joined Jun 17, 2014
11,474
He rejected RFID in the original post.


It sounds like he could not single one square with a reader.
Yeah i was wondering that too, good point. The range would have to be limited.
However, in another post i pointed out that detecting the pieces like this is not needed. Just knowing where the piece comes from and where it goes is enough and that can be done with a switch matrix. That's much simpler and easy to wire too, only 16 connections.
The programming can force the player(s) to make valid moves.
 

KeithWalker

Joined Jul 10, 2017
3,091
In post #4 I pointed out a very simple and obvious solution, If the TS insists on being able to identify pieces that are randomly placed on the board with no input from the player, he has imposed a very large and difficult task on himself. What ever he chooses as a means to identify the pieces, It will require a vast amount of time, effort, research, hardware design, programming, mechanical assembly and budget compared the simplest solution. He should be aware of these facts when he makes his final decision.
 

WBahn

Joined Mar 31, 2012
30,055
IF a system has been implemented that can reliably track the pieces once it knows where they all are, then giving it the ability to be set up for a random board configuration is pretty simple. The pieces are merely placed on the board in a specific order -- such as white pieces first, king, queen, bishops, knights, rook, pawns. Then the black pieces in the same order. Once all of the pieces are on the board, all of the pieces that are not part of the set up are then removed. This would work unless there are promoted pieces, such as two queens, but there already has to be a means of recognizing promotions, so the board could be set up without promotions and then a promotion made to happen and the piece then moved to it's final starting position.

Not the most elegant way, but it would be a way that would not require any additional hardware, just additional software routines.

Depending on what user interface was made, it should be pretty easy to use it to tell the system which specific piece is being placed on the board next and for it to give some indication that it has recognized the piece.
 

KeithWalker

Joined Jul 10, 2017
3,091
If this project was presented to me and it included a definite need to identify every piece on the board at any time, including random setups, with no input from the player, I would certainly choose to use an overhead camera with shape recognition software. It would certainly be the most cost effective solution. All that would be required is a camera, computer, simple chess board and standard chess pieces. The largest part of the cost would be for the time invested in writing the shape recognition software. Even this system would require some form of prompts between the computer and player to make it practical.
 

Jerry-Hat-Trick

Joined Aug 31, 2022
552
Why not mimic a pocket/travelling chess set where the pieces have pegs on the bottom which are pushed through holes in the board. Use stereo jacks as the pins into stereo sockets. I'd need to work out the detail, but permuations of resistors and diodes between the three contacts should suffice to distinguish the identity of the pieces. Software to cross check if an extracted pieces ends up in a legitimate square etc...
 

Ian0

Joined Aug 7, 2020
9,810
Why not mimic a pocket/travelling chess set where the pieces have pegs on the bottom which are pushed through holes in the board. Use stereo jacks as the pins into stereo sockets. I'd need to work out the detail, but permuations of resistors and diodes between the three contacts should suffice to distinguish the identity of the pieces. Software to cross check if an extracted pieces ends up in a legitimate square etc...
Why not indeed? Please see post #29. You can get black and white jack sockets.
 
Last edited:

Ian0

Joined Aug 7, 2020
9,810
Oops, sorry didn't spot that, skipped through the posts too quickly, my bad.
Added advantage, easy to move the game without pieces going everywhere...
I'll elaborate my idea now that I know I have a supporter!
Eight open-drain output, one for each rank, connected to the tip of each jack.
The sleeves of every jack in each file are connected together to a pullup resistor, and connected to 8 A/D inputs.
each type of piece has a different value resistor, which requires 12 different resistors (6 for black pieces, 6 for white).
Strobe each open-drain line in turn and read all 8 A/Ds and you can determine what is where and which squares are empty.
 

MrAl

Joined Jun 17, 2014
11,474
Could you have a jack socket in each square, and move the piece by unplugging it from where it was and plugging it back in where it has moved to?
If so the piece could be identified by a resistance between the jack plug terminals.
All that would be required is 64 A/D inputs, or perhaps a way of multiplexing them on to 8 A/D inputs by using 8 line drivers.
You just gave me an idea.

Instead of jack sockets, use magnetic connectors. The board would have the connector and the piece the connector, and the piece holds the necessary electronics to be distinguished from other pieces. A player picks up a piece, places it down, no problem, no jack, no real connector. The connection is made when the two magnetic connectors make contact with each other. Would probably have to be two pole, so two contacts for each square and piece.
If rotational orientation is a problem, use circular magnetic connectors. That would be one inside the other, one circular terminal inside the other. May still want to have some sort of mechanical piece positioner such as a mild cone shape that the piece fits into.
Circular contacts may be hard to find, so a physical means to orient the piece correctly would allow simpler shapes (rectangular) to be used.
 

Thread Starter

Lunchbox

Joined Mar 4, 2023
5
I am making a chess board with integrated AI for a year 12 school project and I am not sure what components I will need to use to sense what pieces are where at the start of each turn. I was thinking of using RFID but the range is too long I also thought about using smart card chips, but I couldn't find a source for just the identification chips.

Any suggestions for what kind of components to use would help or any source for the ID chips.
The price should not exceed $300AUD overall, some requirements are that it includes a mechanical system (moving part not controlled by the player), an electronic system (raspberry pi/Arduino) and a closed loop system. I don't have much experience with coding and such but I do have an eager family that really wants to do it for me.
 

Ya’akov

Joined Jan 27, 2019
9,150
I think if I had to do the piece ID part of this I would use a camera mounted below a board that was transparent to UV, and fluorescent 2D bar codes (probably Datamatrix) on each piece.

I would use appropriate UV LED(s) to produce a brief flash to snapshot the board and decode the result. A grid matching the squares ruled with fluorescent lines would make it much easier.

Properly chosen and filtered, the LEDs would produce negligible visible light, and the brief exposing flash could be kept at a minimal power and duration.

The reason for all the UV stuff is to avoid having the board transparent to visible light and revealing the internal working parts.

Now, the addition of robotic movement of the AI player’s pieces does complicate things considerably. I think the project is severely underbudgeted.
 

Ian0

Joined Aug 7, 2020
9,810
The price should not exceed $300AUD overall, some requirements are that it includes a mechanical system (moving part not controlled by the player), an electronic system (raspberry pi/Arduino) and a closed loop system. I don't have much experience with coding and such but I do have an eager family that really wants to do it for me.
Year 12 project? Age 17? Lower sixth form?
and it requires a robot to pick up pieces from a chessboard?
Either it uses a load of pre written software, and the student learns nothing (except how to use pre written software - might as well be a class in Word or Excel) - or it seems a bit ambitious!
 

MrChips

Joined Oct 2, 2009
30,805
You just gave me an idea.

Instead of jack sockets, use magnetic connectors. The board would have the connector and the piece the connector, and the piece holds the necessary electronics to be distinguished from other pieces. A player picks up a piece, places it down, no problem, no jack, no real connector. The connection is made when the two magnetic connectors make contact with each other. Would probably have to be two pole, so two contacts for each square and piece.
If rotational orientation is a problem, use circular magnetic connectors. That would be one inside the other, one circular terminal inside the other. May still want to have some sort of mechanical piece positioner such as a mild cone shape that the piece fits into.
Circular contacts may be hard to find, so a physical means to orient the piece correctly would allow simpler shapes (rectangular) to be used.
I was thinking along the same line.

Use magnetic, optical, capacitive, inductive, etc. and/or any combination. The player picks up, puts down a piece, and the system knows which squares are involved. The piece has RFID transmitter that sends out ID when picked up and set down.

Definitely not a Year 12 project for under $300AUD.
 
Top