# connection from an comparator to an optocoupler

I have the circuit below to decode a signal that is defined as Logic high >9.5 V and Logic low <6 V To determine the treshold, schmitt triger is used, then an optocoupler is used to isolate the receiver MCU. Here is a larger view of the first picture.

Here is the comparator's datasheet.

Here is the optocoupler's datasheet.

My problem is that the circuit above does not decode the signal, I guess I am doing something wrong on comparator's output and optocoupler's input, so that optocoupler does not output the correct signal.

Here below is the oscilloscope output of the signal before and after the optocoupler. Signal A (blue) represents the signal at the input (pin 2 of optocoupler) and Signal B (red) represents the signal at the output (pin 6 of optocoupler). At the bottom of the picture, it shows the max, min, average voltage level's of the signals: Signal A's max: 1.542V and Signal B's max is 130.5 mV.

When I measure the current on the line from comparator's output (pin 1 of comparator) to optocoupler's input (pin2 of optocoupler), I read the current value varies between 4.7 to 6.4mA (should be because of the PWM). According to the optocoupler's datasheet, 5mA should be the logic high. However, the signal does not go to logic high at the output of the optocoupler.

Here below is the oscilloscope output: signal A (blue) is the Vi (pin 2) of the comparator and Signal B (red) is the comparator output (pin 1)

An interesting output oscilloscope output is below. The Signal A (blue) represents optocoupler's input (pin 2) and the Signal B (red) represents the comparator's output. Both output are connected via a 22 awg cable, I could not understand why the signal levels are different

I would highly appreciate if anyone could tell me how to fix the circuit, so that the MCU would receive the decoded signal. Thank you in advance!

• No, both probes are set x1 – sven May 7 '13 at 11:51
• Do the two halves of the circuit share a ground? If not, how are you referencing the scope so your traces make sense? I sometimes tie the grounds together until I'm done debugging. – Scott Seidman Jul 6 '13 at 14:30

Did you consider that the LED of the optocoupler limits the voltage at the output (pin1) to its forward voltage. I.e. the voltage divider that provides the reference voltage (at pin3) is always loaded not only by the bottom resistor (500 Ohm) but also by the branch via 300 Ohm resistor and LED.

Maybe this causes the threshold to be not where you think it is.

I recommend to connect the cathode of the LED to the ouput of the comparator (it's open drain anyway), connect the diode's anode via a restor to Vcc and reverse positive and negative inputs of the comparator.

It's a big read and I hope I understand your basic question - maybe you haven't enabled the opto output on pin 7? Does this explain it: -

Look at the first two rows - A high in gives a low out and vice versa BUT only when enable is high. It does say there is an internal pull-up in the data sheet but try it and see.

Alternatively, the voltage you may be driving the opto-emitter with may be biased too high - I notice the drive voltage swings between 0.8V and 1.3V and I envisage some situation where it isn't a big enough difference to validly produce 0 and 1 logic levels on the output.

• I am not good at electronics but the figure 9 and 10 on the datasheet says that I can enable the optocoupler by placing a resistor between the pin 8 (Vcc) and pin 6 (Vo), referring the figure "Test Circuit for FOD060L and FOD260L " on the datasheet, I place 330 ohm resistor. I was able to use the optocoupler by placing 330 ohm on similar circuit like this oi42.tinypic.com/10441o3.jpg , do you still think I am having problem to enable the optocoupler? – sven May 7 '13 at 11:50
• I was referring to pin 7 - i thought it needed to be pulled to Vcc but the small print in the data sheet says not. What about the input side - I'm not sure you are activating it all the way on the emitter. Your circuit in your comment will drive the emitter with zero current when the logic pin is zero. Your actual circuit in your question does not do this – Andy aka May 7 '13 at 12:00