deenigewouter
Posts: 1
Joined: Sat Dec 09, 2017 7:05 pm

High pitched noise when fading LED's via PWM

Sat Dec 09, 2017 7:41 pm

I've been using the raspberry pi B Rev2 to control a RGB led strip containing 5050smd LED's. I've connected the strip to my raspberry pi with mosfets, one for each channel. I've also added a usb sound card to let my leds react to music. My amp and raspberry pi are connected to the input source via an audio splitter.

When I control the lights via PIGPIOD and set the LED's at full brightness, everything is fine and no noise is heard. However, when I set them at a lower brightness, for example with the command

Code: Select all

pigs p 17 200
the corresponding color dims but a high pitched noise is emitted from the speakers connected to my amplifier. This is very annoying, as the software I use to let my LED's dance (LightshowPi) uses pwm fading to dim the LED's rather then switching them off entirely to create a nicer looking effect.

Is there any way to eliminate this high pitched noise? I've added a basic schematic to show what my setup looks like.

Thanks in advance!

Image

PhilBr
Posts: 30
Joined: Tue Oct 31, 2017 5:28 pm

Re: High pitched noise when fading LED's via PWM

Sat Dec 09, 2017 11:32 pm

I would try an electrolytic capacitor between vcc and ground on your board. Something like 100 microfarad 25 volt.
I guess that the pwm switching is putting noise back via the power supply.
Phil

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 10652
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: High pitched noise when fading LED's via PWM

Sat Dec 09, 2017 11:57 pm

MOSFET gates should not put a load on your GPIO pins (unless the gates are zener protected, and the zener voltage is actually below 3.3V, but that is a long stretch). You can test that by placing a say 10K resistor in series with the GPIO wires running to the gates.

so with no load on the GPIO's there should not be any voltage modulation on the power.

Still there could be some wiring issue with voltage modulation entering through the ground wire between the LED's and the PI, that ends up in the sound device, you could eliminate that by using opto-isolators between the GPIO's and the LED driver FETs.

User avatar
davidcoton
Posts: 3000
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: High pitched noise when fading LED's via PWM

Sun Dec 10, 2017 11:47 am

It could be that the PWM frequency is radiating from the LED strip. You may need to screen all the audio circuits so they don't pick it up (the sulution is really to avoid radiating the PWM frequency in the first place, but that might be tricky).
"Thanks for saving my life." See https://www.raspberrypi.org/forums/viewtopic.php?p=1327656#p1327656
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”

drgeoff
Posts: 8201
Joined: Wed Jan 25, 2012 6:39 pm

Re: High pitched noise when fading LED's via PWM

Sun Dec 10, 2017 11:02 pm

If you are doing what the drawing shows ie using the microphone input to that USB sound dongle, it is rather sensitive and will readily pick up the PWM emitted by wires and breadboard tracks.

Return to “Advanced users”

Who is online

Users browsing this forum: No registered users and 19 guests