Copenhagen / Denmark
Offline
Edison Member
Karma: 5
Posts: 2338
Do it !
|
 |
« on: February 20, 2008, 09:43:40 am » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Sussex UK / CT USA
Offline
Edison Member
Karma: 0
Posts: 1026
Forums forever
|
 |
« Reply #1 on: February 20, 2008, 11:14:23 am » |
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".
|
|
|
|
|
Logged
|
|
|
|
|
Copenhagen / Denmark
Offline
Edison Member
Karma: 5
Posts: 2338
Do it !
|
 |
« Reply #2 on: February 20, 2008, 04:08:53 pm » |
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 ?
|
|
|
|
|
Logged
|
|
|
|
|
Sussex UK / CT USA
Offline
Edison Member
Karma: 0
Posts: 1026
Forums forever
|
 |
« Reply #3 on: February 20, 2008, 05:20:16 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Brisbane, Australia
Offline
God Member
Karma: 0
Posts: 593
|
 |
« Reply #4 on: February 20, 2008, 11:45:04 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
malmö / berlin
Offline
Jr. Member
Karma: 0
Posts: 58
fhp>--vs--<k3
|
 |
« Reply #5 on: February 22, 2008, 12:50:23 pm » |
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/4051use 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
|
|
|
|
|
Logged
|
|
|
|
|
Copenhagen / Denmark
Offline
Edison Member
Karma: 5
Posts: 2338
Do it !
|
 |
« Reply #6 on: February 22, 2008, 01:22:51 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
malmö / berlin
Offline
Jr. Member
Karma: 0
Posts: 58
fhp>--vs--<k3
|
 |
« Reply #7 on: February 22, 2008, 03:11:16 pm » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Copenhagen / Denmark
Offline
Edison Member
Karma: 5
Posts: 2338
Do it !
|
 |
« Reply #8 on: March 11, 2008, 06:51:32 am » |
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
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 12
Arduino rocks
|
 |
« Reply #9 on: December 04, 2008, 03:21:40 pm » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
Copenhagen / Denmark
Offline
Edison Member
Karma: 5
Posts: 2338
Do it !
|
 |
« Reply #10 on: December 04, 2008, 04:29:21 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 12
Arduino rocks
|
 |
« Reply #11 on: December 04, 2008, 04:51:33 pm » |
Thanks, when you can. I'll check the playground.
|
|
|
|
|
Logged
|
|
|
|
|
|