Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Optocoupler PC817 issues

Status
Not open for further replies.

sabu31

Advanced Member level 1
Joined
Jan 28, 2011
Messages
448
Helped
12
Reputation
24
Reaction score
13
Trophy points
1,298
Activity points
5,172
Hi all,

I am using optocoupler with pull up as show in simulation. The input to optocoupler is through GPIO pins of microcontroller (3V). The output pull up resistor (10k) is connected between 12V and collector. the emitter is grounded. The simulation is working fine as checked in LTpsice. However, in actual circuit, the output is 1V pulse when it should have been 12 V pulse. What could be the reason for this problem.
 

I am attaching the schematic. I am unable to attach equivalent LT spice filter. The Vo is having maximum value of 1V when input is 0 . When input is 3V, output is 0V.
 

Attachments

  • OptocouplerCircuit.pdf
    354.3 KB · Views: 174

Hi,

1V when it should be 12V.
This means when the optocoupler (LED) is OFF.
If this is true, and you showed the complete circuit as I asked for, then the optocoupler is defective.
But I doubt it is defective - but maybe it is. Let us check.



Please confirm:
* .. that there is nothing else connected to the optocoupler output when you did the "1V" measurement.

* .. that there is nothing else connected to the GPIO output when you did the "1V" measurement.

* is it 1V when it should be 12V, or is it 1V when it should be 0V? --> measure and report both output voltage levels when ON and OFF.

* is 3V/0V really the GPIO output voltage... or is it the voltage you expect? --> measure and report both output voltage levels when ON and OFF (for sure with all the circuit you shown).

* did you calculate the expected output current? ...and what LED current it needs to get the output current ... and what LED current limiting resistor you need.
If yo did not, pleat try to do so.
In either case: show your math so we can help you with this.

Klaus
 

check the o/p of the uP is really low when it should be

note the circuit is inverting

check the 12V is really 12V

check the 10k really is 10k

else replace opto ...
 

I wonder if a circuit is connected to node Vo?
At present I am just connecting signal probe.
The intention is to apply Vo to a buffer CD4050BE to drive a power relay.
--- Updated ---

Hi,


This means when the optocoupler (LED) is OFF.
If this is true, and you showed the complete circuit as I asked for, then the optocoupler is defective.
But I doubt it is defective - but maybe it is. Let us check.



Please confirm:
* .. that there is nothing else connected to the optocoupler output when you did the "1V" measurement.

* .. that there is nothing else connected to the GPIO output when you did the "1V" measurement.

* is it 1V when it should be 12V, or is it 1V when it should be 0V? --> measure and report both output voltage levels when ON and OFF.

* is 3V/0V really the GPIO output voltage... or is it the voltage you expect? --> measure and report both output voltage levels when ON and OFF (for sure with all the circuit you shown).

* did you calculate the expected output current? ...and what LED current it needs to get the output current ... and what LED current limiting resistor you need.
If yo did not, pleat try to do so.
In either case: show your math so we can help you with this.

Klaus
Hi Klaus,

I am attaching the calculations for the optocoupler (PC817) for If=15mA . The values I am getting for input resistance is R1=120 Ohm and Output side R2=493 Ohm (used 560ohm). However, if I am using the values R1=330 and R2=10k, it still does not make difference in LT spice ( i am getting the required inversion when input is a DC 3V/0V). The issue comes during pulses when frequency affects the performance. Please let me know if anything is wrong with my calculation/assumption.
 

Attachments

  • Optocoupler Calculations.pdf
    56.1 KB · Views: 132
Last edited:

Hi,

Basically the calculation is right. Well done.
Still I want to comment it.
* you calculated the input side first, then the output. There's nothing wrong with it, but often it's the other way round: You want to drive a given load. In your case the 10k, plus some overhead current.
(The usual way is to determine R2 first ... according voltage levels, speed and safety margin)
* you used a CTR of 135%. This is rather optimistic. I see the CTR can be as low as 50%. And you may expect it to degrade with the years, with temperature...and for switching applications (saturated) you should calculate with even less ctr. I'd rather use "safe" 25%.
* you calculated R2. The value you calculated is the "minimum" value for optimistic CTR. So it's not good to use this value...always use a higher value resistor to get reliable operation. If switching speed and voltage levels are good, then stay with the initial 10k.

The issue comes during pulses when frequency affects the performance
You did not mention "pulse" nor "frequency" before, thus I thought of a DC application. For sure frequency and waveform has a big impact on operation.
What's the expected waveform (square wave, what duty cycle range, what timing accuracy) and what frequency do you need?

Btw: I think it's still a good idea to give us all informations requested in post#4.

Now you talk about LTspice... why don't you show use the used schematic and the LTspice results?

Klaus
 

    sabu31

    Points: 2
    Helpful Answer Positive Rating
Hi,

Basically the calculation is right. Well done.
Still I want to comment it.
* you calculated the input side first, then the output. There's nothing wrong with it, but often it's the other way round: You want to drive a given load. In your case the 10k, plus some overhead current.
(The usual way is to determine R2 first ... according voltage levels, speed and safety margin)
* you used a CTR of 135%. This is rather optimistic. I see the CTR can be as low as 50%. And you may expect it to degrade with the years, with temperature...and for switching applications (saturated) you should calculate with even less ctr. I'd rather use "safe" 25%.
* you calculated R2. The value you calculated is the "minimum" value for optimistic CTR. So it's not good to use this value...always use a higher value resistor to get reliable operation. If switching speed and voltage levels are good, then stay with the initial 10k.


You did not mention "pulse" nor "frequency" before, thus I thought of a DC application. For sure frequency and waveform has a big impact on operation.
What's the expected waveform (square wave, what duty cycle range, what timing accuracy) and what frequency do you need?

Btw: I think it's still a good idea to give us all informations requested in post#4.

Now you talk about LTspice... why don't you show use the used schematic and the LTspice results?

Klaus
Its for DC application. Just checked in simulation in pulse case also.
--- Updated ---

Hi,

Basically the calculation is right. Well done.
Still I want to comment it.
* you calculated the input side first, then the output. There's nothing wrong with it, but often it's the other way round: You want to drive a given load. In your case the 10k, plus some overhead current.
(The usual way is to determine R2 first ... according voltage levels, speed and safety margin)
* you used a CTR of 135%. This is rather optimistic. I see the CTR can be as low as 50%. And you may expect it to degrade with the years, with temperature...and for switching applications (saturated) you should calculate with even less ctr. I'd rather use "safe" 25%.
* you calculated R2. The value you calculated is the "minimum" value for optimistic CTR. So it's not good to use this value...always use a higher value resistor to get reliable operation. If switching speed and voltage levels are good, then stay with the initial 10k.


You did not mention "pulse" nor "frequency" before, thus I thought of a DC application. For sure frequency and waveform has a big impact on operation.
What's the expected waveform (square wave, what duty cycle range, what timing accuracy) and what frequency do you need?

Btw: I think it's still a good idea to give us all informations requested in post#4.

Now you talk about LTspice... why don't you show use the used schematic and the LTspice results?

Klaus
Thanks Klaus for the feedback comment on calculation process
 

above a few 100 Hz the circuit output will begin to deteriorate due to the slow speed of common opto's and the RC time constant caused by the 10K output resistor

for fast performance you need reverse drive o the opto too

you should have mentioned it was the AC performance you were concerned about in the 1st post...!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top