Controlling a matrix of buttons

Hi,

I'm looking at controlling an external device with arduino. I need to be able to make connections outlined in the diagram below. I was thinking about using optocouplers but I would require too many and also I need to be able to make different connections on the same pin.

for example I need to be able to make these connections:

Pin 1 + 2
Pin 1 + 3
Pin 1 + 4

etc etc.

I never need to make more than one connection at the same time.

The hacked device has it's own power so I only need to trigger a switch. Does anyone have an idea what might be the best thing to use?

I looked at this:

but I'm not sharing the ground with the device? Any help much appreciated. Can you get multichannel relays/optocouplers?

Thanks in advance

Your switches are arranged in a matrix of rows and coloumns.

-first you figure out the row / coll s

-then you can use 2 4051 multiplexor IC's one to select the row the other to select the col. The outputs of the two 4051's are connected together. So when you selct a row and a coloumn they a basically shorted together = presseing the corresponding switch.

This way you can control a switch matrix up to 8 x 8.

EDIT: Just remember that this solution only works for simulating one key pressed at a time. Because each 4051 can only selct one input at a time.

AND ONLY FOR LOW VOLTAGE DEVICES!!!!!!!!!!

Thanks MikMo,

Sounds like a good idea. I checked the voltage on the buttons and I couldn't register any :slight_smile: So i think it will work. Will give it a go. Can you daisy chain the IC? if I need to go above 8x8?

Many thanks

Boppyer:-)

I checked the voltage on the buttons and I couldn't register any

That is not good. How did you check? Voltmeter is bad in this case oscilloscope is good.

Can you daisy chain the IC? if I need to go above 8x8?

No they are not shift registers, you have to use more devices but they won't daisy chain.

You can use a 4066 as that chip is four individual switches.

That is not good. How did you check? Voltmeter is bad in this case oscilloscope is good.

I checked with a voltmeter, I can't afford a oscilloscope :-p

You can use a 4066 as that chip is four individual switches.

When you say four individual switches? does that mean 4 x 8 ? Sorry for the questions.

Many thanks

When you say four individual switches? does that mean 4 x 8 ?

It means individual switches. You can use as many of these ICs as you like. Like you showed as buttons on your original diagram. It allows you to control each button with a separate aruino output.
Without an oscilloscope you have little chance of seeing what your hacked unit is actually doing and how it is responding to your forced signals.

Without an oscilloscope you have little chance of seeing what your hacked unit is actually doing and how it is responding to your forced signals.

The input buttons I'm trying to simulate are actually buttons on an old electronic typewriter, there's nothing else connected to it so I think it should work :slight_smile: Will get some 4051's and give it a go.

many thanks :slight_smile:

you could make a 16 x 16 matrix by using 4067 IC's instrad of the 4051's, this would just need a couple of extra Arduino digital pins to control them.

Hi,

I've got my 4051 chips in the post so going to give it a go. I've sketched up a schematic, do you think this will work even though each circuit is completely separate. i.e. I only want to simulate making a connection with a wire as in my original diagram?

Thanks in advance

Boppyer

Looks ok, just remember that both pins 6, 7 and 8 of the 4051's should be connected to ground.

Do you have the facility to make PCB's ?

I (think i) have a PCB layout for exactly what you are doing.
I made a small board with two 4051's to control the switches of a circuit bend toy.

It's just a primitive board, no Eagle files or all that stuff.

cool, will give it a go and let you know how I get on. I haven't made my own PCB yet (well a proper one, not using peg board) and was going to maybe use this as my first. I might take you up on your offer it fails though :slight_smile:

Also one thing, because I'm trying to trigger a separate device, should I join up both 4051's with PIN 3 instead of making one go to V and the other to GND? Thus maing it's own closed circuit?

cheers

boppyer:-)

I wonder - did you have success with this approach? I'm also planning to interface to an electric typewriter like these guys: TwypeWriter Brain | The Brain of our Twitter Monitoring Type… | Flickr and was researching about the ways how to simulate a keyboard matrix.

I've found a similar method (inlcuding a diagram) in this german site where they use two 4051 to simulate a mobile phone keyboard: Wilke Technology - 404

Hello,

I made some progress but am still not sure about my circuit. I'm struggling, I've created a 8x8 matrix but how would I trigger 0 and 0 of each chip? In the spec sheet I would have to pull the buttons down all the 6 PINS down to LOW but this would mean that they would trigger constantly?. I can successfully trigger other combination's. (tested with a multimeter)

Is my wiring wrong? I can't seem to get it to work for triggering channel 0 on both chips.

Basically I'm just trying to simulate a key press on a typewriter. I just can't seem to get this last bit working :frowning:

Any help much appreciated. Thanks in advance

Cheers

Boppyer

If I were doing this, I would make a haunted typewriter. If only they were commonly used today. You could have it print at random times "they are coming" or something like that.

that's what it's going to do when it's in screen saver mode :slight_smile: Ghost in the machine :slight_smile:

This was the final circuit I used to get it all to work :slight_smile:

This circuit can control a 8x8 matrix of buttons. You have to write PIN 9 to HIGH continuously then write it LOW when you write to PINS 2,3,4,5,6,7. You then take PIN 9 HIGH again after. Hope it helps anyone wanting to control a load of buttons like an old keyboard

Code to follow