Im sure that will work. Make sure you connect it correctly, and if it doesnt work, try a smaller resistor. (You can add another 150 ohm resistor in parallel with that 150 ohm one to make total resistance 75 ohms.)
On the test led side, Im not sure I understand what you are doing. You can connect the opto to the led, but you will need a power source and appropriate resistor for that led.
You say replace led with coin switch? im not sure that will work. you might try putting the led in one wire going between the opto and the coin switch. (In series).
I dont think you will need a dropping resistor for that led if you do it that way, still not sure if your arcade board will have enough current to light the led.
No matter what you do, you still need the resistor between the opto and the RPi.
Think of the opto isolator as a fence between the RPi and the arcade board. Each side of the fence dont care what the other side is doing. As long as the arcade board gets its signal through the fence to do what it is supposed to do.
And in this case, that signal is light, even though the light is inside that chip and you cant see it.
You need a diagram showing how I would hook this up for testing?
I would love a diagram thanks!
I'll try and clear up what I mean. Because I do not have any arcade cabs yet I can't test if my python code works so I thought can I use an LED after the opto isolator and then when I send a signal out form the GPIO header to the opto, the LED would light up? I then realised that I would need to power the led. Oh that reminds me, does the opto isolator get it's power from the GPIO signal out and ground pins (my ignorance shining bright here)? And if so, why can't the LED also?
The diagram was confusing me as there's no switch between the pi and the jamma harness. But then I bought a cheap coin acceptor and noticed that it has a switch on it that can be set to NC or NO so it looks as though I need a relay switch after all (I'm now assuming that it what you are referring to on your diagram?)
Annnnnd, looking at the pin layout of jamma, there are two wires, coin A and coin B. At first I thought one was for the signal and the other was ground but now I'm thinking its for two separate coin acceptors for player 1 and player 2? If that's the case then this would mean I need to double up on my set up for each 2 player machine right? ARGHHHH
Sorry for all the questions, all your answers are helping me understand much more clearly!
No problem about the questions, thats what we are here for, to help each other all we can.
I dont think you will need a relay, the opto isolator should just take the place of the coin switch and wire the same as it would have, to the arcade board.
But, if it dont work, you could try having the optoisolator turn on a relay. But that opens up more variables.
relay coil cannot draw over 50 ma, and it will need a diode across the coil leads to protect the opto isolator transistor from CEMF generated by the relay coil.
Why dont you try just opto isolator and if that wont work we can look at adding a relay.
Yes, those wires go to a coin switch each, the other sides of the switches probably connect to ground or common on the board.
You have to decide if you want Player 1 AND Player 2 coin inputs, and if you do, yes, you will need to double the circuit.
If you use relays, this can get expensive if you have a bunch of machines, so hopefully just the simple circuit using the opto isolators will work for you.
I posted a quick and dirty diagram on last post. Let us know how this project is going. Very interesting.