# Whats wrong with this design

I was looking at what goes into driving an LED strip from a microcontroller and i found this

https://electronics.stackexchange.com/a/67780/41661

which has this schematic

In the question the op states the PWM 3.3v is coming from a MCU but he never states what kind of MCU he is using.

I can see that R1 and R2 form a voltage divider that does almost nothing due to the massive difference in resistance and R1 should pull the line down when PWM isnt on and most of the discussion on the answer is focused on that but i dont understand how they came up with that value for R2.

According to ohms law 3.3v through a 27R resistor will flow 122ma which seems a lot of current, Arduinos for example can only supply 40ma to any one pin max and its recommended to stay below 20ma when possible according to this link. Now its entirely possible that the OP could be using a much hardier MCU than an Arduino but doesnt this seem like a strange assumption to make given that the MCU isnt specified.

I read the datasheet for the IRLML2502 supplied in the linked question and i couldnt find anything about how much current was needed to saturate the gate of the mosfet, though datasheets are still mostly greek to me.

Assuming the OP was using an MCU with similar limitations to an Arduino, wouldnt it make more sense to use a 180R resistor value for R2, allowing 18ma to flow at 3.3v or have i misunderstood something?

• You don't "saturate" the gate of the FET with current, you turn them on with voltage. The current needed is just enough to fill the parasitic gate capacitor, so 122mA would flow during a negligible time. Oct 17, 2017 at 21:50
• R1 is there to pull the gate down (and turn off the LED) when the MCU output is floating. eg. when the output is tristated, or just as the MCU comes to life on power-up. Oct 17, 2017 at 22:09
• You can easily replace the 27 ohm with a more reasonable 470 or 1k ohm resistor. If this was a transistor instead of a fet, then yes, the resistor value is important to protect both your output and your transistor, which a 300 to 1k is normal for a NPN and any given microcontroller. Oct 18, 2017 at 2:12

At steady state, the gate of a MOSFET draws no current. (Actually, there may be a few hundred nanoamps of leakage.) It instead acts more like a capacitor. The purpose of R2 is to form a low-pass filter with this gate capacitance, slowing down the rise and fall time of the gate voltage.

• So does that mean that its a very high impedance load which will draw hardly any current despite the resistors before it and i could theoretically remove R2 without impacting the functioning of the circuit? Oct 17, 2017 at 21:53
• Yes, and many designers will omit R2. If you don't have any problems with EMI or ringing on the gate, R2 is unnecessary. Oct 17, 2017 at 21:57
• UM NO... R2 is there to limit the charge current on the gate when the previous gate switches. Since the gate is a capacitive load, on switching I tends towards infinity. As such R2 is required to keep I below the previous devices Io max. R2 also provides the previous gate with some isolation from the capacitive back spike created when the MOSFET switches. Oct 18, 2017 at 0:32
• @Trevor Slowing down the rise and fall time is, of course, equivalent to limiting the charge current. Given the tiny amounts of energy involved (perhaps 13 nJ per transition), limiting the current of the driver is not a major concern. Oct 18, 2017 at 3:26
• @AbeKarplus I believe the problem here is how you're not stating that $R_2$ is unnecessary in this particular setup. But should always be considered. - I do agree that R2 is unnecessary in this setup, but in other setups it's of outmost importance. Oct 18, 2017 at 5:06

Because R1 comes before R2, it is not a voltage divider. To the previous driving device, R1 is in parallel with the R2 - MOSFET line.

It is important also to remember that MOSFETs are voltage activated so once on or off there is basically no gate current. However the gate has a significant capacitance.

R1 is simply there to ensure the MOSFET gate has a discharge path should the previous driving device before it be disconnected. This happens with micros during reset and code failures.

R2 is there to limit the charge current on the gate when the previous device switches. Since the gate is a capacitive load, on switching, I tends towards a very large number. As such R2 is required to keep I below the previous devices Io max. R2 also provides the previous device with some isolation from the capacitive back spike created when the MOSFET switches.

R2 along with the gate capacitance does however form an RC delay. As such keeping R2 as low as possible is prudent if you need to switch the MOSFET repeatedly at higher frequencies. Sometimes it is prudent to use a larger value for R2 to limit the rise or fall time of the MOSFET "output" as it switches.

• Thorough answer. I wish askers would wait a bit before accepting. Oh well. Oct 18, 2017 at 1:06
• So to pick a resistor value for a pwm light controller i need to compare the RC time constant to the finest expected value for the duty cycle and ensure that the resistor is small enough to discharge the capacitor in that time? Oct 18, 2017 at 4:31
• @hamsolo474 That value plus the turn on/off time of the chosen MOSFET. But it wont be exactly RC, it depends on how hard you are driving the gate. If you are driving it with > 2 * Vgs, when turning on it will reach Vgs sooner than it reaches the final voltage. turning off on the other hand the voltage it needs to fall to Vgs. As such, except when you are driving it with 2*Vgs, it will be asymmetrical. Oct 18, 2017 at 14:37