Problem Interfacing Digital Output to Optocoupler

Discussion in 'The Projects Forum' started by moocrow, Oct 24, 2013.

  1. moocrow

    Thread Starter New Member

    Apr 3, 2011

    I have two sensors, a 5V IR detector and a 5V photo-interrupter, which I want to use to driver an optocoupler. The purpose is to translate the high/low state of the output to 3.3V. As it happens, it also inverts the state but that is not essential to my project. Both sides of the circuit have a common earth and are ultimately powered from the same source.

    I have connected the 5V output of the IR sensor to the optocoupler anode via a 680Ω resistor, with the cathode connected to ground. The collector is connected to the output pin and to 3.3V via a 10K pull-up resistor. The emitter is connected to ground.

    So, when the IR sensor output goes high, current flows to the optocoupler which connects the output pin on the other side to ground. It drops from 3.3V to 0V.

    With exactly the same setup, using a photo-interrupter instead of the IR sensor, I get a different result. When the output goes high, it goes to only approx. 1.2V. The voltage on the other side of the resistor, at the anode, is almost the same. When I disconnect the output from the circuit, it goes to 5V when high as expected. Changing the resistor doesn't seem to matter much. E.g. a 680Ω resistor results in only a change of 0.1V.

    So I have two 5V digital outputs which behave very differently under the same conditions. Clearly the optocoupler is not getting enough current at the anode but I don't know how to calculate the correct size resistor.



    Optocoupler, ACPL 8x:,d.d2k


    IR Sensor:
    Last edited: Oct 24, 2013
  2. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    Not surprising. The interrupter has an internal 15k pull-up resistor which is limiting the diode current. Try connecting the 680 Ohm resistor between the +5V rail and the diode anode, and connect the interrupter output pin to the diode anode too.

    Edit: Like this
    Last edited: Oct 24, 2013
  3. moocrow

    Thread Starter New Member

    Apr 3, 2011
    Thank you! Having a schematic to work to is really helpful. I'll try this and post the results.