MichaelOToole
Well-known member
After powering up the printer, I noticed my Pi 3 getting a little warm (46° C) even with no activity. It's not excessively warm but we can do better...
Went searching for code that would allow running a fan at a given percentage to keep thing cool on power up but switch to full (or say 50%) during a print cycle...
Now after switching printer on, the Pi stays pretty much at 29° C (with fan running real quiet at 20% speed)...
The link to original code is included in config.
![Pi-Electronics_2024-04-13_18-32-31.png Pi-Electronics_2024-04-13_18-32-31.png](https://forum.vorondesign.com/data/attachments/4/4567-1cf0a9be5afdd417b1fc233f34c5748c.jpg)
Idle... Electronics = Pi fan (idle speed at 20%)
![Pi-Electronics_2024-04-13_18-42-01.png Pi-Electronics_2024-04-13_18-42-01.png](https://forum.vorondesign.com/data/attachments/4/4569-e6615c895eec074e7885fdf65ea9e051.jpg)
Active... Pi = 100% (actually 50% as max speed is set to 50%)
Pi becomes active after any xyz motor movement in my case but it could be after a heater heats up (see cfg code), also note, Pi & Electronics fan use the same pin PD12
[duplicate_pin_override] is intended for debugging/testing (I believe) but it came in handy here.
There is also mention of unpredictable affects, so testing is advisable...
Of course you could just connect another fan to 5V or 24V...
Went searching for code that would allow running a fan at a given percentage to keep thing cool on power up but switch to full (or say 50%) during a print cycle...
Now after switching printer on, the Pi stays pretty much at 29° C (with fan running real quiet at 20% speed)...
Code:
# Notes:
#
# fan_generic = so it can be controlled manually or via delayed_gcode
# heater_fan = active when heater active, need to define which: heater: heater_name
# controller_fan = A "controller fan" is a fan that will be enabled whenever its associated heater
# or its associated stepper driver is active.
# The fan will stop whenever an idle_timeout is reached to ensure no overheating will occur after deactivating a watched component.
#
# Reference: https://www.klipper3d.org/Config_Reference.html?h=controller#controller_fan
#
#[controller_fan fan_name]
#pin: pin_name # pin name eg. PD14
#max_power: x.x # max speed 0.1 - 1.0 read as 10 to 100%
#kick_start_time: x.x # full speed for x time to make sure fan spins up
#shutdown_speed: x.x # if error occurs, set speed to 0.0 - 1.0 (0 - 100%) issues with this ???
#idle_timeout: 30 # keep fan active for x seconds after heater (extruder) is turned off (soak up the fumes)
#heater: ? # extruder or heater_bed
#stepper: ?,?,? # associated stepper eg. stepper_x, stepper_y, stepper_z, stepper_z1 etc...
#shutdown_speed # By default, a heater_fan has a shutdown_speed equal to max_power
# An attempt to set Pi fan speed to idle at 20% on power up, and 50% when printing... I found the code here:
# https://klipper.discourse.group/t/how-to-get-the-controller-fan-to-turn-on-at-power-up/7313/11
# It works, starts at 20%, switches to 50% on trigger by either extruder or steppers
[duplicate_pin_override] # allow reuse of pins
pins: PD12
[fan_generic electronics] # must be generic
pin: PD12
max_power: 1.0
shutdown_speed: 1.0
kick_start_time: 1
[delayed_gcode start_fan_at_idle_speed]
initial_duration: 1.0
gcode:
SET_FAN_SPEED FAN=electronics SPEED=0.2
# Controller fan - FAN0
# pin: PA8
# ...
# Controller fan - FAN1
# pin: PE5
# ...
# Controller fan - FAN2
[controller_fan Pi]
pin: PD12
max_power: 0.5 # only want 50% speed,
kick_start_time: 2.0 # full speed for x to make sure fan spins
shutdown_speed: 0.0 # if error occurs, keep fat at 100%
stepper: stepper_x, stepper_y, stepper_z # trigger by stepper (to trigger by heater, comment this line out, and un-comment next line
#heater: extruder" # trigger by heater
idle_timeout: 30 # keep fan active for x seconds after heater (extruder) is turned off
# Controller fan - FAN3
#[controller_fan Nevermore_(Filter)] #[heater_fan Nevermore_(Filter)]
#pin: PD13
#max_power: 1.0 # If shutdown_speed is 1.0, max_power must also be 1.0 to ensure fan continues in the even of a fault condition.
#shutdown_speed: 1.0 # max_power must first be set to 1.0 if shutdown_speed is set to 1.0.
#kick_start_time: 3.0 # full speed for x to make sure fan spins
#heater: extruder # associated heater/stepper
#fan_speed: 0.2 # full speed for x to make sure fan spins
#idle_timeout: 60 # keep fan active for x seconds after heater (extruder) is turned off (soak up the fumes)
# Controller fan - FAN4
[controller_fan Driver_Fan]
pin: PD14
max_power: 0.5 # max speed 100% might be too loud for these fans unless dampened (may change for quieter fans later)...
kick_start_time: 0.5 # full speed for x to make sure fan spins
shutdown_speed: 0.0 # if error occurs, keep fat at 100%
stepper: stepper_x, stepper_y, stepper_z # trigger on stepper or heater
idle_timeout: 30 # keep fan active for x seconds after heater (extruder) is turned off
# Controller fan - FAN4
# pin: PD15
# ...
# Controller fan - FAN3
[fan_generic Nevermore] #[heater_fan Nevermore_(Filter)]
pin: PD13
max_power: 1.0 # If shutdown_speed is 1.0, max_power must also be 1.0 to ensure fan continues in the even of a fault condition.
shutdown_speed: 1.0 # max_power must first be set to 1.0 if shutdown_speed is set to 1.0.
kick_start_time: 3.0 # full speed for x to make sure fan spins
#heater: extruder # associated heater/stepper
#fan_speed: 0.2 # full speed for x to make sure fan spins
# Controller fan - FAN?
#[fan_generic part_cooling]
#pin: EBBCan:gpio13
#max_power: 1.0 # If shutdown_speed is 1.0, max_power must also be 1.0 to ensure fan continues in the even of a fault condition.
#shutdown_speed: 1.0 # max_power must first be set to 1.0 if shutdown_speed is set to 1.0.
#kick_start_time: 3.0 # full speed for x to make sure fan spins
[gcode_macro Part_Cooling_Fan]
gcode:
{% if printer['fan_generic part_cooling'].speed > 0 %}
SET_FAN_SPEED FAN=part_cooling SPEED=0
{% else %}
SET_FAN_SPEED FAN=part_cooling SPEED=1
{% endif %}
[gcode_macro Cooling_Fan_PLA]
gcode:
SET_FAN_SPEED FAN=part_cooling SPEED=1.0
[gcode_macro Cooling_Fan_ASA]
gcode:
SET_FAN_SPEED FAN=part_cooling SPEED=0.1
[gcode_macro NEVERMORE_ONOFF]
gcode:
{% if printer['fan_generic Nevermore'].speed > 0 %}
SET_FAN_SPEED FAN=Nevermore SPEED=0
{% else %}
SET_FAN_SPEED FAN=Nevermore SPEED=1
{% endif %}
[gcode_macro NEVERMORE_PLA]
gcode:
SET_FAN_SPEED FAN=Nevermore SPEED=0.25
[gcode_macro NEVERMORE_ASA]
gcode:
SET_FAN_SPEED FAN=Nevermore SPEED=1.0
![Pi-Electronics_2024-04-13_18-32-31.png Pi-Electronics_2024-04-13_18-32-31.png](https://forum.vorondesign.com/data/attachments/4/4567-1cf0a9be5afdd417b1fc233f34c5748c.jpg)
Idle... Electronics = Pi fan (idle speed at 20%)
![Pi-Electronics_2024-04-13_18-42-01.png Pi-Electronics_2024-04-13_18-42-01.png](https://forum.vorondesign.com/data/attachments/4/4569-e6615c895eec074e7885fdf65ea9e051.jpg)
Active... Pi = 100% (actually 50% as max speed is set to 50%)
Pi becomes active after any xyz motor movement in my case but it could be after a heater heats up (see cfg code), also note, Pi & Electronics fan use the same pin PD12
[duplicate_pin_override] is intended for debugging/testing (I believe) but it came in handy here.
There is also mention of unpredictable affects, so testing is advisable...
Of course you could just connect another fan to 5V or 24V...
Last edited: