Optocoupler circuit for digital signal - Source vs Drain

Thread Starter

Steelmesh

Joined Aug 25, 2009
18
For isolating a PWM signal from one mcu to another (where the left side mcu is generating a PWM, the right side mcu is measuring the width); which one is Right, Wrong, Indifferent, Inverse?

Assume that opto is capable (I just used a random one)



Thank you
 

ScottWang

Joined Aug 23, 2012
7,397
The first circuit is better.
If the receiver pin has a high level at there when the power up, that is not a good arrangement, so let the PB0 receive a low level when the power up, and the receive pin and the transmit pin are the same phase.
 

Thread Starter

Steelmesh

Joined Aug 25, 2009
18
The first circuit is better.
If the receiver pin has a high level at there when the power up, that is not a good arrangement, so let the PB0 receive a low level when the power up, and the receive pin and the transmit pin are the same phase.
Can you help me clarify your response. Did you mean delaying the +5V supply on the photo-transistor side until the receiving controller is running? For example using another output pin to control this delay?
 

ErnieM

Joined Apr 24, 2011
8,377
Not any real difference between them.

The first has the output in phase with the input, the 2nd one is out of phase.

That's about the only difference there is. Either should serve you well.
 

ScottWang

Joined Aug 23, 2012
7,397
Can you help me clarify your response. Did you mean delaying the +5V supply on the photo-transistor side until the receiving controller is running? For example using another output pin to control this delay?
I didn't add anything at all, it just described what your circuit was, and which one is better for the most applications, why i chose the first circuit, because in many situation that if the receive side has high level, it could be happen some bad when the device is power up.

Specially in the first circuit has the same phase, so you just need to set the INT and timer on the uC of the photo-transistor side, when the photo-led side is high, then the timer of the photo-transistor side will start to count, and when the photo-led side is became low level then the photo-transistor side will stop the timer, and the uC to calculate the number of timer, that's the program you need to write.
 
Top