M5Stick Cplus - max PWM frequency
-
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?
-
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
andduty
are dependent from each other. Check the documentation here.Thanks
Felix