# Reducing LED PWM Noise: Which is the best option?

Driving an LED with a microcontroller should be easy. But when looking into noise, things can get complex...

As an instantaneous voltage indicator used in a variable power supply (which will be used to simulate a photovoltaic array of a student's designed satellite), I am using some LEDs controlled by PWM (~31 KHz).

simulate this circuit – Schematic created using CircuitLab

After the first revision of the PCB I have realized that each one of the LEDs is generating 200 mVpp in the 5V line:

My question: which is the best way to reduce this noise? Why?

From my (small) design experience I could come with the following possibilities. Which is the most effective, taking into account real-world components (ESR in capacitors etc)? Any other suggestion? A combination of several?

(Note: changing the PWM frequency is not a good option because that same signal drives other devices)

## a) Decoupling Capacitor

simulate this circuit

## b) Low-pass filter

(The resistor forms an RC low pass filter with the gate capacitance of the MOSFET, removing the high frequency components of the switching)

simulate this circuit

## c) Snubber

simulate this circuit

• Why are you driving the LED at such a high frequency? There is no noise to avoid as with a motor... Commented May 20, 2013 at 1:36
• That same signal is being fed to a low-pass filter to create an analog voltage, which then is amplified and buffered to simulate the power generated by a solar panel. In order to achieve good output for that part of the circuit, the frequency should be as high as possible Commented May 20, 2013 at 3:46

Your a) solution is a good one, just make sure the capacitor is as close as possible to the resistor/LED/transistor-branch as possible. Start with a 100nF value and see how that works. If ripple is still too large to your liking, add a electrolytic capacitor in parallel to the 100nF. The 100nF will suppress the higher frequency components and the electrolytic capacitor will do better for lower frequency components.

As @pjc50 says in one of the comments, a gate series resistor as shown in b) is good practice too to avoid ringing. I'd personally pick a lower value, say 100Ω. It will suppress ringing and will avoid the transistor spending too much time in linear mode (=dissipating heat).

• I would apply (a) and (b): (b) won't make much difference at the 31khz frequency but will suppress ringing RF noise. Commented May 20, 2013 at 9:21
• A right, I didn't see the difference between b) and the original circuit before. @pjc50 you are right, though I would probably use a smaller resistor (100 ohm or so). Commented May 20, 2013 at 9:26
• In which applications the snubber circuit is needed? Commented May 20, 2013 at 13:54
• A good snubber would go on the load itself, not on the switch. C1/Rlim is exactly that. Can't think of a good application in this particular case to have the c) configuration. It is just wasting energy in R1 here. Commented May 20, 2013 at 14:13

a) is close to my first choice. With a suitable value of capacitor in place, the current through the trace resistance and inductance should be nearly constant, very little ripple.

However, you'll still have switching current through Rlim. Also, the capacitor must be sized as a lowpass with corner frequency below 30kHz, using Rtrace and Ltrace.

If you put the bypass capacitor after Rlim, then the current through Rlim is also mostly constant, and the bypass capacitor can be smaller and/or have a cutoff frequency much lower without sizing it excessively large.

b) The 2N7000 has an input capacitance of 60pF, according to the datasheet. The 1/RC frequency is about 1.7MHz. The PCB traces will still be radiating RF.

c) This looks like a snubber circuit meant to save switch contacts from inductive kickback. Not really what you need, and it will eat some power and possibly increase radiated RF noise as it will be charging/discharging the capacitor on each cycle.

So my vote is for a modified a) with the bypass capacitor from the anode of the LED to the source of the NMOS. Making the leads as short as possible.

Edit: a comment makes a good point about the capacitor current spike on the first PWM pulse, so I will add this to my answer:

I must admit I was thinking of "steady state" with the PWM already running, in which case the current and voltage will be constant. But you are correct, when it first turns on, that capacitor will be dumped through the LED and NMOS. I suppose it is a trade off. I was attempting to keep switching transients on as short and few wires and components as possible. If you can find a value of C and an LED that together allow those initial current spikes without damage, good. If not, then I supposed I'd go with b) and make the interconnections as short as possible.

• When you place the bypass capacitor only over LED and NMOS, what is limiting the LED current when the NMOS is turned on? The capacitor will dumb all its energy into the LED pretty quickly, being limited only by parasitic inductance. Commented Jun 15, 2020 at 7:32
• That is a good point. I must admit I was thinking of "steady state" with the PWM already running, in which case the current and voltage will be constant. But you are correct, when it first turns on, that capacitor will be dumped through the LED and NMOS. I suppose it is a trade off. I was attempting to keep switching transients on as short and few wires and components as possible. If you can find a value of C and an LED that together allow those initial current spikes without damage, good. If not, then I supposed I'd go with b) and make the interconnections as short as possible. Commented Jan 2, 2022 at 16:18