🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5Stick Cplus - max PWM frequency

    M5 Stick/StickC
    2
    2
    3.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      amr
      last edited by

      I am trying to create a fan control system for my networking rack that is in the media room. The idea is for it to control the speed of the fans (regular 12V fans) based on temperature but to turn the fans off while I watch a movie to keep the noise down. To do this I want to use ESPhome which integrates into Home Assistant. I got the basics down but I am having an issue with the PWM frequency.

      I am using G26 as the output for my PWM signal and I get a terrible whine from my fans as the frequency is way too low, likely around 1kHz. In ESPhome there is a way to adjust the frequency but if I do, the PWM signal just stays put at 6% duty cycle. This may indeed be an issue with ESPhome but to be sure I'd like to know what the M5Stick cplus is capable of in terms of maximum frequency for a PWM signal. Also, is there a better output pin to use? The ones on the other end of the device are being used with an ENV III sensor, but I could swap things around if it makes a difference.

      If this is not feasible (PWM frequency can't be 20kHz or above) then what can I do considering that most M5Stack hardware is partially, or not supported at all, in ESPhome?

      1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by felmue

        Hello @amr

        I used this example to verify that the PWM frequency can easily go higher than 20 kHz. Tested with an M5StackCPlus using GPIO26 and a PWM frequency of 100 kHz.

        That said, I have no idea how this translates into ESPHome though, sorry.

        Note: the three values pwm frequency, duty resolution and duty are dependent from each other. Check the documentation here.

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        1 Reply Last reply Reply Quote 1
        • First post
          Last post