I have a circuit below, which is the internal circuit of a device that I'm interfacing with via a an ethernet port that is separate from the rest of this discussion. Via the ethernet port, I can see whether the gate from DI0 and DI COM is open or closed. I need to open and close the gate between DI0 and DI COM with a photo interrupter. Unfortunately I don't know the voltage or the circuit to the right of the screw terminals. EDIT: Measuring the voltage from DI COM to DI 0 without anything connected, I see a reading of about 6.6v. The input supply to this device is about 12v, so the resistor in this circuit may be dropping it from 12 to 6.6, we might can hypothesize the load on that circuit that way?

circuit b

My photo interrupter has 3 pins: 5v, GND, OUT. When the IR beam is interrupted, I get 5v on the OUT pin.

I tried connecting the OUT pin to the base of a TIP120 Transistor, separated by a 2k resistor. To this same transistor, I tied ground to the emitter. To the collector of the TIP120, I tied the base of a TIP42G transistor, separated by a 2k resistor.

I tied the emitter of the TIP42G to the DI COM pin, and the collector to the DI0 pin.

I would expect that when the IR beam is interrupted, the gate would close between DI0 and DI COM. When the IR beam is uninterrupted, the gate would be open. (Maybe I have that backwards?) However, when I check the device, it reports the gate is closed no matter what.

I have tested the function of the device by manually connecting and disconnecting DI0 and DI COM.

Here's my circuit (note, I don't have access to anything to the right of DI0/COM): my circuit

What am I doing wrong? I'm in quite a bit over my head.

  • \$\begingroup\$ the loop on the right side does not share a ground with the rest of the circuit ... the battery appears to be reversed \$\endgroup\$
    – jsotola
    Commented Aug 21, 2019 at 5:26
  • 1
    \$\begingroup\$ "I need to open and close the gate between DI0 and DI COM" - your picture shows a switch wired between DI0 and DI COM. You have ascertained that the open-circuit voltage is 6.6V. now you need know how much current the switch has to pass when closed. Set your multimeter to eg. 200mA and put it across the terminals. How much current do you measure? \$\endgroup\$ Commented Aug 21, 2019 at 7:08
  • \$\begingroup\$ @BruceAbbott I am trying to create that switch. When setting my multimeter to 200ma and measuring between DI COM and DI0, the meter reads 3.0 I'm not sure what to do with that info? \$\endgroup\$ Commented Aug 21, 2019 at 13:28
  • \$\begingroup\$ @jsotola You are correct. I verified with multimeter by putting positive on DI COM and negative on the ground to the left, there is no voltage. I thought the ground would be shared, because the circuit on the left shares a ground with the power supply of the device containing the circuit on the right. Can I switch this circuit without a common ground? \$\endgroup\$ Commented Aug 21, 2019 at 13:31
  • \$\begingroup\$ @SunnyskyguyEE75 I'm not sure I follow. Do you have a link with more info? You mention BE needs shunt collector leakage, but which transistor are you referring to? Both? How do I do this? \$\endgroup\$ Commented Aug 21, 2019 at 13:32

1 Answer 1


Your switch needs to pass at least 3mA when closed and withstand 6.6V when open, and its output needs to be isolated from Ground. The obvious choice is an optocoupler.

Depending on how much output current the photo-interrupter can provide, you might get away with just a sensitive optocoupler or you might need another transistor to drive it. Using a driver transistor the circuit could look like this:-


simulate this circuit – Schematic created using CircuitLab

In this configuration the optocoupler is turned on when the beam is interrupted. Since the 4N25 can have a CTR (Current Transfer Ratio) of as little as 20%, R4 is sized to put ~16mA through the optocoupler LED.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.