I need to test switches connected in a matrix, sounds simple, but having trouble

Discussion in 'General Electronics Chat' started by TCU, Apr 11, 2012.

  1. TCU

    Thread Starter New Member

    Sep 11, 2009
    4
    0
    Hi all, my first post on the forums.

    I have a 6x6 array of switches connected in a matrix, and I need to confirm that each one connects the correct row to the correct column (e.g. SW0=R0+C0, SW1=R1+C0, etc).

    I also need to do it quickly, so for example press each button and see an LED light up confirming the connection.

    The outputs I have on the connector are C0, C1... C5, and R1, R2, ... R5

    This would be simple I thought - connect an LED/resistor + power supply to each set of connections and voila, but the problem is that if using the same power source, they all end up connected to the same ground and/or +V supply, which defeats the point of the test.

    I'm sure there is an easy way to do this but I can't think of it

    I've thought about using resistors between the columns and rows and then the user will know if the wiring is correct based on the resistance value of each switch, but I prefer to use LED's somehow if possible?
     
  2. panic mode

    Senior Member

    Oct 10, 2011
    1,318
    304
    if you are using matrix of elements, you need to scan them. scan rate has to be sufficiently high so that to user it appears instantaneous.

    normal way it to use IC (usually MCU) to turn on one of the rows at a time and read all columns. then turn it off and turn on next row and read all the columns etc.

    also this does not allow correct detection of multiple simultaneous presses, for that you would also need to insert diode in series with each switch. this completely eliminates ghosting effect.

    if you only have switches and LEDs that is not going to work - in that case you need to wire them separately (36+1 wire between keypad and leds)
     
    TCU likes this.
  3. TCU

    Thread Starter New Member

    Sep 11, 2009
    4
    0
    Thanks panic for the reply.

    I'm not worried about ghosting and other ill effects present in keyboards for example.

    Do you have an example of circuit of how I can scan the rows and columns as you describe? I have never done this before.
     
  4. hexreader

    Active Member

    Apr 16, 2011
    250
    82
    Have not tried the attached circuit, but I would have thought that it should work if you only press one key at a time.

    Might be worth a try....
     
    TCU likes this.
  5. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    What kind of switches? I've wondered about how these 6X6 keypads with only 12 wires work before. Now I guess panic mode has cleared that up for me (thanks).

    The keypads with 12 wires are just 36 single pole switches (buttons) that connect a column to a row. I always thought that a much better design would be to have 36 DOUBLE POLE switches, and one extra wire for a positive supply, with the positive routed to each switch so that when you press a button, it does not connect a column to a row, - it connects a supply to a column AND a row. This way is simpler and you could also register multiple keys pressed simultaneuously. If your switches permit (whatever type they are) I would suggest doing it this way.

    Now that I know how those 12 wire keypads work, I wonder WHY. Why design a keypad that takes such a complicated system to register the keypresses? Why not just add another conductor and make life easier for everybody?
     
    TCU likes this.
  6. panic mode

    Senior Member

    Oct 10, 2011
    1,318
    304
    circuit posted by hexreader will work to illuminate LEDs corresponding to pressed switch. that could be all you need if you are only interested in visual inspection.
     
  7. TCU

    Thread Starter New Member

    Sep 11, 2009
    4
    0
    Thanks for all the ideas guys! really great, and QUICK :D

    I have actually ended up with a different solution in the meantime that I think will work better for us:

    I took apart an old usb keyboard, and I'm plugging each row and column that we are testing to a row and column on the keyboard. Then when a switch is pressed (say S0) the corresponding letter (possibly Q) would be typed. Then I have a small script that will convert the input letters into actual switch names, so I type Q, and get SWITCH 0 --> or in our case that is the on/off button, so it will output that instead :D

    The reason I did not use your solution is because even though our switches are connected as an array, they are not arranged in an array. They are scattered all over a device (they are actually selection buttons around an LCD).

    Thanks again for all the help!!! really great guys :)
     
Loading...