PWM Fan control with ESP32

Dear Enrique, i would like to do exactly the same like your project. Can i ask you to share your code and some explenation of the wiring? I dont know which GPIO i can use to hook up a tempsensor 3.3v, two 4pin fans (external powered), 3pin led (external powered). What can i connect where?

Hello, I’m just trying this with a Noctua fan and a Lolin ESP32 C3 mini. I can confirm PWM works with 3.3v but I can’t turn the fan off. When off it goes to the lowest speed. Below is my code, and also the pulse counter shows very high values not realistic, do you have any tips?

sensor:
  - platform: pulse_counter
    pin: GPIO0
    name: PWM Fan RPM
    id: fan_pulse
    unit_of_measurement: 'RPM'
    filters:
      - multiply: 0.5
    count_mode:
      rising_edge: INCREMENT
      falling_edge: DISABLE
    update_interval: 3s

output:
  - platform: ledc
    pin: GPIO1
    frequency: 25000 Hz
    id: fanhub_pwm

fan:
  - platform: speed
    output: fanhub_pwm
    name: "PWM Fan"

EDIT:
I’ve done some testing with a wemos D1 mini ESP8266 (using platform: esp8266_pwm instead of ledc) and had the same behavior.
Then realized the fan needs a shared ground to turn off from the pwm signal, and I was using a separate usb wall adapter.
So I powered the wemos with a buck converter to 3.3v coming from the 12V shared with the fan and everything worked. To make the pulse counter work I had to enable the pullup resistor on the pin.
Everything worked and I was confident for the ESP32 but when I tried the same I realized I can’t make it power up with 3.3V on the 3.3V pin and not even with 5V on the VBUS pin, it only power up with usb.