# Understanding opto-isolators

Hi,

I’m using the attached circuit to monitor a 220VAC line using a 5V phone charger and an optocoupler. On pin 5 I get 5V when no AC is present and 2.1V when AC is present. Shouldn’t it be 0.7V, the Collector-Emitter voltage?

TIA

You don't have a current limiting resistor on the input to the optocoupler. The absolute maximum for a 4N25 is 60mA but it looks to me like you're putting about 220mA through it on the positive cycle.

Edit: NM, overlooked the 5V power supply sorry.

Have you looked at the CTR you're getting with the forward current you're supplying?
At 25°C, the datasheet says that 3.7mA will give you about 40%.
3.7m0.41800 = 3V.
5-3 = 2V, which is about what you're measuring.

They give VCE(SAT)=0.5V under test conditions, when IF=50mA
With R1=1K , your IF=(5-1.5)/1000 = 0.0035A = 3.5mA , too low, the transistor is not saturated

I could be wrong, and hopefully someone will correct me if I'm wrong, but try moving the zener to the other node of the 1K CLR, so the CLR only deals with the led of the isolator

The zener and cap are like tits on a bull. Not needed.
Opto LED current is (5volt supply - 1.2volt LED) / 1k = 3.8mA

The 4N25 has a worst case transfer ratio of 20%.
3.8mA could result in 0.76mA through the transistor.

0.76 * 1k8 = 1.368volt across the 1k8 resistor.
5 - 1.368 = 3.632volt across the transistor

Arduino's LOW threshold is vcc * 0.3 = 1.5volt (for a 5volt Arduino).

So 1k8 pull up won't register a LOW on the Arduino pin.

Two solutions.

1. more opto current
2. higher value pull up resistor.

I would use option 2.
Minimum pull up resistor value is (5volt Arduino supply - 1.5volt pin threshold) / 0.00076Amp = ~4600 ohm.
A 4k7 (or 10k) resistor would be fine.
Leo..

alnath:
They give VCE(SAT)=0.5V under test conditions, when IF=50mA
With R1=1K , your IF=(5-1.5)/1000 = 0.0035A = 3.5mA , too low, the transistor is not saturated

Actually, I think this is the issue. You should have a 100 Ohm resister in place of the 1K. That will give you about 35mA If. To get the 50mA in their test conditions, you need a 70 Ohm resistor.

If you want to keep that 1k8 resistor, and the opto happens to be a bad one (20% transfer ratio),
then you have to increase LED current to (3.5volt / 1k8) * 100/20 = 9.7mA.
The 1k current limiting resistor has to be lowered to (5volt supply - 1.2volt LED) / 0.0097Amp = ~390ohm.

I had to replace many failed opto sensors where the designer calculated a LED current of >=30mA.
Leo..

Wawa:
.

I had to replace many failed opto sensors where the designer calculated a LED current of >=30mA.
Leo..

LED or transistor? I guess what I'm really asking is -was the led within limits but too much current through the transistor caused failure, or just that the led gave out?

tinman13kup:
LED or transistor?
I guess what I'm really asking is -was the led within limits but too much current through the transistor caused failure, or just that the led gave out?

Voltage swing on the collector was not enough to trigger a following gate.
Must have been the IR LED loosing brightness (after severeal years though), because after replacing the side-firing LED of the gate it worked again. Transistor pull up was in the 100k range (5volt).
Lowering LED current to 20mA, and increasing the pull up resistor a bit, permanently fixed the problem.
Years ago now, but I remember the LEDs being rated for 30mA and used at 30mA.
Leo..

Hey guys thanks for the speedy assistance!

The wall AC-DC transformer is about 2 meters from the tiny pcb I used to interface with the Arduino board. I added the zener to reduce possible surges/spikes coming in and the cap to filter possible noises picked up by the length of the cable. It’s probably an overkill but I had them lying around. They have nothing to do with the opto diode’s forward current.

Below the diagram you can see a formula I used to calculate the Rf which came out to be approx. 380 ohms. Because I used a 1k resistor (thinking of giving better protection to the diode thus a longer life) I ended up causing the problem. Will go back to the work bench and lower said resistor because probably is what causing the transistor not saturating.