High pitched whine from femtobuck

I have a [femtobuck connected to [5 LEDs in series and powered by a 24V power supply. It is controlled via a PWM pin on a [RedBoard Qwiic (powered via USB).

When the light is off or on full, all is ok. But at any other brightness level, there is a very annoying high pitched whine coming from the femtobuck. The whine will also stop if I disconnect the LEDs. Do I have something hooked up wrong? Is it defective? Or is that just the way they are?](SparkFun RedBoard Qwiic - DEV-15123 - SparkFun Electronics)](https://www.sparkfun.com/products/13104)](https://www.sparkfun.com/products/13716)

You might be hearing the PWM frequency you’re controlling the brightness with. If you can, see if a higher or lower frequency eliminates the noise.

I am slowly ramping the brightness of the LEDs from off (0) to full on (255) over many minutes. I can hear the whine for all values except 0 and 255.

That doesn’t change the PWM frequency, only the duty cycle. I assume you’re using an arduino, if that’s the case, the link below might be helpful in changing the PWM frequency to something less audible.

https://www.etechnophiles.com/change-fr … duino-uno/

Yes, that made a big difference. I can hear the whine at lower PWM frequencies (pitch is lower) but not at the higher frequencies. However making that change (for pin D5) seems to have a side affect of altering when [timers run and how fast millis() increases.](arduino-timer - Arduino Reference)

The part making noise is likely the inductor on the board. (the big black thing labeled 330)

Only other thing I can think to try would be to pot the board in epoxy to see if that dampens the sound, or try a second board that might have a less noisy inductor.

Switching the pin used for the femtobuck to D3 and bumping the PWM frequency to the max worked without breaking millis() and delay() as it did with pin D5.

// Set PWM frequency for PINs D3 and D11
TCCR2B = TCCR2B & B11111000 | B00000001; // 31372.55 Hz