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).
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
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)