Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Sampling an 8 x8 grid of resistors

Status
Not open for further replies.

Mosaic

Well-Known Member
I'm trying to sample an 8 x 8 grid of fixed resistor values. All the resistors can have a common ground.
Is there a means of multiplexing with analog switches so I can just do this with 8 samples of 8 adcs inputs on a uC?
 
Have a look at a 4051 ic, its a 8 channel analogue multiplexer.
Just use the address pins to switch the resitors to be sampled through to the adc.
If I misundertood that and you have a resistor matrix then there is or was a cmos multiplexer chip that is a crosspoint switch, cant find it now, but I did find this:

**broken link removed**
 
Are you wanting to measure the resistance value of each resistor?
If so what accuracy do you need?
 
Actually I'm assessing the location of chess pieces using a pair of embedded 1/8" dia. neodymium magnets (in the checker board squares) 'connecting' to a resistor on the base of each chess piece.
A variation in voltage drop of about 0.2 V per resistor divider should be fine from the 3.7V supply. Need to identify 12 individual values (6 types of pieces x 2players)

I think a single ADC pin can do this with an open collector (sink or source) method of selecting a specific resistor (board square).
Because of the supply voltage I can't use a TPIC6B595 open drain SIPO register. I plan to go with (rank & file) 74HC595's driving some BISS bipolar transistors to 'activate' any individual square to assess the presence of a resistor in a chess piece base with the ADC sample.
 
Use 8 output pins of your uC to power individual rows (only 1 pin set to output at a time). Use a fixed value resistor from columns to ground and 8 analogue pins can read each column. No need for any additional chips. As each (pic) pin can sink/source 25mA you should ensure the maximum leg current is no more than 3mA. A quick calc suggest a fixed value of 1k and piece values of 200, 400, 680, 1050, 1600 & 2500 will give ADC readings over 100 apart. I'd use the higher value resistors in the most common pieces to ensure you don't draw too much current from a pin.
Edit, just realized I only accounted for 6 pieces but you should be able to work out suitable resistors. Just be sure to limit the current to 4mA per leg and calculate the acquisition time for the ADC. I say 4mA as that will only be drawn by the kings (with each lower piece taking less) so a line should never exceed 25mA.

HTH

Mike.
 
Last edited:
I can.
 
Even though you have now replied I still can't see my edit yet if I click edit, it's there!! Seems like a forum bug. Sorry to go off topic.

Mike.
 
Ok, that seems reasonable....
I'd need a fixed resistor to ground for each of the 64 squares. Perhaps a 2.7k or so.
Then 12 distinct values for the bases of the pieces.

I 'scan' the rows with the 8 dig. pins and sample the columns with the 8 ADC pins to identify voltage drop ratios which can be used in a lookup table to identify the chess piece.

Edit, actually I might just need 8 fixed column resistors, not 64, once the rows are tristated when not scanning.
 
Last edited:
Yes, you only need 8 column resistors. Make 1 output high and the others input and scan the 8 analogue pins. Repeat for other seven digital outputs. If you give the kings the lowest value resistor and pawns the highest then you will limit the max current draw for a single row which will happen at the start of the game. If you swap the ports so the columns are the digital output then the current should be more even throughout the game.

Mike.
 
Hi,

If you only intend to play standard chess and not something like Fischer chess then you dont need to sense the pieces themselves. This is because every game starts out with the pieces on the same squares every game, and all you have to do is track their movement FROM and TO squares and detect when a piece has been captured. This makes it much simpler.
For example, at the start of the game you load the matrix with the pawns and pieces. If you detect a FROM square of e2 and TO square of e4 then you know that it had to be a pawn because a pawn had to be on e2 to start. Later in the game the pieces will have moved to different squares and some captures, but you'll keep the matrix updated for each and very move. If you like you can even detect illegal moves.
There are some special moves that you can also detect like en passant just from what pawn moved prior to the current move, and pawn promotions require a separate input on the part of the user/player so they can enter in what type of piece they want to promote to.
If you do want your board to support variations like Fisher Chess then you just need a way to input the piece types at the start of the game.
 
Sorry but I feel a little bit slow and limited today.

My questions:

Mosaic: how do you actually connect the resistor of a particular piece? What rol the magnet has? I cannot grasp your idea. Sorry.

MrAl: I do not play chess but it is possible that going from X1 to Y2 the piece is kept some time "in the air". Would it still work? I presume you are suggesting kind of a continuous polling.

I ask this because I still do not understand how the respective resistor would be identified, measured or...?
 
Hi,

From my understanding so far it sounded like he wanted a resistor for each piece, so measuring the resistor could tell what the piece was.
For a simple example, say 100 ohms for pawn, 200 for knight, 300 for bishop, 500 for rook, 900 for queen, and 2k for king. So if a piece was on square e2 and the resistance measured 100 ohms, it would have to be a pawn. If that pawn moved to e4 then e2 would have infinite resistance and e4 would have 100 ohms.
But chess moves are not so complex that you would have to track their movement when they are in the 'air', being moved. You only have to track the FROM and TO squares. Adding to that logic, from the start of the game all the piece positions are known in advance, so the only piece that can be on square e2 at the start of a game is a pawn. Thus if on the first move of the game something moves from e2 to e4 it must have been a white pawn.
This will always be true except in the case where non standard chess games are to be played or positions set up that are not from the very beginning of the game. To handle this chess board setup programs have buttons or some other control that allows the user to enter what type of piece they want to place on a given square at the start of the game. For example, the user might select a white queen from the menu, then click the square d5, and that puts a white queen on square d5.

What does have to be tracked in all cases is the FROM and TO squares. The program has to know the square of the piece that is being moved before it moves and after it moves, but nothing else. To accomplish this chess playing machines use momentary push buttons switches under the membrane chess board. The player presses briefly on the square where the piece is sitting, then presses on the square where it is moving to. The program senses the switches which are arranged in a grid, and so it can tell which squares have been pressed. It then follows the action in the program where it changes the arrangement of its virtual chess board, placing the piece on the new 'square' and possibly eliminating the captured piece if there was any. En passant moves are a little more tricky but still the same idea. Pawn promotions mean the player has to press a third switch at the time of promotion so the program knows what piece to replace the pawn with. For example, the player might press e7 and then e8, and then the 'queen' button and that tells the program to make the pawn a queen.

I can see how making the pieces distinguishable through some measurement process could be beneficial, but it may be hard to measure the resistance because that requires a good electrical contact between the board and the piece. Maybe some inductive coupling technique would work better as that would not require electrical contact. It would make the piece design slightly more complex though.
 
I use nickel plated neodymiums to establish the connection. I have tested the operation and it seems reliable, especially so since I plan to add an LED in the squares that can feedback correct piece recognition to compensate for any potential connection issues.
Commercial boards use RFID tags to do piece recognition.
 
Commercial boards use RFID tags to do piece recognition.

I thought of suggesting it but expected to be considered overkill. Go figure...:facepalm: :hilarious:
 
As an alternative to the design I'm also having a go with linear hall effect sensors. I discovered I could weaken the strength of a neodymium mag fairly accurately based on heating it with my temp controlled soldering iron. They have a low curie temp.
A similar matrix method can drive the hall sensors under the board and detect the chess pieces with different gauss. The board may need an overlay to ensure the chess piece bases are always centred on the squares.

Because the Hall sensor can detect N & S poles (equiv to Black or White sides), I'll only need 6 different magnet strengths overall.
 
If you stick with the resistors then you will need diodes in series with the resistors to stop alternative paths showing up as phantom pieces.

Mike.
 
In effect you have an 8*8 matrix with up to 32 active nodes. This can cause ghost pieces to show up.
Microsoft did a good explanation here **broken link removed**

Mike.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top