+-5V --> optocouple --> 0-v TTL

Discussion in 'General Electronics Chat' started by Engineerer, May 22, 2013.

  1. Engineerer

    Thread Starter New Member

    May 22, 2013
    18
    0
    Hi,

    I got a pair of wires from encoder, wire A and Wire A-. When encoder moves the voltage between wires changes state form +5V to -5V and so on.

    I'm trying to optoisolate these signals and convert them to 0...5V TTL.

    Optocoupler is HCPL2631, and signal at this point is given from signal generator.

    No matter what I do the output of the optocoupler stays at 0,28V. Paraller to led of a optocoupler I have 1N4148 to limit the reverse voltage because the led in the opto can't handle it.

    When +5V is supplied, A in higher potential than A-. I measured 10 mA current in the input, and 1,4x voltage over led in the opto. So led should be lit, and output from opto (between opto GND and pin 7) about 0V. This state seems ok.

    BUT, when I change signal to -5V, A in lower potential than A-. The output from opto won't jump to 5V, as i want, but it stays close to 0V. Over the led inte opto is -0,7V voltage because 1N4148 opens and about 10 mA current flows trough the resistor (opposite direction than in +5V direction)

    [​IMG]
    In picture higher wire is A and lower A-


    What am I doing wrong? Electronics aren't my strongest point..
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    The HCPL2631 opto-couplers have open-collector outputs.

    Install a pull-up resistor, (2kΩ to 10kΩ) between the output (pin-7) and +5V (pin-8).
     
    Engineerer likes this.
  3. Engineerer

    Thread Starter New Member

    May 22, 2013
    18
    0
    Oh my god. Thank you very much. I educated myself a little about open collector and it looks all clear now. MrChips you're a life saver! I guess it took you one second to figure out what the problem was:D I hope everything works tomorrow when I'll add resistor(s).
     
  4. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    1μs. Been there, seen it, done that!

    Glad to help.
     
  5. Engineerer

    Thread Starter New Member

    May 22, 2013
    18
    0
    Problem solved. Now it works like it should. :)
     
Loading...