Let's Make Robots!

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. 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
patrickmccabe's picture
 
you can ignore the pawn and bishop part, i had it decerning the pieces but that was before i discovered the problem in the first circuit. The code does print all the inputs. Try to go easy on my code ;) 
 
 
int output1 = 52;
int output2 = 53;
int output3 = 50;
int output4 = 51;
int output5 = 22;
int output6 = 23;
int output7 = 24;
int output8 = 25;
int output9 = 26;
int output10 = 27;
int output11 = 28;
int output12 = 29;
int output13 = 30;
int output14 = 31;
int output15 = 32;
int output16 = 33;
int input = 0;
int input1 = 1;
int input2 = 2;
int input3 = 3;
int input4 = 4;
int input5 = 5;
int input6 = 6;
int input7 = 7;
int x1;
int x2;
int x3;
int x4;
int x5;
int x6;
int x7;
int x8;
int x;
void setup(){
  pinMode(input1, INPUT);
  pinMode(input2, INPUT);
  pinMode(input3, INPUT);
  pinMode(input4, INPUT);
  pinMode(input5, INPUT);
  pinMode(input6, INPUT);
  pinMode(input7, INPUT);
  pinMode(output1, OUTPUT);
  pinMode(output2, OUTPUT);
  pinMode(output3, OUTPUT);
  pinMode(output4, OUTPUT);
  pinMode(output4, OUTPUT);
  pinMode(output6, OUTPUT);
  pinMode(output7, OUTPUT);
  pinMode(output8, OUTPUT);
  pinMode(output9, OUTPUT);
  pinMode(output10, OUTPUT);
  pinMode(output11, OUTPUT);
  pinMode(output12, OUTPUT);
  pinMode(output13, OUTPUT);
  pinMode(output14, OUTPUT);
  pinMode(output15, OUTPUT);
  pinMode(output16, OUTPUT);
  pinMode(input, INPUT);
  Serial.begin(9600);
}
void loop(){
  digitalWrite(output5, HIGH);
  digitalWrite(output6, LOW);
  x = analogRead(input);
  x1 = analogRead(input1);
  x2 = analogRead(input2);
  x3 = analogRead(input3);
  x4 = analogRead(input4);
  x5 = analogRead(input5);
  x6 = analogRead(input6);
  x7 = analogRead(input7);
  Serial.println("x");
  Serial.println(x);
  if(x>=315){
    if(x<=340){
      Serial.println("white pawn");
    }
  }
    if(x>=200){
    if(x<=220){
      Serial.println("white bishop");
    }
  }
  Serial.println("--------------------------");
  delay(1000);
  //---------------------------------------------------------------------------
    Serial.println("x1");
  Serial.println(x1);
  if(x1>=320){
    if(x1<=340){
      Serial.println("white pawn");
    }
  }
    if(x1>=200){
    if(x1<=220){
      Serial.println("white bishop");
    }
  }
  Serial.println("--------------------------");
  delay(1000);
  //--------------------------------------------------------------------------
  
    Serial.println("x2");
  Serial.println(x2);
  if(x2>=315){
    if(x2<=340){
      Serial.println("white pawn");
    }
  }
    if(x2>=200){
    if(x2<=220){
      Serial.println("white bishop");
    }
  }
  Serial.println("--------------------------");
  delay(1000);
  //-----------------------------------------------------------------------------
  Serial.println("x3");
  Serial.println(x3);
  if(x3>=315){
    if(x3<=340){
      Serial.println("white pawn");
    }
  }
    if(x3>=200){
    if(x3<=220){
      Serial.println("white bishop");
    }
  }
  Serial.println("--------------------------");
  delay(1000);
  //--------------------------------------------------------------------------------
    Serial.println("x4");
  Serial.println(x4);
  if(x4>=315){
    if(x4<=340){
      Serial.println("white pawn");
    }
  }
    if(x4>=200){
    if(x4<=220){
      Serial.println("white bishop");
    }
  }
  Serial.println("--------------------------");
  delay(1000);
  //-----------------------------------------------------------------------------------
    Serial.println("x5");
  Serial.println(x5);
  if(x5>=315){
    if(x5<=340){
      Serial.println("white pawn");
    }
  }
    if(x5>=200){
    if(x5<=220){
      Serial.println("white bishop");
    }
  }
  Serial.println("--------------------------");
  delay(1000);
  //-----------------------------------------------------------------------------------------
    Serial.println("x6");
  Serial.println(x6);
  if(x6>=315){
    if(x6<=340){
      Serial.println("white pawn");
    }
  }
    if(x6>=200){
    if(x6<=220){
      Serial.println("white bishop");
    }
  }
  Serial.println("--------------------------");
  delay(1000);
  //-------------------------------------------------------------------------------------------
    Serial.println("x7");
  Serial.println(x7);
  if(x7>=315){
    if(x7<=340){
      Serial.println("white pawn");
    }
  }
    if(x7>=200){
    if(x7<=220){
      Serial.println("white bishop");
    }
  }
  Serial.println("--------------------------");
  delay(1000);
}
 
 
 
 
TeleFox's picture

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.

patrickmccabe's picture
well i tried this on one row. It is a the first row which means there are 7 more rows before the analog reading. I dont know if that may interfere with the last row im reading. I do have it wired up like the schematic above i think. But what is happening is with the resistor, the analog read goes from 0 to about 100 every loop. Each loop of the code it changes from around 0 to around 100. Without the resistor the readings are about 0 without a piece, this is good and not fluctuating. But the problem is a piece makes the whole row that value. This sounds familiar. This is about how isolated they can get so i dont understand.
patrickmccabe's picture
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.
TeleFox's picture
Since the diodes are so small you just add them underneath the squares themselves. I'd suggest going to Futurlec if you need to buy them, it'll only cost US$2.60 for 130 basic diodes =)
patrickmccabe's picture
well it looks like this is what ill have to do. The circuit isnt working too well right now so ill order the diodes form somewhere. The whole circuit is already under the chess board squares. So i now have to flip the whole thing over, crane and all, and add these in to the circuit on the bottom of the chess board. 
TeleFox's picture

Chess_Sensor_Array_1_1.jpg

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

patrickmccabe's picture
IndexQuantityPart NumberDescriptionCustomer ReferenceBackorder QuantityUnit Price
USD
Extended Price
USD
11AE9992-NDIC SOCKET STRAIGHT 16POS TIN00.45000$0.45
21CF1/4910JRCT-NDRES 910 OHM 1/4W 5% CARBON FILM00.08000$0.08
38CF1/41.5KJRCT-NDRES 1.5K OHM 1/4W 5% CARBON FILM00.08000$0.64
48CF1/42.2KJRCT-NDRES 2.2K OHM 1/4W 5% CARBON FILM00.08000$0.64
52CF1/43KJRCT-NDRES 3K OHM 1/4W 5% CARBON FILM00.08000$0.16
62CF1/43.9KJRCT-NDRES 3.9K OHM 1/4W 5% CARBON FILM00.08000$0.16
766CF1/45.1KJRCT-NDRES 5.1K OHM 1/4W 5% CARBON FILM00.02880$1.90
82CF1/46.8KJRCT-NDRES 6.8K OHM 1/4W 5% CARBON FILM00.08000$0.16
91CF1/49.1KJRCT-NDRES 9.1K OHM 1/4W 5% CARBON FILM00.08000$0.08
101CF1/413KJRCT-NDRES 13K OHM 1/4W 5% CARBON FILM00.08000$0.08
112CF1/418KJRCT-NDRES 18K OHM 1/4W 5% CARBON FILM00.08000$0.16
122CF1/430KJRCT-NDRES 30K OHM 1/4W 5% CARBON FILM00.08000$0.16
131CF1/468KJRCT-NDRES 68K OHM 1/4W 5% CARBON FILM00.08000$0.08
141296-9518-5-NDIC QUAD HALF-H DRVR 16-DIP02.75000$2.75
1591N4148T-73CT-NDDIODE SWITCH 100V 150MA DO-3500.20000$1.80
TeleFox's picture

Chess_Board_Sensor.jpg

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

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