So I'm designing a PCB for a MIDI controller with a lot of slide potentiometers and push buttons. I'm also backlighting the pushbuttons with LEDs running on PWM and I'm worried that the PWM for the LEDs is going to create a lot of noise in the analog values from the potentiometers. There is also USB on the PCB wich also is the power source.

How do I make sure that the analog values from the potentiometers are as clean as possible?

I guess PCB layout is critical and the use of bypas capacitors is a good idea?

Any help is appreciated :)

  • \$\begingroup\$ is a pwm frequency above the audible range acceptable for you? \$\endgroup\$ – Vladimir Cravero Sep 23 '19 at 10:53
  • 1
    \$\begingroup\$ Welcome to EE.SE! " I'm worried" Don´'t. Measure! "as clean as possible" Impossible design criteria. Define good enough. Also show layout and schematic! \$\endgroup\$ – winny Sep 23 '19 at 10:53
  • \$\begingroup\$ @winny, you missed chances for a few more '!'s... !!!!! \$\endgroup\$ – TonyM Sep 23 '19 at 11:04
  • \$\begingroup\$ Welcome to the site. Please edit your question (not in comments) and greatly expand it, showing a schematic, operating frequencies, voltages to be measured and much more. The better the quality of your question, the better the quality of the answers you will attract. Again, a warm welcome to the site. \$\endgroup\$ – TonyM Sep 23 '19 at 11:06
  • \$\begingroup\$ @TonyM Naw, it's too inflated these days. Back when I went to school we learned one exclamation mark for any order or appeal. Three exclamation marks are resaved only for shouting in life and death situations. \$\endgroup\$ – winny Sep 23 '19 at 11:38

This is a MIDI controller, so I guess no analog audio processing will take place inside, which means the internal circuits should be rather noise tolerant. You should of course take care not to radiate noise which could affect other devices.

Using PWM for your LEDs means traces carrying pulsed currents. I assume your LEDs, buttons and pots will be on a PCB, which could be quite large, since you mention "a lot of slide pots".

First thing to worry about is common impedance coupling. If pulsed LED currents run through the same traces as voltages used to read the pots, then the bits of trace in common will result in extra noise in your analog readings. The solution is quite simple: don't run pulsed LED currents through traces that also carry analog signals. So, if your pots have one end at GND and the other end at VCC, simply avoid sharing GND/VCC traces between the pots and the LED driver chips.

An alternate solution is to sync your microcontroller's ADC with the PWM timer, and acquire when the LEDs are all off.

Consider adding a RC filter before your ADC, make sure the cutoff is high enough so the pots don't feel "slow". This will also reduce noise picked up by the pots themselves (via capacitive coupling with the user's finger, nearby cellphones, etc).

Then, AC currents in traces mean loop antennas, which emit electromagnetic waves. You need to reduce the area of loops carrying pulsed currents. This simply means being aware of where your LED current flows, and routing both traces close to each other. For example if your current loop is:

GND - Decoupling cap at LED driver - VCC - trace - LED - trace - resistor - driver chip - GND

Then, if you route both traces between the LED driver and the LED close together, it will radiate much less.

If you multiplex your LEDs, the first layout that comes to mind would be a grid, but that's also the one with the largest loop area.

A ground plane would work if your LEDs are grounded, but most drivers put LEDs between VCC and the driver, so a ground plane won't carry the return current. It would only act as a shield.

Also make sure that whatever drives your LEDs does not output very high slew rate current. Don't use a superfast logic gate. Slow edges are much nicer.

  • \$\begingroup\$ Thank you so much for the info, im kinda new with electrical engineering but understood most of what you meant except the slew rate thing. I was thinking of using a mosfet IRLZ44NPBF where the gate is connected to a pwm capable pin on my micro controller. This mosfet is driving all led on the same time. Is there a better alternative? I also have no idea of what values and kind of capacitor i should use for decoupling. \$\endgroup\$ – SouZ Sep 23 '19 at 13:38
  • \$\begingroup\$ Oh, I thought you wanted to control every LED individually. Is it so? Or you want to use them for "backlight" only? \$\endgroup\$ – bobflux Sep 23 '19 at 19:11
  • \$\begingroup\$ I'm not controlling them individually everything on the same line. By the way, I'm also using a 16ch analog multiplexer ( cd47 something), can I have a single rc lowpass filter at the output of the mux or do I have to filter all analog signals before the mux? You understand? \$\endgroup\$ – SouZ Sep 23 '19 at 21:40
  • \$\begingroup\$ If you put the filter after the mux then every time you switch to a different input, you will have to wait until the voltage settles on the filter capacitor, which is inconvenient. As for the LEDs, if they are all on the same line, that makes it much simpler. Just route LED traces carrying current in both directions next to each other. \$\endgroup\$ – bobflux Sep 23 '19 at 21:51
  • \$\begingroup\$ Okey thanks. What values in the rc filter is best?.So at the same cutoff frequency high resistance on the resistor or higher capacitance on the cap? \$\endgroup\$ – SouZ Sep 23 '19 at 21:59

As mentioned in other comments/answers, the definition of the needed S/N-ratio is missing. Some users - like broadcast studios in Europe - demand 114dB or more. It is not only about the possible Audio coupling, but any HF-interference is also critical. F.e., many users have problems to listen to weak radio stations at home when a nearby LED lamp (without enough built-in HF filtering electronic) is on, since some of those bulbs are using PWM resp. step functions in their power supplies.

Even when listening to a weak FM sender in the 100 MHz range the receiver can be flooded with noise, though the power supplies have working frequencies mostly in the 25-120kHz, way below 1 MHz. A LED light bulb needs more power then a LED for a switch illumination, but there might be still a problem.

To overcome these issues, it is always better to avoid PWM where possible in this case. With a few hundred mA of current, an option is to use non-switching series regulators. The difference is only a little bit higher energy consumption and maybe a bigger heat sink.

Some 40 years ago, there were some HiFi- FM-receiver designs with multiplexed 7 segment LED- displays. To reduce the noise, those LEDs were fed by integer numbers of rectified sine waves instead of direct current.

It was a complicated design with much shielding metal inside and this is the reason why they switched to LCDs with it's much lower current, so producing much less noise.

  • \$\begingroup\$ So it´s 3,2v at full value and i would like to keep the noise under 5mv, possible? \$\endgroup\$ – SouZ Sep 23 '19 at 12:59
  • \$\begingroup\$ @ xeeka That is excellent explanation. \$\endgroup\$ – analogsystemsrf Sep 23 '19 at 17:12
  • \$\begingroup\$ @Souz Impossible to predict, since it depends on the PCB layout, grounding concept, LED-current, signal levels etc. What seems to be very important and possible with no hardware costs: A menu option to completely switch off any LED illumination, and a clear hint/label to recommend this option in cases of recording-, broadcast-, High End HiFi- sessions etc. It may be even wise to have this option (switched off illumination) as default setting. This way the user may more easily find out if there is a problem with noise related to the illumination. The hint should be inserted anyhow. \$\endgroup\$ – xeeka Oct 3 '19 at 15:19

Lets suppose you have 100 milliamp to a LED, with 10 nanosecond rise/fall times.

The trace to the LED is long, located 1 cm from an ANALOG loop (signal plus Return) of area 1cm by 0.1 meter, with long side parallel to the LED trace.

Lets compute a worse case magnetic-field coupling into the ANALOG loop. We'll ignore some log(x) terms in the math, to make the causality very clear.

Vinduce = [ MUo * MUr * LoopArea/(2 * pi * Distance_wire_loop) ] * dI/dT

which given MUo = 4 * pi * 1e-7 Henry/meter, and MUr=1 (air, copper, FR-4 PCB insulation), becomes

Vinduce = 2e-7 * Area/Distance * dI/dT

Vinduce = 2e-7 Henry/meter * (1cm * 0.1meter)/1cm * 0.1amp/10nanoSeconds

Vinduce = 2e-7 * 0.1meter * 1amp/100 nanoseconds

Vinduce = 2e-7 * 0.1 * 1+7 = 2*10^(-7 -1 +7) = 2e-1 = 0.2 volts.

Now, at 10 nanosecond edges, the copper foil skin-effect will help shield, by attenuating the magnetic field. But you likely need 1 microvolt interference in your mix-board.

Unfortunately, if you slow the PWM edges to 100 nanoSeconds or 200 nanoSeconds, the copper foil's skin effect has approximately ZERO attenuation.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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