Multiplexing for my chess robot

Base over Apex showed to me that the “ghost piece” i was talking about could be fixed this way below.

Oh yeah i am doing this because my shift registers… well something happened…no im doing this.

This is a common problem. The answer is a diode on every switch. You still need to scan the rows and columns individually.

Here’s how to kill the ghost:

diode_open.gif

Make your board with only 16 wires instead of 65.

 

Ok my question is how does a diode on every switch change the "ghost piece" problem?

and on the multiplexing where does the gnd go?

i am using arduino so it has a built in pull down resistor but idk how this darn multiplexing works.

Arduino has a built in
Arduino has a built in PULL-UP resistor, there’s a big difference. :slight_smile:

ok what ever. any help with
ok what ever. any help with my question?

There are no grounds

There are no grounds involved in multiplexing. The idea is to use your outputs as either a high signal, or as a ground which can be done in the program itself. I forgot exactly what its called, but basically you can set an output to low which the circuit will use as a ground. Theres no specific ground wire persay.The pullup resistor is used to tie a pin to high? because when you’re reading your inputs you wouldnt be able to detect the lows? i think its something like that. try google :stuck_out_tongue: also google charlieplexing

 

edit: this might in fact be charlieplexing but the two are asimilar.

Hey PM, here’s the formula

Hey PM, here’s the formula I mentioned earlier:
C = D + (5V - D)×(Rl÷(Rh+Rl))
Where C is the column voltage you read from the analog input, D is the diode voltage (requires testing, probably less than 0.7V), Rl is the low-side resistance (a few kΩ will do), and Rh is the high-side resistance (i.e. the resistance that the particular chess piece has).
I’ll write up a table of optimum values tomorrow if you remind me, sadly I’m out of time for today.

Edit: got home a little earlier than expected, so I’ll continue.

You can rearrange the above formula to get:
Rh = Rl×((5V - D)÷(C - D) - 1)
If we assume D is 0.7V and Rl is 5kΩ, we get:
Rh = 5,000×(4.3÷(C - 0.7) - 1)
For maximum distance between piece identifier voltages, we’ll take a minimum voltage of 1V and a maximum of 4.3V, with 0.3V spacing between each piece. Altogether this gives us the following table:

ID Voltage: Chess Piece Resistor:
5.0V 0Ω (i.e. this square has a short circuit!)
4.3V 972Ω
4.0V 1,515Ω
3.7V 2,167Ω
3.4V 2,963Ω
3.1V 3,958Ω
2.8V 5,238Ω
2.5V 6,944Ω
2.2V 9,333Ω
1.9V 12,917Ω
1.6V 18,889Ω
1.3V 30,833Ω
1.0V 66,667Ω
0.7V ∞Ω (i.e. this square has nothing on it)

You don’t have to be perfect with the resistor values - these are just the ‘perfect’ ones. As long as they’re fairly close to the target value it’ll be easy enough for the ADC to tell them apart.

Thanks alot, will buy these
Thanks alot, will buy these ASAP. What diode would be good for this and what value?

here are the resistor values

here are the resistor values i was able to find close to those. Are the close enough?

 

RES 910 OHM 1/4W 5% CARBON FILM 0 0.08000 $0.08
3 1 CF1/41.5KJRCT-ND RES 1.5K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.08
4 1 CF1/42.2KJRCT-ND RES 2.2K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.08
5 1 CF1/43KJRCT-ND RES 3K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.08
6 1 CF1/43.9KJRCT-ND RES 3.9K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.08
7 1 CF1/45.1KJRCT-ND RES 5.1K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.08
8 1 CF1/46.8KJRCT-ND RES 6.8K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.08
9 1 CF1/49.1KJRCT-ND RES 9.1K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.08
10 1 CF1/413KJRCT-ND RES 13K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.08
11 1 CF1/418KJRCT-ND RES 18K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.08
12 1 CF1/430KJRCT-ND RES 30K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.08
13 1 CF1/468KJRCT-ND RES 68K OHM 1/4W 5% CARBON FILM

Just buy the most generic,
Just buy the most generic, boring diodes you can find, IN4148 or something along those lines. They only have to withstand 5V max reverse voltage and less than 1mA forward current.

IndexQuantityPart

Index Quantity Part Number Description Customer Reference Backorder Quantity Unit Price
USD
Extended Price
USD
1 1 AE9992-ND IC SOCKET STRAIGHT 16POS TIN 0 0.45000 $0.45
2 1 CF1/4910JRCT-ND RES 910 OHM 1/4W 5% CARBON FILM 0 0.08000 $0.08
3 8 CF1/41.5KJRCT-ND RES 1.5K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.64
4 8 CF1/42.2KJRCT-ND RES 2.2K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.64
5 2 CF1/43KJRCT-ND RES 3K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.16
6 2 CF1/43.9KJRCT-ND RES 3.9K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.16
7 66 CF1/45.1KJRCT-ND RES 5.1K OHM 1/4W 5% CARBON FILM 0 0.02880 $1.90
8 2 CF1/46.8KJRCT-ND RES 6.8K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.16
9 1 CF1/49.1KJRCT-ND RES 9.1K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.08
10 1 CF1/413KJRCT-ND RES 13K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.08
11 2 CF1/418KJRCT-ND RES 18K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.16
12 2 CF1/430KJRCT-ND RES 30K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.16
13 1 CF1/468KJRCT-ND RES 68K OHM 1/4W 5% CARBON FILM 0 0.08000 $0.08
14 1 296-9518-5-ND IC QUAD HALF-H DRVR 16-DIP 0 2.75000 $2.75
15 9 1N4148T-73CT-ND DIODE SWITCH 100V 150MA DO-35 0 0.20000 $1.80

Ok, diagram got a little

Ok, diagram got a little chewed up by the resize, but it’s legible enough. The first 2 full rows and the last full row are shown.
D is whatever diode you can find, R is for the resistance of the piece that’s on that square (infinite for no piece). The Rows are your digital outputs (active on Row- low, Row+ high), and the Cols are your analog inputs.

Edit: So I don’t forget, the rows can be controlled by only 3 outputs by using a 3-8decoder (74HC138) and an octal inverter (74HC240).

ok question. So does the
ok question. So does the row8- get driven high if im not reading that row?

Yep, the idea is that if

Yep, the idea is that if you’re going to read row number ‘N’ then you set RowN+ high and RowN- low, and all other Row+ low and all other Row- high.
If you want to read Row6 for example then you set Row6+ high and Row6- low, and the rest are reversed.

As RowN+ and RowN- are always the opposite of each other, the octal inverter IC I mentioned previously allows you to just use 8 input lines, since you can have the inverter control all the RowN+ lines by using the inputs from the RowN- lines. If you use a 3-8 decoder IC then you only need 3 inputs, and only 1 of the decoder’s outputs will ever be low at a time.

Edit: There was a minor error in the first diagram, but I can’t edit the post now so I’m posting the updated one here:

Chess_Sensor_Array.jpg

slap
slap

ok i wired this circuit up
ok i wired this circuit up and here are some things im finding. One that you do not want to make the other circuits all HIGH because then you read those too. But its best to not do anything with the ones your not reading. A single resistor is giving a different value on different squares. What does that mean? finally one resistor on a single row makes all the analog inputs equal to that one value. Thats deffinetly not good. What does this mean when it comes to the circuit? im sure the first thing you will ask me is if i have the analog inputs perpendicular to the rows im driving HIGH and i do. The columns are driven hight to read and the rows are the analog inputs.

you know what nvm. It isnt
you know what nvm. It isnt quite as a problem as i thought. It is a small i guess noise problem like a value of 189 would make the square next to it read about 100 but we will see if any resistors have that value of the noise and if not then it wont be too big of a problem. And about the resistor value being different on different squares is wrong too.

Are you driving the Row+
Are you driving the Row+ high and the Row- low? If you have both of those going it should almosst completely wipe out any interference from other squares on the same row.

yes just for the row im

yes just for the row im reading

 

Version 1.1, ready to go.

Chess_Sensor_Array_1_1.jpg

Version 1.1, ready to go. This fix should decrease the diode voltage fluctuations.

As much as I hate to add

Chess_Board_Sensor_Array_1_2.jpg

As much as I hate to add more diodes back into the circuit, this may be the easiest way to cut out interference from adjacent pieces. Unfortunately the original design is not as resistant to that as I had thought.

oh wow. Im not too sure if i
oh wow. Im not too sure if i can do that. Um things are starting to become permanent in place. Ill see how the first circuit goes. If it does not work then i will do this but i am not ready yet to change it.