# Using an optocoupler

• 233 Views
• Last Post 27 May 2019
cd_sharp posted this 14 May 2019

Hi, everyone

I'm placing over a lighting resistive bulb that is powered by AC a bridge rectifier and an optocoupler LTV817.

The input (dark blue) to the optocoupler, taken at the output of the bridge rectifier looks good, around 20V peak-to-peak:

However, the output of the optocoupler is missing:

Maybe there is not enough voltage at pins 1 and 2. I'm not sure what to look for in the datasheet . Any idea?

Thanks

Jagau posted this 14 May 2019

Hello Cd
The answer is in datsheet page 9

pin 1 and 2 = input
pin 3 and 4 = output with min and max voltage

must have too min current

Jagau

Zanzal posted this 14 May 2019

Hey CD,

Jagau is correct. Looking at the datasheet we see a Vf of 1.2V. The problem will be how much current should flow through the input at max voltage. So let's say your bridge peaks at 60V output and its at that moment you want the current through your opto (input side) to peak to 5mA. Then you take 60V subtract the Vf (typically 1.2 according to the datasheet) and divide by 0.005 to obtain R. This should give you a round about R and help you select the best series resistance and potentiometer for your setup.

Vidura posted this 14 May 2019

My friend, all wat was said is correct,  if I may add: on the input side pin 1 is the anode and pin 2 the cathode of the transmitter led, you have to connect the bridge rectifier accordingly. If I can see correctly on the picture you hooked the scopeprobes directly to the outputpins, the optocoupler do not transfer power, only signal, so you have to apply voltage on the output according to datasheet values to get a signal.

Vidura

cd_sharp posted this 15 May 2019

Friends, let's see if I understood correctly.

This means the internal diode between pins 1 and 2 starts conducting at 1.2-1.4V. The ideal input current value is 20mA. The pulses coming out of the bridge rectifier are 17V. So, the resistance I need to add before the bridge rectifier is:

R3 = R4 = (17 - 1.2) / 0.02 = 790 ohms

This means that unless VCE reaches BVCEO (35 V), there is no output signal? I can hardly believe I understood this correctly.

If I wish to receive the output signal in a digital pin of my Netduino/Arduino MC

I guess I need to apply 5V between the collector and emitter and a 1K resistor should pull-down the current to 5mA, well within the range of the MC.

Taking these maximum ratings into account:

the 5mA from the mains of the MC + the transferred current must be below 50mA, right?

Some other unclear detail: between which points is this reading taken:

Out and Main GND of the MC?

or Out and Digital GND of the MC?

Thanks, my friends

Zanzal posted this 16 May 2019

Hey CD,

This means the internal diode between pins 1 and 2 starts conducting at 1.2-1.4V. The ideal input current value is 20mA.

What the datasheet means is that 1.2V is the typical Vf at 20mA. When a datasheet lists the Vf of an LED it will need to also tell you at what current that Vf is expected. So our number of 1.2 is actually not going to be 1.2 at 5mA, but 1.2 at 20mA. We don't need the exact Vf though, as close enough is good enough for most applications.

Keep in mind, the transistor inside the optocoupler will likely be forward biased before you reach 5mA on input, but the amount of current it allows to flow will be limited by how much current is provided by the input side. I never really took the time to figure out opto current transfer ratio, but in your case I think you will need very little current and can probably use the pin on your Arduino that has an internal pulldown (the pulldown may need to be enabled) or a higher pulldown like 10k. 1k seems too low to me. You could probably get away with 0.5mA or even less unless your need faster rise/fall times.

I like to think of digital input pins like they are a tiny capacitor. You're pulldown will discharge that capacitor so if your input pin capacitance is 25pF then the 10k will discharge it fairly quickly but maybe not quick enough if the frequency is high. If your pulldown is small it will waste more power when its on. So its a trade off. How fast do you need it to pull down (discharge the pin) vs how much power are you willing to use when its turned on. Whatever your choice, the charge rate will be impacted by the amount of current that can flow through the transistor on the opto output side. It won't need much though to charge the tiny capacitor on the input pin to the threshold voltage for HIGH.

I don't know the exact answer to the digital ground question, but I don't think it matters which ground pin you use on your Arduino in this case.

One thing you might find useful, if you want to prevent your opto from triggering before a certain voltage is reached, you can use a zener to prevent it from turning on early. If you do that you'll need to adjust your resistance calculation to subtract the zener voltage as well.

Vidura posted this 15 May 2019

This means that unless VCE reaches BVCEO (35 V), there is no output signal? I can hardly believe I understood this correctly.

This are the absolute maximum ratings, you will have output at much lower values.

If I wish to receive the output signal in a digital pin of my Netduino/Arduino MC

I guess I need to apply 5V between the collector and emitter and a 1K resistor should pull-down the current to 5mA, well within the range of the MC.

Yoy should check if the inputpin tolarates 5v , maybe a 3.3v supply would be safer.

Taking these maximum ratings into account:

the 5mA from the mains of the MC + the transferred current must be below 50mA, right?

Some other unclear detail: between which points is this reading taken:

Out and Main GND of the MC?

or Out and Digital GND of the MC?

this question is not at all clear, I guess the signal is coming from the optocoupler and will be processed in the MC, for the input of the Micro you should use the digital ground.

Regards Vidura

• Liked by
cd_sharp posted this 27 May 2019

Thanks, guys for all the good advice.

I took into account the low value of the current, so I lowered the resistors accordingly. I can make the optocoupler trigger, but the wave form gets distorted and the optocoupler triggers for a lot longer than I'd like to. It's normal, any added capacitance affects the waveform.

Unless using the mains sine wave as input, the voltage controlled delayed conduction is hard for me. I don't feel up to it right now. I'm going to look into current controlled delayed conduction.

• Liked by
Members Online:
Since Nov 27 2018

Content is screened.

More than anything else, your contributions to this forum are most important! We are trying to actively get all visitors involved, but we do only have a few main contributors, which are very much appreciated! If you would like to see more pages with more detailed experiments and answers, perhaps a contribution of another type maybe possible:

Donate (PayPal)

The content I am sharing is not only unique, but is changing the world as we know it! Please Support Us!

Donate (Patreon)

Thank You So Much!

Shop: Amazon / E-Bay
Start Here:
Weeks High Earners: