Go Down

Topic: Controlling a series of switches of another 5V system from Arduino (Read 1 time) previous topic - next topic

podstawek

Hi all,

My first steps with Arduino and electronics in general, so please excuse me if this is obvious.

I have a system which has a multi-pin control port normally connected to ordinary hardware push buttons: connecting 5V pin of that port to this or that other pin causes the device to do something.

Now, instead of those ordinary push buttons, I want to use Arduino to short the 5V and some other pins for me.

Normally for a single "permanent" switch, e.g. to switch a 220V lamp on/off, I would do it with a relay which isolates 2 circuits. But for this application, I want to short the pins momentarily only, and there are many pins too. Do I use some kind of relay equivalent (I understand that the 5V circuits of both systems -- Arduino and the other one) need to remain separated.

Please advise on the best practice on how to go about this.

Thank you!

MAS3

Hi and welcome.

You can do what you want to do with relays.
To do so, you could consider getting one of those relay modules.
They come in different numbers of relays (mostly up to 8 on a board).
That would be the fastest, and probably the cheapest way.

If you really need to control a large number of switches, you could use 'port expanders' like the '595  chip.
As you mentioned you need to separate the 5 volts levels (do you really need to do that ?), you would connect an opto coupler to each output, which would mean serious higher costs, and probably you'd have to design your own PCB.

You could also consider to do the opto coupler thing at the input side of the '595, reducing the number of opto couplers to a few.
But i don't know if the application you have in mind, is able to power some external electronics (those '595s and their accompanying parts).
Yes, you will need some more parts beyond what i've mentioned.

To select the right opto couplers and so on, you need to find out some more about the signals you want to hack.
You mentioned 5 volts, but you need to find out more than that.
Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

podstawek

MAS3, thank you for responding!

I have described my project in a more detail in another forum, but in short:

I want to emulate an 8x8 keyboard matrix of Commodore 64. In that other forum, I asked more about the logistics of the approach, here I was more curious about the actual switching of individual buttons. But in the hindsight I should have asked about all that in one posting :)

Anyway, I got some good pointers already, and the other guys enlightened me that the workings of a keyboard matrix aren't actually that straightforward. However, in the end, despite the matrix layout, aren't keys just simple push buttons? I have a hunch that this can be achieved using simplistic approach:

1. Simulate 16 physical buttons using relays or similar solution (this is what my question in this forum was specifically about. Since I asked the question, I found information about the 4066 quad bilateral switch. Can I simply use 4 of these?)

2. When I want to simulate the press of a single key, for example "A" as per the pin layout:
 
  • Switch first relay switch (Pin 10) on
  • Switch second relay switch (Pin 19) on
  • Switch all switches switch off


3. When I want to simulate the press of a combination of keys, for example "Ctrl+A":
 
  • Switch first relay switch (Pin 10) on
  • Switch second relays switch (Pin 13) on
  • Switch third relay switch (Pin 10) on (if on -- it remains switched on)
  • Switch fourth relays switch (Pin 19) on
  • Switch all switches switch off


Let me know what you think.

TomGeorge

Hi,
Quote
I have a system which has a multi-pin control port normally connected to ordinary hardware push buttons: connecting 5V pin of that port to this or that other pin causes the device to do something.
why didn't you say.

Quote
I want to emulate keyboard presses in an old C64 microcomputer using an Arduino.
And show;

These matrix keyboards are scanned by the commodore cpu, so you cannot just pull a row or column HIGH or LOW.
A switch for each button,  4 x 4066 will do the job, then use the arduino to control the 4066.
Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

TomGeorge

Hi,
Quote
2. When I want to simulate the press of a single key, for example "A":
 



3. When I want to simulate the press of a combination of keys, for example "Ctrl+A":
 
Sorry no,my mistake, you will need a switch for each button you are replacing.

So 8x8 = 64 switches
64/4= 16 x 4066 ICs

The each switch in the 4066 is to be wired in place of each button.

Tom.... :)
Everything runs on smoke, let the smoke out, it stops running....

podstawek

Thank you TomGeorge!

(The reason I didn't plainly say what the project was about, was to focus in this particular thread on the subject of actual switching electronics instead of switching <i>logic</i> -- but you are right, I should have put everything in one posting.)


Are you sure about the need to emulate 64 buttons?

Pressing one physical Commodore button results in shortening 2 switches as I wrote, e.g. 5V + Pin 10 and 5V + Pin 19.

So I actually have 16 physical switches, and achieve the 64 combinations (talking about 1-key presses now) programmatically from within Arduino, right? So that would leave me with four 4066 chips.

TomGeorge

Hi,
How many buttons have you got?
8 x 8 = 64.
each switch will connect its relative column and row together.
Button W, will connect column B to Row 1, that is pin 19 to pin 11.

You cannot pull these pins HIGH or LOW, the commodore scans say the column pins, one at a time, by putting 5V on the one of the column pins at a time in sequence.

It reads the rows looking for rows that are at 5V, when it finds them, it knows which button has been pressed by relating it to the column that it has 5V connected to.

This may help.

http://pcbheaven.com/wikipages/How_Key_Matrices_Works/

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

podstawek

Thank you TomGeorge!

In this case I'll have to rethink the approach; sixteen 4066 chips is not feasible, and both systems (Arduino and Commodore) don't share the common ground / 5V, so I can't control the pins directly.

More reading and learning before I start then... :)

Thanks again.

podstawek

allanhurst

You could use a larger arduino with plenty of io to do it - read the scan on 8 inputs ( High or low?), and drive to the senses with  8 outputs - this presumes it's all 5v stuff of course...

regards

Allan

podstawek

Allan, thanks for responding, but could you clarify what you mean, in particular " and drive to the senses with  8 outputs"?

Both systems, Arduino and Commodore, are 5V, but these are separate circuits with no common ground.

allanhurst

Well, the commodore will drive each of it's 'row' lines succesively either high or low ( I'd do it low).

I don't know which - find out or measure it with a scope.

Once you know which way, ( say all high except the selected one) .  Drive the outputs of the arduino all high until the scan gets to the row on which the switch you want to simulate is made.  Now drive the output of the arduino on the appropriate 'column' low so at to simulate that switch closure....

regards

Allan

MAS3

Hi.

The keys of a Commodore 64 consist of a conducting rubber like substance which connects 2 contacts on a PCB when the button is pushed.
That rubber like substance degrades with age, and my commodore 64 is now 32 years old..
I'm interested in this, and will keep an eye on this thread.
I don't want to destroy the original keyboard, but if i could put an alternative in parallel with it, i would.

Just need some more time to get around to these things..
Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

allanhurst

You could always replace the worn-out conductive coating with conductive paint - car accessory shops sell it for repaiiring screen heater elements...

regards

Allan

TomGeorge

Hi,
Use super glue and stick aluminium foil over the conductive rubber pads.

Perfect conduction...

Have you cleaned the copper pads and brushed the conductive pads with iso-propyl alcohol or methylated spirits.

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

podstawek

To update everyone on the progress:

I have now confirmed that simply joining the appropriate pins enables me to write on the screen, including key combinations:

Shorting pins 9+19 and 12+20 gives me the expected "!" on the screen (normally Shift+1).

This brings me to conclusion that I  don't really have to care about how Commodore scans the keyboard matrix (regardless of how ingenuine the concept of reading keyboard matrices is!) -- for my project, it is a matter of switching individual 64 buttons on and off.

Now, to my next question: instead of using a bunch of 4066s, what would you think of simply mapping the 8x8 Commodore pins to the following 8x8 switch IC? Then programming the chip from Arduino to do actual switching.

http://www.microsemi.com/document-portal/doc_view/127034-mt8809-datasheet-sept11




Go Up