Optocoupler - pull up resistor - Page 1
Forum section: electronics / beginners

author: bodzio_stawski
author_rank: Regular Contributor
timestamp: March 22, 2022, 02:14:25 pm
content: HelloI have a problem with understanding optocoupler working, on example below.Here is a picture visible in most datasheets: LED ON means that output is LOW. LEN OFF - output ON.If I mean correctly, connecting DC voltage at 5V (+5V potential on Anode and 0V potential on Cathode), we should have LED ON inside the chip and LOW output (so the signal became inverted thanks to the chip).But sometimes I see that between output pin and Vcc pin pull up resistors are implemented (Between pin 5 and 6) - is that a method to inverse signal or permanent requirement for that IC?

author: devinatkin
author_rank: Contributor
timestamp: March 22, 2022, 02:43:03 pm
content: I mean the pull up there is to get a high voltage when the led is off. It may or may not be inverted, it'll depend on how that amplifier is setup for when it turns on the npn, although it likely is. However, if what you need is a non-inverted signal then you can almost definitely find a chip which is implemented to provide the non-inverted signal.Looking at the first optocoupler I found on digikey ISP281. When it's configured as an phototransistor instead of using the amplifier, you would be able to configure it as either inverting or non-inverting depending on how you hook it up.If you need more of an explanation of how to do so I'll draw out the circuit.

author: bodzio_stawski
author_rank: Regular Contributor
timestamp: March 22, 2022, 02:55:26 pm
content: No, It's not about to choose something at the momentI think now I get what happend when the LED is off. But not sure what if the LED is ON. Theoretically the output should be LOW. But now we have pull up resistor between pin 5 and pin 6. So can I expect that output has REALLY "low" output and on pull up resistor we have voltage drop equal to voltage on pin 6 Vcc?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 22, 2022, 04:36:47 pm
content: The recommended conditions and expected characteristics are given in the datasheet.Input OFF: I_F below some margin.Input ON: I_F above some margin.Typically these margins will be well apart, leaving an ambiguous range inbetween. Avoid operating in this inbetween range.Obviously, current can't be lower than 0, but current can be higher than I_F(on), up to the limiting (absolute maximum) value. Typically 10-20mA is used.Output OFF: with input off (as above), the output current is below some margin, or the voltage above some margin.Output ON: with input on (as above), the output current is above some margin, or the voltage below some margin.These will be given as Icex or I_OH or other leakage current (at specified Vce or Vout), and Vce(sat) or V_OL (at specified Iout). Typically, leakage will be some ~µA, so the off-state voltage drop across even a fairly large value resistor is small, thus still giving a recognizable logic-high output voltage; saturation will be some tenths of a V at reasonable currents (say 4mA, or a bit over 1k pull-up to 5V), again giving a recognizable logic-low output voltage.If you need an output that is well and truly very close to zero, consider using analog switches, full proper mechanical switches, or a compensated method:Analog switches are FET based semiconductor switches, which have a resistive characteristic. The BJT shown in the above diagram will have some minium Vce(sat), even for very low Iout. As a resistor, the voltage drop is proportional to load current, so you will have to reduce the load current arbitrarily, to get V_OL arbitrarily close to zero.Mechanical switches are the same way, but with a far higher ratio between on and off: on-resistance of some milliohms, and off-resistance of >>1Gohm, is fairly normal. Here too, the voltage drop depends on load current, but because the on-resistance can be much lower, V_OL can be lower for a given load current. Mechanical switches do not operate quickly, however (on the order of 10ms delay), and they draw extra power (coil current, except for latching types when not switching), and various other aspects (makes a click sound, sensitive to intense vibration, etc.).Compensation just means, if you know the load current, you can perhaps apply a conditional current, or voltage, to cancel out the switch's contribution. For example, using an op-amp to hold the switch node at 0V, but only allowing the op-amp the ability to perform this control when the switch is on. So, feedback is used to reduce the error, with corresponding limitations/drawbacks of limited response time (the op-amp cannot respond instantly, giving this node an inductive characteristic, i.e. more voltage drop at higher AC frequencies), voltage/current range limitations, injected noise (from the amp, as well as charge injection from the switch), and stability being a concern (it might not be well-behaved into all loads).This is probably all rather abstract and high level, but there isn't much specifics to explore without an application and device to discuss.Tim

author: rstofer
author_rank: Super Contributor
timestamp: March 22, 2022, 05:40:33 pm
content: Link to a datasheet and you can get help.Applying 5V to the LED is almost certainly wrong. There will be an If spec and a Vf spec and you calculate the resistor accordingly such that, for your Vcc, you get the appropriate If.R = (Vcc - Vf) / IfUsually...

author: rstofer
author_rank: Super Contributor
timestamp: March 22, 2022, 05:43:57 pm
content: As to Vo, it depends on your load but you can start by adding a pull-up resistor of 1k (assuming a low Vcc) connected to Vcc just to see it work. Again, you can't connect Vo to some fixed voltage, there will always be a current limiting resistor that limits Ic to some value from the datasheet.Where's the datasheet?

author: Terry Bites
author_rank: Super Contributor
timestamp: March 22, 2022, 06:42:42 pm
content: From the symbol, it looks like a digital coupler- so the output is either on or off. I'm sure the datsheet will advise a maximum current and hence a sensible range for the pullup.For the input transistor and a typical If for the LED. Go with that. Note that there is a trade off between speed and power. Large resistors reduce current drain but slow down the switching speeds.In a regular optocoupler (no internal logic) you can use the transistor in the common collector or common collector configuration. The common emitter has slow rise time and fast fall time, while the common collector has fast rise time and slow fall time. This may well have an impact on your choices.