PWM Fan boot failure

I am having a little challenge controlling 12v PWM fans with ESPHome.

Everything works as expected, fan control etc, and my fans shut down when less than 5% on PWM.

Problem I have is, on boot, fans start at (guessing from sound) 100% and my ESP32 never becomes available in HA. If i disconnect power to the fans, and allow the ESP32 to boot before connecting power to the fans, all is good.

I have this issue with the usual ESP32 boards i buy from amazon (3 pack ESP32 ESP-32S Development Board 2.4 GHz Dual Core WLAN WiFi + Bluetooth 2-In-1 Microcontroller ESP-WROOM-32 Chip CP2102 for Arduino (3PCS): Amazon.co.uk: Business, Industry & Science), but i also tested with an ESP32 C6, which DOES NOT suffer the same issue.

I know i could add a relay or mosfet etc to manage power to the fans, but I was hoping someone might be able to point me to a config fix.

It feels like starvation of power to the board stopping it booting properly, but given this happens with one 12v fan through a 3amp 12v DC plug with a buck down to 5v powering the ESP32, i cant really see how it would be starved. I will try and post my config when i figure out how.

esphome:
  name: enclosure-extractor-fan
  friendly_name: Enclosure Extractor Fan

esp32:
  board: esp32dev
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxx"

ota:
  - platform: esphome
    password: "xxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Enclosure-Extractor-Fan"
    password: "UFj1UGgtvkeH"


# Define the PWM output for the fan
output:
- platform: ledc
  pin: GPIO12
  frequency: 25000 Hz
  id: pwm_output
- platform: ledc
  pin: GPIO26
  frequency: 25000 Hz
  id: pwm_output2

# Define the fan component using the PWM output
fan:
- platform: speed
  output: pwm_output
  name: "PWM Fan"

- platform: speed
  output: pwm_output2
  name: "PWM Fan 2"

# RPM
sensor:
- platform: pulse_counter
  pin: GPIO14
  name: "Fan RPM"
  unit_of_measurement: "RPM"
  filters:
   - multiply: 0.5 # Adjust based on your fan's pulses per revolution

- platform: pulse_counter
  pin: GPIO27
  name: "Fan RPM2"
  unit_of_measurement: "RPM"
  filters:
   - multiply: 0.5 # Adjust based on your fan's pulses per revolution

Thanks in advance.

Have tried a different pin other than 12 for your fan? Apparently that is a strapping pin and boot fails if pulled high. Probably isn’t a strapping pin for a C6.

1 Like

You star EBME2!

I have suffered the same issue with two builds, and I have just checked and both happen to be using pin 12, I have just moved over to a different pin and problem solved.

I knew it would be something simple, and I should have spotted this myself, but I overlooked it.

Thank you so much for spending the time to respond, and sorting my issue for me, have a great weekend.