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:
Is there something special I am missing in order to bias the phototransistor AND drive the opto-isolator LED from the same pull-up?
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?