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

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 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.
 

Hymie

Joined Mar 30, 2018
1,288
You need a system that can detect 12 different items (pawns, knights, bishops, rooks, king, queen, x2 for both colours), so it is unlikely you could achieve this through some sort of magnetic detection.

Something like this might suffice, but it would require quite a large chessboard (with one detector under each square) so that pieces on adjacent squares did not interfere with the detection system.

I suggest you investigate how commercially available chessboards achieve this with quite small squares on the board.

https://www.ebay.co.uk/itm/17393735...22dJ6R0eoMU9TKAS+oANwMyXE=|tkp:Bk9SR_Tg7bbVYQ
 

KeithWalker

Joined Jul 10, 2017
3,147
You are all jumping to solutions without analyzing the requirements.
Do you really need to individually identify every piece on the board at every move?
At the beginning of the game, you know the identity and position of every piece on the board. The pieces are only moved one at a time, so during a move, all you have to know is which square became vacant and then which previously vacant square became occupied. That is all the information the software needs to track the location and know the identity of every piece at all times during the game.
You can simply use a magnet under each piece, with a sensor (magnetic reed switch?) under each square.
 
Last edited:

WBahn

Joined Mar 31, 2012
30,252
Do you really need to individually identify every piece on the board at every move?
You can simply use a magnet under each piece, with a sensor (magnetic reed switch?) under each square.
At the beginning of the game, you know the identity and position of every piece on the board. The pieces are only moved one at a time, so during a move, all you have to know is which square became vacant and then which previously vacant square became occupied. That will allow the software to track the location and know the identity of every piece at all times during the game.
I wonder how robust that will be in practice, especially for non-tournament play where there aren't rigid rules about the how moves are physically realized.

I'm thinking about things like castling where a person might pick up both the king and the rook at the same time or when capturing a piece they might make the move in such a way that the sensor doesn't detect that the target square had a piece removed. A single misrecorded move would mess everything up from that point forward.
 

macman23

Joined Jan 6, 2023
13
Maybe try Hall effect sensors which could be used to detect the presence of magnetic fields. You could attach a small magnet to each chess piece and the hall effect sensor under each square of the board?
 

KeithWalker

Joined Jul 10, 2017
3,147
I wonder how robust that will be in practice, especially for non-tournament play where there aren't rigid rules about the how moves are physically realized.

I'm thinking about things like castling where a person might pick up both the king and the rook at the same time or when capturing a piece they might make the move in such a way that the sensor doesn't detect that the target square had a piece removed. A single misrecorded move would mess everything up from that point forward.
Those are problems that can be resolved in the software as long as the player follows the rules. When a piece is taken, a piece will go missing from the board. The software will be aware of which piece was being moved at that time. During castling, there are rigid rules that can be interpreted by the software. In both cases it can be programmed to correctly follow the move.
 

WBahn

Joined Mar 31, 2012
30,252
Those are problems that can be resolved in the software as long as the player follows the rules. When a piece is taken, a piece will go missing from the board. The software will be aware of which piece was being moved at that time. During castling, there are rigid rules that can be interpreted by the software. In both cases it can be programmed to correctly follow the move.
Again, the rigid rules don't apply in non-tournament play. Even in tournament play, it is usually allowed to slide your piece into the opponent's square, moving their piece slightly out of the way, before picking theirs up. A simple detection system may not detect that any action has taken place in that square and will sit there assuming that the player has only removed their own piece from the board and are pondering what move to make with it. The next thing it would see would be another piece being picked up. Since it would see that this is the opponent's piece, and since it thinks the prior move hasn't been completed, it will likely conclude that the player is trying to capture the piece that was just picked up (which may or may not be a legal move). In either case, the game state is likely messed up.

Another situation where such a simple system will have problems is in promotion. If a player gets their queen to the other side of the board, they can swap it for another piece. Usually that would be a queen, but it doesn't have to be. How will the system know what piece they promoted it to?
 

KeithWalker

Joined Jul 10, 2017
3,147
Again, the rigid rules don't apply in non-tournament play. Even in tournament play, it is usually allowed to slide your piece into the opponent's square, moving their piece slightly out of the way, before picking theirs up. A simple detection system may not detect that any action has taken place in that square and will sit there assuming that the player has only removed their own piece from the board and are pondering what move to make with it. The next thing it would see would be another piece being picked up. Since it would see that this is the opponent's piece, and since it thinks the prior move hasn't been completed, it will likely conclude that the player is trying to capture the piece that was just picked up (which may or may not be a legal move). In either case, the game state is likely messed up.

Another situation where such a simple system will have problems is in promotion. If a player gets their queen to the other side of the board, they can swap it for another piece. Usually that would be a queen, but it doesn't have to be. How will the system know what piece they promoted it to?
As I mentioned before, the player will have to follow the rules. Does that really present a problem? Defeating the system is not the usual intention of chess players.
 

crutschow

Joined Mar 14, 2008
34,700
If you used the opposite magnet orientation for each color, which could then be detected by a hall effect sensor, wouldn't knowing the color of the piece help eliminate some of the ambiguity for the computer?
 

WBahn

Joined Mar 31, 2012
30,252
As I mentioned before, the player will have to follow the rules. Does that really present a problem? Defeating the system is not the usual intention of chess players.
Most people that play chess don't know the detailed rules for exactly how to move and how not to move a chess piece. let alone make any effort to follow them when playing a game on some machine, so, yes, it really presents a problem.

But apparently insisting that the kid that is playing a game with this thing that they got for their birthday know and follow all of the exact rules for exactly how to move the pieces according to tournament rules is reasonable. And apparently, if they do so, the software can be written to tell the difference between a pawn that was promoted to a queen from one that was promoted to a rook or some other piece.
 

KeithWalker

Joined Jul 10, 2017
3,147
Most people that play chess don't know the detailed rules for exactly how to move and how not to move a chess piece. let alone make any effort to follow them when playing a game on some machine, so, yes, it really presents a problem.

But apparently insisting that the kid that is playing a game with this thing that they got for their birthday know and follow all of the exact rules for exactly how to move the pieces according to tournament rules is reasonable. And apparently, if they do so, the software can be written to tell the difference between a pawn that was promoted to a queen from one that was promoted to a rook or some other piece.
My intention is to try to help the TS achieve his goals, which will require him to define the rules for his automated version of the game of chess. I see no point in discussing how beginners and amateurs play the game.
 

MisterBill2

Joined Jan 23, 2018
19,042
The TS specified a set of requirements, and thus it seems perhaps reasonable to not second guess that set. The simple scheme will be a somewhat transparent chess board with the video camera below, and a two dimensional code sticker on the bottom of each piece. At that point every piece in every location can be known very simply, and no peculiar actions of players will matter. And stickers on the bottom of each piece will be simpler than embedded magnets and a whole lot of sensors. So the fabrication cost will be less and the assembly time much less.Also the computer does not need that matrix digital input.
 

Hymie

Joined Mar 30, 2018
1,288
I suspect KeithWalker’s proposed method of piece detection is how commercially available computer chess systems work – as he says, would be fairly simple to construct with a magnetic reed switch beneath each square. But it would require some detection of the piece colour, otherwise where a piece can capture more than one of the opponents pieces, the computer would detect that the piece had moved, but not know which of the opponents piece had been captured.

The software would then detect any illegal move (and give an audio announcement); on pawn promotion the software would prompt for the promoted piece. To allow for persons sliding the piece between the from/to square, the software could have a built in delay to allow for this.

Even if all the pieces were accidently swept from the board, the human could replace the pieces back where they were, continuing the game – and the computer would know which pieces were where.
 

MisterBill2

Joined Jan 23, 2018
19,042
Consider the logistics of connecting to all of those sensors, and then having some sort of digital logic input to the computer. and the effort of installing magnets in every piece. In addition, the process of keeping track of where each piece is located. That is why I suggested a video camera below, with ID stickers on every piece. Simpler and probably cheaper, and less programming needed.
 

Sensacell

Joined Jun 19, 2012
3,476
Some random ideas to ponder...
Each with their own flaws and benefits.

1) Put barcodes on the bottom of the pieces, make the board out of an IR transparent but visually opaque material- image from the bottom with a high resolution camera, using IR illumination.
2) install LC resonant tank circuits into each piece, with different frequencies. Build an array of coils into to board, sweep each coil and detect the signature ringing frequency.
3) install battery powered IR transponders into each piece, each one with a different binary code, receive the signals with an array of photo transistors underneath.
4) Install an array of addressable coils under the board, exciting the coil with a 20 Khz signal induces a voltage in a coil in the base of the piece, a small circuit powers a pulsed oscillator operating at a MHz frequency that emits a code which is received by a common receiver.
 

Thread Starter

Lunchbox

Joined Mar 4, 2023
5
You are all jumping to solutions without analyzing the requirements.
Do you really need to individually identify every piece on the board at every move?
At the beginning of the game, you know the identity and position of every piece on the board. The pieces are only moved one at a time, so during a move, all you have to know is which square became vacant and then which previously vacant square became occupied. That is all the information the software needs to track the location and know the identity of every piece at all times during the game.
You can simply use a magnet under each piece, with a sensor (magnetic reed switch?) under each square.
I did think about doing something like this but iI came to the conclusion that I would like the board to be able to analyse a random setup and then output the best move, having individually tagged pieces would be the only way to identify what is where.
My whole idea is that it only knows what the board currently looks like and decides the best move based on that information, the magnets would work if that was the path I wanted to go down but my idea of it is a bit different.
 

Thread Starter

Lunchbox

Joined Mar 4, 2023
5
I wonder how robust that will be in practice, especially for non-tournament play where there aren't rigid rules about the how moves are physically realized.

I'm thinking about things like castling where a person might pick up both the king and the rook at the same time or when capturing a piece they might make the move in such a way that the sensor doesn't detect that the target square had a piece removed. A single misrecorded move would mess everything up from that point forward.
having the user not know how the pieces move is not a problem since the board will analyse the board as it is and output what the board wants to move for the one specific setup, each move is analysed as a completely separate thing
 
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 ...Any suggestions for what kind of components to use would help or any source for the ID chips.
Suggest you look into camera + image recognition sw. Big advantages are, cheaper, works with standard sets and boards.
There are commercial sensor boards available, but they are quite pricey.
 

Hymie

Joined Mar 30, 2018
1,288
In terms of allowing the random position set-ups, this could still be achieved by the simple magnetic reed switch method – only the computer would need to prompt the human to indicate where each piece was in turn (during position set-up). The computer would then know for instance that the white king was on square g1 etc. This is how commercially available chess computers set-up random positions.
 
Top