This repository contains a Klipper macro configuration for controlling bed fans during 3D printing. The macros dynamically adjust fan speeds based on the bed's temperature and the chamber's temperature, ensuring optimal cooling and heating conditions.
- Dynamic Fan Control: Adjusts fan speed based on bed temperature and chamber temperature.
- Heating and Cooling Thresholds: Fans are enabled or disabled depending on configurable temperature thresholds.
- Fast and Slow Fan Speeds: Uses different fan speeds for rapid cooling and steady-state conditions.
- Integration with Bed Temperature Commands: Overrides standard
M140andM190G-code commands to include fan control logic. - Delayed G-code Execution: Periodically checks and adjusts fan speeds during heating and cooling cycles.
The macro uses the following configurable variables defined in the _BEDFANVARS macro:
variable_heating_threshold: If bed temp target is above this threshold, fans will be enabled.variable_cooling_threshold: While bed is cooling down, if temp is above this threshold, fans will be controlled.variable_cooling_delta: Fast fan speed will be used for cooling until within delta of chamber tempvariable_fast: Fan speed used for printing and initial cooling.variable_slow: Fan speed used while bed is heating and while within cooling delta.variable_fan: Name of the fan to control.variable_chamber_sensor: Name of the temperature sensor to monitor while cooling.
- Heating: The fans are set to slow speed while heating until the bed reaches the heating threshold, the fans will then switch to fast speed.
- Cooling: When the bed's temperature is above the cooling threshold, the fans are controlled based on the difference between the bed and chamber temperatures. Fast speed is used for rapid cooling, and slow speed is used for steady-state cooling.
- Idle: When the bed's temperature is below the cooling threshold or matches the chamber temperature, the fans are turned off.
- Copy the
bedfans.cfgfile into your Klipper configuration directory. - Adjust the variables in the
_BEDFANVARSmacro to match your setup. - Add
[include bedfans.cfg]to yourprinter.cfg.
This implementation is based on Ellis' Bed Fans Implementation.