In Klipper firmware, the [controller_fan] module is typically used to control mainboard cooling fans (such as stepper motor driver fans or general mainboard cooling fans). By default, it may only follow the stepper motors. This guide will show you how to modify your configuration file so that the mainboard fan activates based on the extruder and heater bed instead.
When the extruder or the heater bed starts heating, the mainboard fan automatically turns on; when both stop heating and cool down, the fan automatically turns off.
Open your Klipper configuration file (usually printer.cfg) and find the [controller_fan board_fan] section (refer to the section pointed to by the red arrow in the screenshot).
You need to remove the existing stepper parameter (if present) and add the heater parameter to specify which heaters the fan should follow.
Before (Example):
[controller_fan board_fan]
pin: PA9
max_power: 1.0
shutdown_speed: 1.0
cycle_time: 0.01
fan_speed: 1.0
stepper: stepper_z,stepper_z1 # Original logic may follow Z-axis motors
After (Example):
[controller_fan board_fan]
pin: PA9
max_power: 1.0
shutdown_speed: 1.0
cycle_time: 0.01
fan_speed: 1.0
heater: extruder, heater_bed # Original logic may follow extruder and heat bed
pin: Keep as is (e.g., PA9), this is the pin the fan is connected to.
max_power: Maximum power, keep as is (e.g., 1.0).
shutdown_speed: Speed when shut down (e.g., 1.0). Usually 0.0 means stop, but based on the screenshot, keep 1.0 or change to 0.0 depending on your hardware logic.
fan_speed: Fan speed during operation (e.g., 1.0 means 100% full speed).
heater: The core modification. Enter extruder, heater_bed here. This tells Klipper that as long as either of these two heaters is active (heating), the fan will start. If both are off, the fan will stop based on idle_timeout (if set) or immediately.
Note: If you only want it to follow the extruder, you can write just heater: extruder.
Comma Separation: In the heater parameter, multiple device names must be separated by English commas ,.
Name Matching: Ensure that extruder and heater_bed match exactly with the [extruder] and [heater_bed] section names defined in your configuration file.
Save & Restart: After modification, save the printer.cfg file and click "SAVE & RESTART" in the Klipper interface for the configuration to take effect.
Testing: After restarting, you can test by using the console command SET_HEATER_TEMPERATURE HEATER=extruder TARGET=50. When the extruder starts heating, the mainboard fan should start spinning.