0
\$\begingroup\$

Reading different design rules regarding optocouplers used as switch I have a question about the current limiting resistors R4 and R6

enter image description here

One aspect is the protection of the devices (e.g. ~200Ohm for a standard LED over a 3V voltage drop @ 15mA). How can I calculate the correct values?

For the 4N25 the forward voltage is 1.5V and my digital pin can produce up to 20mA => $$R_4 = (5V-1.5V)/20mA \approx 175\Omega $$ where for the Mosfet can switch logic input (5V) but I do not know which value describes the limiting factor for calculation of the resistor R6?

My attempt is with \$V_{GS} = 2V\$ @ \$I_D = 250\mu A\$ with following consideration $$ R_6 = (5V-2V)/250\mu A) \approx 12k\Omega$$

Edit: the datasheets 4N25 IRLZ34NPBF

\$\endgroup\$
12
  • \$\begingroup\$ If your digital pin can produce 20 mA, this might be the absolute max rating and no way would there be 5 volts on that pin. You need to be more conservative. Also, when driving a MOSFET via an opto connected to 5 volts, R6 can be a short circuit. \$\endgroup\$
    – Andy aka
    Jan 28, 2020 at 12:57
  • \$\begingroup\$ Do you mean the digital pin PR_SIG? On my uC I measure 5V when I set the output to HIGH \$\endgroup\$
    – v3xX
    Jan 28, 2020 at 13:09
  • \$\begingroup\$ What do you measure on PR_SIG when driving a load that takes around 20 mA? \$\endgroup\$
    – Andy aka
    Jan 28, 2020 at 13:11
  • \$\begingroup\$ I measure the voltage from PR_SIG to Pin1 of the opto against GND without a resistor. \$\endgroup\$
    – v3xX
    Jan 28, 2020 at 13:19
  • 2
    \$\begingroup\$ As you have described, there is absolutely no way that you can measure 5 volts driving the opto directly. It's a forward biased photodiode and might take over a 100 mA to get it above 2 volts. You run the risk of damaging the opto without a resistor. \$\endgroup\$
    – Andy aka
    Jan 28, 2020 at 13:36

2 Answers 2

2
\$\begingroup\$

You should start at the mosfet Q2.

I think there is no need to drive the mosfet on a low voltage (2V). Always drive the gate at a voltage that is higher than the \$V_{GS}\$ given in the datasheet. A good guidance are the conditions for \$V_{GS}\$ used to specify the \$R_{DS(on)}\$.
When the mosfet is turned on/off at (very) low frequency, just drive it with the highest voltage available. (When driving at higher frequency, you may consider a bit lower voltage to reduce switching losses).
In your case this implies setting R6 to 0 Ω.

UPDATE With updated question, the following does not apply anymore
Note that this also implies R5 becomes superfluous as it is now parallel to R7.

Regarding the optocoupler: don't short the base connection to the emitter, but leave it open, or use a high ohmic resistor to control the sensitivity of the optocoupler.
UPDATE With updated question, this issue is addressed.

In order to get a \$V_{GS}\$ of 5V, (assuming R6 is shorted and R5 is removed), you need a current through the optocouper of only 5V / 10 kΩ = 0.5 mA.

Next, check the datasheet to find the minimum CTR: for the 4N25 it is 20%.

This means (in worst case) the optocoupler needs a forward current of 0.5 mA / 20% = 2.5 mA.

According to the datasheet, Fig 3, the forward voltage is about 1.1V.

So, worst case R4 should be equal to:

(5V-1.1V) / 2.5 mA = 1.56 kΩ

It may still work with a (bit) higher value as the CTR is typically higher.

\$\endgroup\$
11
  • \$\begingroup\$ I corrected the circuit Pin6 and Pin4 were connected \$\endgroup\$
    – v3xX
    Jan 28, 2020 at 14:13
  • \$\begingroup\$ @v3xX as you see, you don't need to use the whole 20 mA the uC can deliver. Just 2.5 mA is enough. \$\endgroup\$
    – Huisman
    Jan 28, 2020 at 14:14
  • \$\begingroup\$ For the output of the optocoupler, you need to add some current to allow for charge injection into the gate of the MOSFET during switching. I would suggest up to 1mA extra (I haven't run this in simulation - just a rough guess). \$\endgroup\$ Jan 28, 2020 at 14:15
  • \$\begingroup\$ Ok. The max current was a mistake on my part. I am still not understand why I should remove R5 from the base. In my guidelines it is recommended not to leave it floating \$\endgroup\$
    – v3xX
    Jan 28, 2020 at 14:17
  • \$\begingroup\$ Since the switching voltage of my Mosfet is 5V and this is provided by the +5V-Powersupply I do not need a limiting resistor. Correct? \$\endgroup\$
    – v3xX
    Jan 28, 2020 at 14:22
0
\$\begingroup\$

First of all, I think shorting the photo transistor's B and E will make the part useless. Please check the Pin 4 and 6 connection.

Second, if you target the LED IF = 1mA to 10mA, you will get 100uA to 5mA IC per CTR number from the datasheet. Once you correct your schematic, you can figure out the resistor values accordingly.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.