Array of optoisolators?

Hello! I'm new to the Arduino and to physical computing in general, though I'm pretty comfortable with soldering LEDs to sequencer chips; and I'm not that worried about the programming if I can get the hardware to work. After following instructions for the LED cube, and getting most of the demos to work, I've played with the blinkm, an accelerometer, sonar sensor, 75HC595, etc.

I'd like to interface into a number of different "black box" devices that don't have standard interface ports; I'd just like to be able to bypass the buttons; for example I've got several toy musical keyboards, etc. These don't have the same voltage as the Arduino (or each other), so I'd like to keep them physically separate but just be able to signal their buttons. In the case of the keyboards, it's easier and more difficult because they're matrix switches - 5x8 so 13 switches can signal 40 different notes, but I have to activate two switches at a time. I may also have this plugged into more than one "black-box" device at a time, say, multiple keyboards or keyboards plus children's toys plus smart greeting cards or whatever.

Looks like opto-isolators are the weapon of choice for this. I've got a few 1-channels, and a few 4-channels, and I've gotten them to work blipping LEDs and triggering keys, but...

-(obligatory am-i-doing-this-all-wrong question) Is there some other sort of switch I should be using for this? Relays and reed switches definitely seem like overkill; I was wondering if I could go in the other direction since the voltages are so low and use some simpler chip; I could probably even common-ground the devices if that would help.

-I've been running the input side directly from the arduino digital ports. Should I be using a resistor? I know I need a resistor with an LED, and the oi is just an led on a chip... I may also be putting an led (or a matrix of them!) in-line just for fun to blink when the switch gets hit.

-Is there such a thing as a 16-channel (or more) opto-isolator? Seems like 4 is the highest they go. The cost isn't too bad at $1.50-$2.00 apiece but they take up a lot of board space.

-Really what I'd like is a driver (like a MAX7219 if I could find one; I'm using 74HC595 at the moment) combined with an array of external switches, such that I could drive any combination of switches; 32 or 64 switches would be optimal. Otherwise I'll be building one of these that I can swap from device to device as I experiment.

-(finally) I'm still looking for clever ways to trigger the "frankenkeyboard" - array switches or sensors. I'm considering things like hammer-activated metal plate swiches, Theremin-style sensors, motion/range sensors, etc. So if you've read this far and can think of any "you've got to try this" switches or sensors, I'd love to hear suggestions!

Thanks in advance!

You could have a look at the 4016/4046 quad bi-lateral switch: Intelligent Power and Sensing Technologies | onsemi

you may be able to use them for the multiplxed keyboard switches. If money is not an issue - you could look at the analogue crosspoint switches - I used an Analouge Devices chip some years ago 16x16 array of analoue switches controlled using serial data. They weren't cheap and were tricky to source.

As for hammer-activated metal plate switches - piezo discs might help:

Mike

I am planning a project where i wil try to do something similar.

I want to control a circuit bend toy with a switch matrix (7 rows by 6 coloumns), i have a few ideas, but i'm waiting for some components i ordred to arrive before i can test it.

The general idea is to try to control the switch matrix with two 4051 analog multiplexors one for the rows and one for the columns.

In theory this should work, but in real life there might be to much resistance in the two 4051's to actually "switch the switches". In many matrix setups (especially keyboards) there's a diode on each keyboard switch, and this might be problematic as well. Hopefully i wil know more in a weeks time or so.

MikMo

(bump update)

I've managed to get this working, and it seems to be fairly useful, so I thought I'd share.

For each "module" I used a single 74HC595 and a pair of PS-2501-4; I can control 8 switches with 5 lines (ground, power, gate, latch, data) from the Arduino.

I'm using code from http://www.arduino.cc/en/Tutorial/ShiftOut to drive the 74HC595.

The output pins drive the PS-2501-4 optoiosolators; common ground on the input side, 16 pins out to another card with device-specific wiring on the output side. With the output side of that I should be able to drive an bunch of pretty much any sort of switch. My test case is a musical keyboard with a matrix switch - 5x8.

If I then pass ground, power, gate, latch from the arduino and data out from the 74HC595 to another duplicate circuit, I can get 16 outputs from the same 5 inputs; I believe this can be extended with more "modules".

Right now this is soldered onto breadboards with lots of cross-wiring; eventually I'd like to learn how to etch circuit boards but I haven't gotten there yet (I still don't understand how to optimize the wiring to design a board with a minimum of cross-overs). Actually if this worked and were correct I'd sort of like to have a bunch of them made up SMD in China or something. I know it's something that's useful to me (I like to be able to pull the buttons/keyboards off devices and drive them from the Arduino without having to reverse engineer the entire device).

I'm not certain that I should be driving the 2501 directly from the 595 - I know there's an LED inside there, so it seems as if I should be resisting, but I'm not; maybe it's fine or maybe I'm burning the optos; I know I should be able to determine from the datasheet, but I'm not grokking it.

I'd also like to add indicator LEDs to each of the 595 output pins (with a switch that turns them on and off). Should be easy enough if the 595 is providing enough volt/amp out.

If anyone has any suggestions I'd appreciate the feedback. Wiring diagrams and pictures if I can remember to post them tonight.

(bump update)

Oops, I wasn't using resistors between the 595 and the 2501s. I don't think I burned them up, but the tops of the chips seem to have some scarring!

I now have a module wired up as described, with LEDs on each channel, and I put the chips into sockets.

I have a bunch more chips and sockets on order from Mouser.

Am now researching PCB fabrication. PBC123.com seems interesting; pretty steep prices for prototypes, but the prices drop when you order 10 or more. It seems it'll also let me create a clean circuit diagram, which I'll try to accomplish and post tonight.

Anyone else interested in some of these boards if I get them working? Should be useful for controlling external devices that have a lot of simple switches.


Version .02, original version, 2x595, ~4x2501 = 16 channels, with channel wires jumping over the 595s


Version .1 with resistors, LEDs, sockets and a bunch of scavenged optoisolators (wiring for the channels is underneath the board). This has the input header, needs output header at the bottom so they can be chained. Probably 2x the resistors I need, since they're the same value.


Version .1 wired to Arduino, with driven test board on top

HEF4794 can drive more current than the 595, with the correct wiring your program does not have to change. I was driving an LED and an SSR.

Yes use the resistors, at some point you'll damage parts.

I don't know the max limits of daisychaining the 595 ICs but you will eventually get to the point that clocking out data takes excessive time. Another annoyance is that they like to do what ever the hell they want at power up.

I think I need a reset circuit or IC to combat this. In some of the circuits I'm designing the outputs CANNOT be high until other setups happen and the microcontroller is in full control.

HEF4794 can drive more current than the 595, with the correct wiring your program does not have to change. I was driving an LED and an SSR.

Yes use the resistors, at some point you'll damage parts.

I don't know the max limits of daisychaining the 595 ICs but you will eventually get to the point that clocking out data takes excessive time. Another annoyance is that they like to do what ever the hell they want at power up.

I think I need a reset circuit or IC to combat this. In some of the circuits I'm designing the outputs CANNOT be high until other setups happen and the microcontroller is in full control.

595's are fine, I've never noticed any signs of "IC individuality" at power-up.

I played with them, "a lot", here:-

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1185507207

It would take many hundred's of daisy-chained 595's before "clocking-out-data" ever became an issue.

This post in particular:-

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1185507207/45#45

Details the code required to only "ever" have 8 LED's on at one time, while giving the illusion that all other LED's daisy-chained via 595's, are on at the same time also.

I got up to 10 x 595's, then ran out of IC's (and time) - powering 80 high intensity LEDs via 595's in this manner resulted in no blow-outs, or latency.

I've got another project on the table that requires 15 595's, so when that's completed I'll post pictures as well as the code.

595's are fine, I've never noticed any signs of "IC individuality" at power-up.

I played with them, "a lot", here:-

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1185507207

It would take many hundred's of daisy-chained 595's before "clocking-out-data" ever became an issue.

This post in particular:-

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1185507207/45#45

Details the code required to only "ever" have 8 LED's on at one time, while giving the illusion that all other LED's daisy-chained via 595's, are on at the same time also.

I got up to 10 x 595's, then ran out of IC's (and time) - powering 80 high intensity LEDs via 595's in this manner resulted in no blow-outs, or latency.

I've got another project on the table that requires 15 595's, so when that's completed I'll post pictures as well as the code.

I thought there was more of a limit on the 595 but it's good that 10+ can be used as I'll need them.

I'm testing the 595 with a knight rider circuit as a test. If I reset it the 595's will retain what ever state they're in. That is bad for me. I should be able to catch a reset and toggle the right pin to make sure the outputs are off. I've had both the 595's and hef chips give what every out put they want when power is applied to the arduino. It's totally random. With the reset circuit(s) I should be able to force the chips to a known state till the arduino takes control.

I'll look forward to your post!