crossbar switch?

Hi, I am a real newbie in HW. I started visiting this website and received my first Arduino board a couple of weeks back.

After completing a few tutorials I am now ready for my first project. Basically, I am trying to hack a computer keyboard to simulate certain key presses. I’ve torn a keyboard up and found a tiny board inside. There are a total of 24 pins on the board, 12 on the left and the other 12 on the right. With the keyboard cable plugged into a PC, I can simulate keypresses by connecting a pin from the left side to a pin on the right with a wire. For example, by connecting left pin #3 and right pin #9 the ‘a’ shows up on the PC screen.

What I am looking for is an IC that allows me to programmablely connect pins together. Some google searches led me to something called ‘crossbar switch’. Can anyboard tell me if this is it? I would appreciate if you can also share some information on how to use it too (a link to a sample project would be great).

You can use analogue multiplexers like this:-
http://www.arduino.cc/playground/Learning/4051

As Grumpy suggests you can use the two 4051 multiplexor to create a 8 by 8 matrix to control the switches, or if you need more you could create a 16 by 16 matrix with the 4067 IC.

One very important thing to have in mind is that you can only simulate the pressing of one key at a time this way. So things like CTRL + key or Shift + key is not possible.

Thanks for replying.

I am not sure if a multiplexor will work for my project. My understanding is that multiplexor can output signals, but what I am trying to achieve is to use a matrix type device that can physically connect different pins, in a controllable fashion by Arduino. There are voltage differences between the left and right pins, so once they are physically connected, current will flow, therefore keystrokes will be simulated.

To use MOSFET is not practical as there are 12x11 combinations, meaning I need 132 MOSFETs.

My understanding is that multiplexor can output signals

No you are wrong.

An analogue multiplexer or analogue switch simply connects two signals together.
You can get single switches (4 in a package) or the 8 to 1 type I posted.

In your case you can use two 4051’s.

first you do a lot of trial and error and find out which of the conections on the keyboard is the rows of the matrix and which are the coloumns.

then you hook up one 4051 to the rows and one to the coloumns and hook the output of the two together.

Then it’s simply a matter of adresseing the two 4051’s to select the desired combination of row / coloumn to get your key.

With 4051’s you will be limited to 8 rows and 8 coloumns, if that is not enough use 4067 in stead (16 by 16).

I tried it with two 4051’s that was hooked up to a toy with a lot of switches in a matrix, and it works just fine.

As Grumpy suggests you can use the two 4051 multiplexor to create a 8 by 8 matrix to control the switches, or if you need more you could create a 16 by 16 matrix with the 4067 IC.

One very important thing to have in mind is that you can only simulate the pressing of one key at a time this way. So things like CTRL + key or Shift + key is not possible.

Could you use 2x 4067(as it has being said that 12x12 (sic) combinations are needed) to simulate two keys being pressed at once? or could this lead to issues if the sellected pins coincided with each other?

No you can not simulate two keys being pressed at the same time with the mux IC’s.

This is because you can only connect one of the IC’s inputs to it’s output at any given time.

But you could ad a single 4066 Ic to the setup and hook up 3 of its 4 switches to ALT, SHIFT and CTRL.

That way you would use the mux IC’s to simulate “ordinary” keys and the 4066 to simulate up to 4 extra keys.

But you could ad a single 4066 Ic to the setup and hook up 3 of its 4 switches to ALT, SHIFT and CTRL.

That way you would use the mux IC’s to simulate “ordinary” keys and the 4066 to simulate up to 4 extra keys.

That is what I was asking if you could do, except as I explained it you could “press” any two keys at the same time. I did realise after I posted this that there is not much use in pressing “g” and “r” at the same time so using a smaller multiplexer as you said just for the function keys is a much better idea.
Also just to clarify, is the number of multiplexers needed always 2 of each type connected back to back, like below;


L -| | | |- R
E -| | | |- I
F -| | | |- G
T -| |___ | |- H
-| | | |- T
P -| | | |-
I -| | | |- P
N -|
| |___|- I
S N
S

Yes you need two mux IC’s.

This is because the little contact points for the switches is really organized in a matrix with rows and columns. When a switch (key) is pressed one row is conneted to one coloumn.

So you need one mux to select one of the rows and one for selecting one of the coloumns.

It is of course very important that you figure out which of the contact points belongs to the rows and which belongs to the coloumns. This is not always organised in a logic way.

EDIT:

Did you know that thw two of os are located on diametrically oposite parts of the planet :slight_smile:

¿Está usted en España?

No Denmark (copenhagen)

Aparently there is another link between our countries!
Wikipedia:

Denmark was also ranked as the least corrupt country in the world in the 2008 Corruption Perceptions Index,[8] sharing a top position with Sweden and New Zealand.

Hopefully OP problem has been solved, seems like a interesting project can you let us know more details about it way liu?

BTW, an actual “crossbar switch” is typically a very high speed data communications thing, and is capable of connecting each input to any output SIMULTANEOUSLY. This is much more than you need or want for the keyboard simulation app…