My project is a “breathing” white 12v LED strip controlled by an esp32 on a dev board, and switched with an IFLZ44N mosfet.

In my video you can see it working but also hear the power supply complaining.

I’m using the LEDC Arduino library which allows me to select the frequency and resolution for PWM.

If I set the frequency too low the whine is extreme, but at this setting it’s the best I’ve been able to achieve, which is about 9000Hz. Unfortunately you can still hear the sound from across the room!

It is a cheapo solid state power supply that claims it can output 12v up to 25A. I tried my desktop supply and it emits some whine too, so I don’t think replacing the power will totally fix this.

Is there a technique for tuning the frequency or even just masking it somehow?

  • sramder@lemmy.world
    link
    fedilink
    English
    arrow-up
    7
    ·
    9 months ago

    What’s limiting your PWM frequency? You want it above 25 KHz so it’s outside the range of human hearing.

    • nucleative@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      4
      ·
      9 months ago

      I think the limitation is my own knowledge of this LEDC library. When I run it with the frequency value of 25,000 it doesn’t output anything on my GPIO pin that I can detect with my multimeter.

      • sramder@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        9 months ago

        I’m reading the docs and it seems capable of running up into the MHz range although at higher frequencies the duty cycle resolution is reduced. Although I wouldn’t expect most multimeters to detect a frequency that high, anything should pick up the voltage.

        Do you get an error on the serial monitor? It should report if the frequency/duty-cycle range you’re requesting isn’t possible.

        E (196) ledc: requested frequency and duty resolution cannot be achieved, try reducing freq_hz or duty_resolution. div_param=128