Smart Home Automation Forum

Full Version: PWM support?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(09-22-2024, 11:36 PM)admin Wrote: [ -> ]KCS not support PWM output. you can try to use by ESPHome.

Update to this thread got it working in ESPHome with the following config:

Code:
# PWM output for fan control
output:
  - platform: ledc
    pin: GPIO14
    id: fan_output
    frequency: 25000Hz
    min_power: 0.0
    max_power: 1.0

fan:
  - platform: speed
    output: fan_output
    name: "PWM Fan"
    id: pwm_fan
    speed_count: 100

sensor:
  - platform: pulse_counter
    pin:
      number: GPIO32
      mode:
        input: true
        pullup: true
    name: "Fan RPM"
    id: fan_rpm
    unit_of_measurement: "RPM"
    filters:
      - multiply: 0.5
      - lambda: return round(x);  # Round to nearest whole number
    accuracy_decimals: 0  # Display no decimal places
    update_interval: 3s
    count_mode:
      rising_edge: INCREMENT
      falling_edge: DISABLE

  - platform: template
    name: "Fan Speed Percentage"
    id: fan_speed_percentage
    unit_of_measurement: "%"
    accuracy_decimals: 0
    lambda: |-
      return (id(fan_rpm).state / 6600.0) * 100.0;
    update_interval: 3s
good.
Pages: 1 2