Electronic – isolated input circuit to check regular switch or photo-transistor

opto-isolatoroptoelectronicsphototransistor

I am trying to develop a circuit that is compatible with a regular switch (push, reed, other) and also a phototransistor. The application is pinball, where there are any number of switches and IR emitter/receiver pairs. I want to be able to connect either (maybe an eddy current switch too, but I know this would need an extra board) right into the same input lines. I ALSO want to keep it optically isolated.

The receiver is a phototransistors, so I can drive to ground similar to the IC opto-isolator. The problem I have is trying to bias the optoisolator at 1.2V and 20mA when off, and the switch-phototransistor at .4V and 2mA when on.

Schematic with photo-transistor and normal switch options:

enter image description here

Is there something special I am missing in order to bias the phototransistor AND drive the opto-isolator LED from the same pull-up?

UPDATE:

I don't think using the same pullup is possible. I'm just not that lucky. So I've come up with a way to do this with the addition of an FET to sink the LED when the switch circuit is closed. Resistors should have things biased/current limited correctly. I think I could swing this with a BJT as well. Does anyone have any thoughts on this?

enter image description here

Best Answer

I think you missed that optically coupled elements are potential free therefore you can place them in any arm of the corresponding series within the circuit (from vcc to gnd in your case) consructing the logic behavior you want. For buttons (switches) the same is actual.

enter image description here

As you can see at the picture above, it is possible to use the same schematic to control both switch or photo transistor.