Resistor on optocoupler - Page 1
Forum section: electronics / projects

author: delphes123
author_rank: Contributor
timestamp: April 10, 2023, 07:06:20 pm
content: Dear all,I found this schematic and I was wondering the exact function of the resistor R2, except acting as a kind of pullup when mosfet is not conducting, I am not quite sure why it should be mandatory to have it ?Thanks

author: Kleinstein
author_rank: Super Contributor
timestamp: April 10, 2023, 07:15:41 pm
content: R2 is not really needed. So are R3 and R4.

author: Benta
author_rank: Super Contributor
timestamp: April 10, 2023, 07:38:19 pm
content: Quote from: Kleinstein on April 10, 2023, 07:15:41 pm^This.Someone has too many resistors lying around.

author: james_s
author_rank: Super Contributor
timestamp: April 10, 2023, 08:11:50 pm
content: R3 is useful to prevent ringing on the gate but those other resistors serve no useful purpose. There are many circuits posted on the internet that were designed by people that didn't really know what they were doing.

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 10, 2023, 08:32:49 pm
content: R4 serves as a pull-down. Avoids having a floating gate when the GPIO is in high-Z (which is the case with most MCUs until the GPIO gets configured as an output.) With the MCU_PWM signal name, there is little doubt that this is driven by some MCU's GPIO.R4 would actually be the one not to remove here, R3 may or may not be needed.The real question is for R2.Anyway this is clearly overdone, in most cases you'd be able to drive the optocoupler directly from the MCU GPIO and call it a day. You wouldn't even need a pull-down (but you would need a series resistor.)This looks like something the author may have taken from some schematic and used it in a cargo cult way.

author: wasedadoc
author_rank: Super Contributor
timestamp: April 10, 2023, 08:44:03 pm
content: The 2N7002 can be "iffy" if the logic signal is only 3.3 Volts. Look at the max threshold voltage and note also the test conditions. Vgs=Vds and Ids is very small.

author: John B
author_rank: Frequent Contributor
timestamp: April 10, 2023, 10:45:15 pm
content: I'll admit to using a few more resistors than perhaps needed....R2 will provide a discharge path for the opto's diode once the mosfet turns off, it should speed up the turn off time, but not sure if 10k will do much. I remember doing some tests with this approach in order to try to speed up the switching times of a basic PC817 type opto. This included other things like a parallel RC branch driving the opto in order to create pulse of charging and discharging current. Nothing really helps a PC817 that much.I also would include R3 out of habit on a MOSFET. I don't know what the peak currents would be on charging a MOSFET gate like this, that would depend on how the output stage is driven, switching times, trace inductance etc, but just to be sure I do usually put a series resistance in there.

author: Benta
author_rank: Super Contributor
timestamp: April 10, 2023, 11:04:58 pm
content: If you're concerned about speed or turn-off time, forget about R2.Reducing the value of R5 would give much more bang for your bucks. Try with a collector current of 2...5 mA instead (provided your optocoupler has the CTR to drive that).

author: srb1954
author_rank: Super Contributor
timestamp: April 10, 2023, 11:24:23 pm
content: Quote from: John B on April 10, 2023, 10:45:15 pmThe speed improvement from R2 will be completely insignificant compared to the switch off delay of the photo-transistor.Much greater speed improvement can be obtained from placing a resistor between the base and emitter of the photo-transistor, assuming the base connection is bought out externally. This helps sweep any charge out of the base so the transistor can turn off more quickly, albeit at a considerable reduction in the opto-coupler CTR.

author: MegaVolt
author_rank: Frequent Contributor
timestamp: April 14, 2023, 01:25:00 pm
content: R2 reduces the current through the LED. We were faced with the fact that an optocoupler with a logical output turned on at a logical zero at the output of the control logic. Those. any minimum current can turn it on. The current was much less than the current indicated in the datasheet. Therefore, it was necessary to introduce a separate current path through the resistor.I understand that not all optocouplers are so sensitive. But it is better to put a resistor and be able to put any optocoupler.