(Topic ID: 137600)

Can an opto-isolator be introduced into a switch matrix?

By winteriscoming

8 years ago


Topic Heartbeat

Topic Stats

You

Linked Games

No games have been linked to this topic.

    #1 8 years ago

    I'm interested in intercepting switch signals with a microcontroller or similar for modding purposes. I've done some projects with microcontrollers, but have never used an opto-isolator. Could an opto-isolator be integrated onto an existing switch in a switch matrix for the purposes of intercepting a switch hit? I guess it would be a matter of whether or not the switch matrix is outputting enough power to activate the opto.

    There would also be an issue of the constant strobing of matrix, potentially making a closed switch look like a lot of open and close events, but that could maybe be handled with a debounce setting in the microcontroller.

    I may just go ahead and order some and experiment, but wondered if anyone knew for sure if it could work or maybe if someone has a better way of reading switches from the game's matrix with a separate circuit.

    What would the ideal way to wire them in be? Would it be a matter of wiring the LED side of the opto-isolator in parallel with (or in place of) the existing diode that's wired into the switch?

    The more basic solution is, of course, adding a 2nd switch that gets activated at the same time as the game's switch, but mounting 2nd switches seems like it will be a huge pain if I want to have a lot of them.

    Any advice from those more technically savvy than me is appreciated.

    Thanks!

    #3 8 years ago

    Just plug in the retromagnetical power flux inverter into the hypercom fantabulator as a go around to your problem. That worked for me.

    #4 8 years ago
    Quoted from winteriscoming:

    I may just go ahead and order some and experiment, but wondered if anyone knew for sure if it could work or maybe if someone has a better way of reading switches from the game's matrix with a separate circuit.

    Go for it!

    Reading one switch isn't too bad, you don't have to use an opto isolator, but that would work to isolate the circuit. A debounce would probably do the trick to read an accurate switch hit.

    The problem comes when you are reading ALL the switches on the switch matrix accurately. I haven't solved that one yet either... yet.

    -Wes

    #5 8 years ago
    Quoted from copperpot:

    Go for it!
    Reading one switch isn't too bad, you don't have to use an opto isolator, but that would work to isolate the circuit. A debounce would probably do the trick to read an accurate switch hit.
    The problem comes when you are reading ALL the switches on the switch matrix accurately. I haven't solved that one yet either... yet.
    -Wes

    This guy knows what he is talking about.

    #6 8 years ago
    Quoted from copperpot:

    Go for it!
    Reading one switch isn't too bad, you don't have to use an opto isolator, but that would work to isolate the circuit. A debounce would probably do the trick to read an accurate switch hit.
    The problem comes when you are reading ALL the switches on the switch matrix accurately. I haven't solved that one yet either... yet.
    -Wes

    I put a small LED across the diode of a closed switch in the game and it lights. That's promising. I guess the next test would be to figure out if that's enough to trigger an opto-isolator.

    I would think if an opto-isolator can work for one, it should be possible to make it work for multiple if you had a microcontroller with enough input pins and devote one opto-isolator to one input.

    The risk may be over taxing the matrix if there were too many closed switches at once, thus having a lot of LEDs to light simultaneously. Though with the strobing, it actually wouldn't be lighting that many at once...

    In my particular case, I think there could only be about 7 switches closed simultaneously, due to down drop targets.

    Ultimately what I want to do is interpret specific switches and do something like drive a WAV Trigger for sounds via serial commands and maybe some custom servo driven toys.

    I'll check that out. Thanks!

    Edit: the switch shield seems like it will be a lot more limited than I want. It looks like it's limited to 6 switches. I'm going to want to read more than that.

    #7 8 years ago

    I figured out how to read individual switches with an Arduino and have it written up in this guide: https://pinside.com/pinball/forum/topic/diy-time-your-balls

    But, it wont't scale well for many switches. You'll want to intercept the switch matrix signals, which gets difficult due to either timing your sensor to be synced with their strobe, or caching the signals and reading them asynchronously. In the end, the SwitchShield is the right way to do it for a handful of switches, and get two if you need to do up to twelve. Otherwise, be prepared for some fun R&D (great way to learn.). There are some great folks on here that will help you with your questions.

    #8 8 years ago

    One other thing you can on is add a second set of switches on what you want to monitor and read that directly with an arduino.

    #9 8 years ago
    Quoted from winteriscoming:

    The more basic solution is, of course, adding a 2nd switch that gets activated at the same time as the game's switch, but mounting 2nd switches seems like it will be a huge pain if I want to have a lot of them.

    Quoted from lyonsden:

    One other thing you can on is add a second set of switches on what you want to monitor and read that directly with an arduino.


    May be the way I go if other stuff doesn't work out.

    #10 8 years ago

    The Matrix Interceptor I have built to drive Total Lightshow reads all switches and all lamps. I haven't decided on selling it separately yet as I haven't figured out how to supply it with a user friendly interface for non C++ programmers. If you can use Atmel studio then I can supply you with a Matrix Interceptor board complete with low level drivers that will supply you with any switch on/off and any insert on/off/flashing.

    #11 8 years ago
    Quoted from TimeBandit:

    The Matrix Interceptor I have built to drive Total Lightshow reads all switches and all lamps. I haven't decided on selling it separately yet as I haven't figured out how to supply it with a user friendly interface for non C++ programmers. If you can use Atmel studio then I can supply you with a Matrix Interceptor board complete with low level drivers that will supply you with any switch on/off and any insert on/off/flashing.

    For the record, I'm modding a classic Stern. Is it compatible? Since the lamps aren't a matrix, I'm guessing your board wouldn't be compatible with that part?

    #12 8 years ago
    Quoted from winteriscoming:

    For the record, I'm modding a classic Stern. Is it compatible? Since the lamps aren't a matrix, I'm guessing your board wouldn't be compatible with that part?

    No, it's not in a generic universal matrix form yet. So won't be compatible in the current incarnation.

    #13 8 years ago

    Point of fact... when I was doing ST:MU... I hooked a BJT transistor across the switch matrix for the eddy switches... it was a dismal failure on my Bally CPU board... gave me all kinds of switch issues.

    I ended up retrofitting a reed relay across onto the PCBs... just so I could get a stable switch matrix.

    I'd say; good luck... but expect problems.

    ---nm--- I re-read and see that your trying to DETECT switches; not create switches.

    #14 8 years ago
    Quoted from TimeBandit:

    The Matrix Interceptor I have built to drive Total Lightshow reads all switches and all lamps. I haven't decided on selling it separately yet as I haven't figured out how to supply it with a user friendly interface for non C++ programmers. If you can use Atmel studio then I can supply you with a Matrix Interceptor board complete with low level drivers that will supply you with any switch on/off and any insert on/off/flashing.

    I'd definitely be interested if you release your Matrix Interceptor!

    #15 8 years ago
    Quoted from winteriscoming:

    May be the way I go if other stuff doesn't work out.

    Ha! Great minds think alike.

    #16 8 years ago

    I think I'm just going to go the 2nd switch route. I'm ordering some nylon rods and longer screws from McMaster Carr and I'll make up some double stacked leaf switches.

    It will end up being a lot cheaper and besides the cheap parts I need to make the double stacked switches, I have everything else on hand.

    I was wracking my brain trying to figure out a suitable plastic from something I could find locally that could be used to modify switches to have nubs on them for drop targets and kickout holes and such, but could never come up with anything. McMaster Carr sells nylon rods in various diameters that should work great and they're cheap. Item # 8538K13 is a good example. I ordered 10ft for less than $4, so I'll have plenty to experiment with (maybe a lifetime supply ). I'll be able to attach them to the switches by drilling a tiny hole in the switch and use a tiny, self tapping screw that's about a millimeter wide.

    Even if opto-isolators worked, either method would require a lot of extra wiring. The stacked switches will be a challenge in a couple situations, but I've got ideas on making it work. Mostly if a stacked switch isn't as feasible, like for a slingshot switch, it should be possible to mount a switch that will be triggered by the coil/plunger arm, etc.

    #17 8 years ago

    I recently tried to reach out to Ben Heck. I thought a circuit sniffing episode would help out everyone that was scratching there head on the easy vs hard ways. Maybe the software vs the hardware ways. Or the right vs the wrong ways.
    Lots of guys come up with creative beautiful ideas but never bridge the gap which is unfortunate.

    If you are just monitoring say one or two lamps on Stern you could probably use an analog input pin and hook up to middle of voltage divider that is across the lamp. Use the reading of voltage to your advantage.
    Ie if count 700 or higher do x if lower or else do y.
    That would cost two resistors. Not buying shields that only need one or two signals monitored.

    #18 8 years ago

    Another approach might be to use your Opto-isolator/coupler in the opposite way as you might have been thinking. Instead of expecting the Switch Matrix power to drive the LED in the coupler, why not drive the LED in the optocoupler and whatever you are planning to add with the single mechanical switch, and then use the transistor output (collector - emitter) of the optocoupler to simulate the switch and diode that would normally appear in the matrix.

    #19 8 years ago
    Quoted from CactusJack:

    Another approach might be to use your Opto-isolator/coupler in the opposite way as you might have been thinking. Instead of expecting the Switch Matrix power to drive the LED in the coupler, why not drive the LED in the optocoupler and whatever you are planning to add with the single mechanical switch, and then use the transistor output (collector - emitter) of the optocoupler to simulate the switch and diode that would normally appear in the matrix.

    I think what you're suggesting is just to have my microcontroller sense the switch, do what it wants and relay that to the opto-isolator for the game to sense a hit?

    Something like that could work, but gets into a realm of complexity where if I'm trying to sense all playfield switches, I'd need to have something more complex than I want wired up and programmed.

    I'm not sure if it would be too much of a stretch, if I were to go that route, to take it a step further and just eliminate the MPU and replace it all with a custom setup. I'm way oversimplifying the complexity of that, though. At the very least I'd have to figure out how to interface with the displays, lamp driver board and coil driver board which is also more complex than I want to get into with this project.

    Stacked switches will ultimately be the easiest route for me for now. At the moment I've got all the switches figured out except the stand up switches, which don't lend themselves to an entire new switch stacked on.

    #20 8 years ago

    No, not exactly.

    If you are using a microcontroller or similar, and you have a direct digital input, either 5 volt or even 3 volt. It would typically have a pull up resistor and then the input line would get grounded - in this case, by the leaf switch closure. But this would produce an inverted switch condition (switch open = LED on = output transistor conducting). If you use a resistor that is capable of lighting the LED of the opto coupler (typically around 10ma.), and then use the leaf switch to apply power to the LED, you get a true result (not inverted). A high value resistor (like 10K) can be used as a pull down at the microcontroller input and then you have your microcontroller input too. At the same time, Lighting the LED in the opto makes the output transistor conduct and would then look like the leaf switch and blocking diode combo. No additional software overhead in the micro.

    Using a PS2501-4 gives you 4 optos in a single 16 pin package.

    Certainly, stacking 2 switches is the simplest way to get it done.

    #21 8 years ago
    Quoted from CactusJack:

    No, not exactly.
    If you are using a microcontroller or similar, and you have a direct digital input, either 5 volt or even 3 volt. It would typically have a pull up resistor and then the input line would get grounded - in this case, by the leaf switch closure. But this would produce an inverted switch condition (switch open = LED on = output transistor conducting). If you use a resistor that is capable of lighting the LED of the opto coupler (typically around 10ma.), and then use the leaf switch to apply power to the LED, you get a true result (not inverted). A high value resistor (like 10K) can be used as a pull down at the microcontroller input and then you have your microcontroller input too. At the same time, Lighting the LED in the opto makes the output transistor conduct and would then look like the leaf switch and blocking diode combo. No additional software overhead in the micro.
    Using a PS2501-4 gives you 4 optos in a single 16 pin package.
    Certainly, stacking 2 switches is the simplest way to get it done.

    Oh, I see what you're saying. That probably would work. I may try that for some of the more difficult ones to stack. Thanks for the suggestion!

    Seems like either way I go there's going to be at least 4 wires per switch.

    #22 8 years ago

    You can read a WPC switch by putting the emitter side of the opto (IR LED) in series with the switch diode. So, two wires per switch - less if they share a common feed. The other side of the switch can directly feed a microcontroller with a weak pullup.

    This approach is extremely reliable, as the opto eliminates any electrical noise issues.

    #23 8 years ago

    Well, I think the best possible solution presented itself to me, by way of an awesome Pinsider who already designed replacement boards for Bally/Sterns to take over the games and reprogram them: https://pinside.com/pinball/forum/topic/mypinballs-custom-pinball-controller-for-ballystern-games

    Screw merely intercepting switch hits! I'll be directly taking over the brains of the game and will only have to deal with the regular single set of matrixed switches and can do whatever I want (play any sound, do whatever kind of scoring, etc) when they're sensed. I'm building a custom game, anyway, so it will be nice to be free from the ruleset of an existing game.

    Reply

    Wanna join the discussion? Please sign in to reply to this topic.

    Hey there! Welcome to Pinside!

    Donate to Pinside

    Great to see you're enjoying Pinside! Did you know Pinside is able to run without any 3rd-party banners or ads, thanks to the support from our visitors? Please consider a donation to Pinside and get anext to your username to show for it! Or better yet, subscribe to Pinside+!


    This page was printed from https://pinside.com/pinball/forum/topic/can-an-opto-isolator-be-introduced-into-a-switch-matrix and we tried optimising it for printing. Some page elements may have been deliberately hidden.

    Scan the QR code on the left to jump to the URL this document was printed from.