Go Down

Topic: Controlling switch matrix (Read 2066 times) previous topic - next topic

MikMo

Hi all Arduinians

I am planning a project where i need to control a switch matrix from Arduino. I'm not reading the switches, i actually want Arduino to simulate keypresses on a keyboard thats build as a matrx with 6 rows and 7 coloumns.

So somehow i need to short the relevant row / coloumn pair for the different switches.

How can i control all the switches ?
What extra components, like shift registers or whatever, do i need ?

Thanks

MikMo

http://ww.mikmo.dk

tkbyd

Are you SURE you want to take this on? It will not be easy!!! At least not taking your description of what you want to do at face value. There's probably a way to get your result, but not by the "obvious" route.

a) Do you have access to the 13 wires (6+7) by which the matrix is connected to it's host?

b) If you REALLY want to EXACTLY mimic "fingers on keys", you'll need to be able to connect 84 wires to the places on the matrix keyboard where it's SPST switch connects to the cirsuit board.

Those 84 wires could be taken to 84 opto-osolators which could be Arudino controlled, and act like "fingers on buttons".

MikMo

Thanks for the answer.

Yes i have acces to the 13 points on the edge of a circuit board.

I only need to simulate one key being pressed at at time. There are 40 keys tortal on the keyboard. So 2 of the 6 * 7 connections are not used.

How do you arrive at the number 84 ?

tkbyd

84: Each switch has two contacts!

I thought Google was going to let me down... shock! horror! Took ages to find....

http://www.rentron.com/serkey16.htm

... where you'll find matrix keypads explained.

Cheater

There are two approaches.

The simple but messy 'emulate pressing the button' method.
And the neat and tidy 'manipulate the matrix directly' method.

To manipulate the matrix you'll need to detect which row is being scanned and then if the row is the row your looking for, you need to flicker the column's line.
That'll use the least pins and but the code is trickier.

tomek

hej,

if you just want to presse one key at the time you could use just two 4051 multiplexer/demultiplexer, this would be much more easier and you don't have to wire up the hole matrix...

check: http://www.arduino.cc/playground/Learning/4051

use one 4051 as demutliplexer and one 4051 as mutliplexer, and both z are connected to each other, that should work, i guess, i hope, if i under stand you right....

you just need 6 digital Pins at the arduino,

so long
tomek

MikMo

Thanks.

The crazy thing is that i came to that exact solution my self and tried to by 4051's on my way home from work, but they were sold out :-)

My only concern is if the resistance through the two IC's is to big for the switches to actually close.

I also think that i need 8 pins (or 3 and a 595 shiftregister) because i would need to enable / disble the inhibit pins to prevent one switch from being closed all the time.

I will reprot back what i find out when i get some 4051's from the online store insted.

tomek

why not using the enable pin at th 4051, so you need just one pin more (...) but i guess it doesn't matter :}

and if you get a problem with the internal resistance, can't you use 13 transistors (don't know how fast your matrix is, and then you have to look deeper into how does the matrix work, but it could be a solution)

good lucke
tomek

MikMo

I just finished a simple proof of concept test.

It works. It is definitly possible to control a switch matrix with 2 4051's so you can simulate any key in an 8 by 8 key matrix being pressed.

I can't say that this will work with any keymatrix, but for my toy with a 6 by 7 matrix it works.
This is a simple toy (Vtech Little smart alphabet desktop) with a simple matrix without diodes on the rows / coloumns.

I will post more info later.

MikMo

NYdave

Any more info available on the Vtech toy control with 4051's? Just saw those at good prices at Lot Less, near Chambers and Church if you are in Manhattan, and wondered what you could do with the.

A drawing of the circuit maybe?

MikMo

The device i made works fine. it's pretty much based on the 2 X 4051 example from the playground, but in stead of reading the 2 4051's you just connect their outputs together.

one 4051 select the row in the matrix, the other selct the coloumn, their outputs are connected, so when both are chosen the row and coloumn are connected, this simulates a keypress. Since most key matrixes work in the same way, this should work on any keymatrix not just VTECH toys.

I don't have a schematic right now, and most of my stuff is temporarily out of reach.

I do have the code, on an old laptop somewhere if you are interested.


NYdave

Thanks, when you can. I'll check the playground.

Go Up