#### samyang

Joined Jul 24, 2022
35

I am trying to design a circuit using an optocoupler to power an led.

1. The signal I am referring to in the picture is always either 3.3V or 0V. The 1k resistor is also always after it. The circuit I am designing comes after the signal and the resistor.

2. To power the led, I am also given the choice to either use 5V or 12V.

3. The main objective is to design a circuit so that when the signal is 0V, the led light in the end (not the one in the optocoupler) turns ON. And when the signal is 3.3V, the led light turns OFF. So it is sort of like inverse logic.

I started with the idea of using an optocoupler but I am still stuck.

4. The optocoupler that is to be used is the 4N36 by Vishay, so please refer to that datasheet and the led light has a forward voltage of 2.1V.

Please help design a full circuit that fulfills these requirements and also is able to make the led light not only turn on and off at the right time but also be bright enough, preferably using the optocoupler provided. Thank you. Please provide a picture of a screenshot of the circuit.

The forward current of the led I want to turn on or off is 20mA. I also can use a low current led, which has a forward voltage of 1.8v and forward current of 2mA and a max of 7mA

#### ErnieM

Joined Apr 24, 2011
8,377
Using an opto coupler gain you nothing but expense and complication.

A pair of transistors where the first acts as an inverter and the second to drive the LED would be better.

#### crutschow

Joined Mar 14, 2008
34,408
Connect the LED and resistor between V+ and ground at the output.
Connect the opto transistor across the two LED terminals.
Thus when the opto transistor is on it conducts the resistor current and the LED is off.
The disadvantage of that circuit is that there is always current flowing through the LED resistor.

#### samyang

Joined Jul 24, 2022
35
Thank you. I am new to electronics, how would i calculate the three resistor values? And why did you refer to it as an opto transistor instead of an optoisolater?

#### dl324

Joined Mar 30, 2015
16,909
Welcome to AAC!
The main objective is to design a circuit so that when the signal is 0V, the led light in the end (not the one in the optocoupler) turns ON. And when the signal is 3.3V, the led light turns OFF. So it is sort of like inverse logic.
Is this schoolwork?
I started with the idea of using an optocoupler but I am still stuck.
Why do you think you need an optocoupler?

#### samyang

Joined Jul 24, 2022
35
Welcome to AAC!
Is this schoolwork?
Why do you think you need an optocoupler?
This is not schoolwork, a personal project. Because I read that it was good at isolating two different circuits and essentially serving as a transistor because I am using 0/3.3 V on one side and 5 or 12V on the other

#### samyang

Joined Jul 24, 2022
35
thank you all for your help.

#### dl324

Joined Mar 30, 2015
16,909
Because I read that it was good at isolating two different circuits and essentially serving as a transistor because I am using 0/3.3 V on one side and 5 or 12V on the other
You just need an inverter driving a high side switch.

Or with just MOSFETs:

#### samyang

Joined Jul 24, 2022
35
Thank you for your help. If I were to use the 5V and an led with a forward voltage of 2.3, how would I calculate R2 and R3? I am new so I am still learning the basics. Thanks.

#### samyang

Joined Jul 24, 2022
35
Are those component numbers ones that would match my circuit? Thanks.

#### crutschow

Joined Mar 14, 2008
34,408
why did you refer to it as an opto transistor instead of an optoisolater?
I was referring to the optoisolators's output transistor.

#### dl324

Joined Mar 30, 2015
16,909
Thank you for your help. If I were to use the 5V and an led with a forward voltage of 2.3, how would I calculate R2 and R3? I am new so I am still learning the basics. Thanks.
R2 is just a pull-up resistor to turn Q1 off. I'd use 10k.

R3 need to provide enough base current to saturate Q2. For BC547, you use a beta of 20 for saturation, so:

$$\large R3 = \frac{3.3V-0.7V}{0.05*1.2mA} = 43.3k\Omega$$
You could use 10k to keep things simple.

#### samyang

Joined Jul 24, 2022
35
Thank you. What is also sig-?

#### dl324

Joined Mar 30, 2015
16,909
Thank you. What is also sig-?
Ground. That schematic is missing a current limiting resistor for the LED.

EDIT: My calculations were for the schematic I posted.

#### samyang

Joined Jul 24, 2022
35
R2 is just a pull-up resistor to turn Q1 off. I'd use 10k.

R3 need to provide enough base current to saturate Q2. For BC547, you use a beta of 20 for saturation, so:

$$\large R3 = \frac{3.3V-0.7V}{0.05*1.2mA} = 43.3k\Omega$$
You could use 10k to keep things simple.
Sorry, I mistyped, I meant to find R1. R3 in my case has to be 1k because that is what i am given. Thanks

#### samyang

Joined Jul 24, 2022
35
Thank you. I do only have optoisolater 4n36 at hand right now, is this circuit possible to be created using that optocoupler?

#### dl324

Joined Mar 30, 2015
16,909
Sorry, I mistyped, I meant to find R1. R3 in my case has to be 1k because that is what i am given. Thanks
Depending on the CTR of the optocoupler isn't a good design practice as CTR degrades over time.

#### dl324

Joined Mar 30, 2015
16,909
Thank you. I do only have optoisolater 4n36 at hand right now, is this circuit possible to be created using that optocoupler?
The circuit that you first proposed is a poor design.

#### samyang

Joined Jul 24, 2022
35
The circuit that you first proposed is a poor design.
The CTR for the optocoupler is 100%. When looking for the mosfets and bjt, are there any specific requirements that only work for my scenario?

#### dl324

Joined Mar 30, 2015
16,909
The CTR for the optocoupler is 100%.
It won't stay at 100%. Better designs will design for a lower CTR so that the degradation will take longer to impact the circuit.

As the other member said, an optocoupler isn't required. All you need is an inverter and a transistor to drive the LED high side.

If you're able to drive the LED low side, you don't need the inverter and can use either an NPN transistor or N channel MOSFET.