# Choose optocoupler diode current limiting resistor

I've designed following circuit:

But let's completely forget the MOSFET and only focus on the optocoupler.

The signal provided to the input of the optocoupler (yellow) has following characteristics:

• Amplitude Modulation of type ASK / OOK (On-Off Keying). It's inverted though: when there is presence of modulation, it means a logic 0, when there is absence of modulation it means 1.
• Carrier frequency 50kHz
• $$\V_{min}\$$ and $$\V_{max}\$$ when carrier is present: -2.5V ; +2.5V
• $$\V_{RMS}\$$: 1.9V

Using an oscilloscope, and by trial and error, I succeeded to find the best R1 resistor value for my application.

### Here are my results

#### With $$\R1 = 4.7k\$$

$$\R1\$$ $$\R2\$$ $$\V_{E}\$$
4.7k 8.33k $$\[0V ; 0.62V]\$$
4.7k 14k $$\[0V ; 1.04V]\$$
4.7k 24k $$\[0V ; 1.69V]\$$
4.7k 26k $$\[0V ; 1.84V]\$$
4.7k 30k $$\[0V ; 2.05V]\$$
4.7k 40k $$\[0V ; 2.68V]\$$
4.7k 41k $$\[0V ; 2.75V]\$$
4.7k 42k $$\[0V ; 2.8V]\$$
4.7k 43k $$\[0V ; 2.86V]\$$
4.7k 44.7k $$\[0V ; 2.96V]\$$
4.7k 46.7k $$\[0V ; 3.02V]\$$
4.7k 47k $$\[0V ; 3.05V]\$$
4.7k 50k $$\[0V ; 3.1V]\$$

#### With $$\R1 = 1k\$$

$$\R1\$$ $$\R2\$$ $$\V_{E}\$$ $$\t_{f}\$$
1k 40k $$\[0V ; 3.24V]\$$
1k 30k $$\[0V ; 3.24V]\$$ 408 µs
1k 20k $$\[0V ; 3.19V]\$$ 272 µs
1k 10k $$\[0V ; 3.14V]\$$ 140 µs
1k 8.3k $$\[0V ; 3.14V]\$$ 117 µs

I noticed that 4.7k is a too high value. Because when I use this resistor, the signal at the optocoupler phototransistor output behaves like a resistance whose value is much higher than my pull-down resistor value R2 of 10k! Leading to a voltage that is floating not far from GND instead of going up to VCC when modulation is present. This forces to choose crazy pull-up resistor for R2. When R1 = 4.7k, circuit starts to work only when choosing R2 = 47k onwards. BUT this is not acceptable: this makes the phototransistor very slow and I can see the pink curve become dirty (slow rise/fall time of 833µs).

With R1 = 2k however, I'm able to get back to a decent R2 = 10k without any problem. Optocoupler latency is much lower (in the order of 100µs).

The limit when doing my tests was: with 2.2k it still works, with 3.3k it already doesn't work anymore. I chose 2k for a safety margin, and I didn't choose 1k because I want to keep the impedance on the bus as high as possible.

# My questions

### 1) How do I know what $$\I_{f}\$$ do I need?

I found R1 value by trial and error, but I'm now trying to understand how could I have rationally found that value with the datasheet and computations.

I just know that I want to be as far away from $$\I_{f} max\$$ as possible to:

• decrease consumption

But otherwise I have no idea how to select my target $$\I_{f}\$$.

Here is an attempt to reverse-engineer my "good value" of R1. Tell me what I'm doing wrong here:

$$I_{f} = \frac{V_{RMS} - V_{f}}{R1} = \frac{1.9 - 1.2}{2000} = \frac{0.7}{2000} = 350µA$$

This current sounds extremely low to me. Am I doing something wrong when taking the RMS value of the signal? In a diode, if I understand correctly, the current flowing through it will change its forward voltage.

But I'm lost when my values are not like the datasheet shows. Maybe $$\V_{f}\$$ is extremely low when $$\I_{f}\$$ is 350µA, and so my computations are not correct?

### 2) Frequency response

Can you help me understand why this optocoupler marvelously filters out my 50kHz carrier frequency?

As I understand it, if we forget the MOSFET for a moment, $$\R_{L}\$$, my "load", is 10k. But what is my frequency to consider? Should I consider 50kHz? Or should I double that to 100kHz because there are 2 LEDs in the opto and each of them will rectify my signal?

Also, the graphic only shows frequency response when $$\V_{CE} = 2mA\$$. How are we supposed to interpolate this if we don't have the same value?

### 3) Optocouplers with 1 diode and 2 diodes

When an optocoupler schematics on a datasheet shows 2 diodes. Is it always 2 LEDs to make it AC-friendly? Or can it happen that it's only one LED and one diode?

If I understand correctly the LTV-814 has 2 LEDs, but I'm unsure because it appears no where on the datasheet. They only put the arrows on one LED.

• Whilst your circuit is not unreasonable, what is it precisely you want to achieve? Why the 50kHz carrier just to carry uart data across a copper pair? What value is the opto giving to the circuit? It seems like a lot of work for little gain. Read up on CTR ( current transfer ratio). The current you put in vs the current you get out. Commented Feb 17, 2022 at 11:34
• The yellow signal is not mine. ^^ I'm interfacing with this signal to decode it. It's the French provider of electricity, Enedis, providing each house's electricity meter with special pins on it. Those pins allow you to get precious information that the electricity meter "knows". They decided to modulate a 50kHz carrier. I wouldn't judge that. It's unrelated to my problem. This is called an "interface". If I want to understand the signal, I just need to decode and follow the protocol...
– Fox
Commented Feb 17, 2022 at 17:51
• The opto is very important: it provides isolation (those pin are very close to some other 220V pins). And it demodulates and filters out the 50kHz. It's a magic-combo. :) A very efficient way to achieve both goals at the same time in one component. The MOSFET is just there to create a perfect square signal going all the way down to 0V even if the pink signal is not perfect (allowing a high impedance on the shared bus of the yellow signal).
– Fox
Commented Feb 17, 2022 at 18:05
• 50 kHz and inverted logic? Sounds a lot like IR modulation. Anyway, as for what frequency to consider, square waves have odd harmonics. So, even at 150 kHz, 250 kHz, and so on there's energy that'll dull the edges when lost. Commented Feb 17, 2022 at 18:12