Min speed and initial speed for tacho fans

I have a 4-wires PSU fan which I can control via PWM and which I can read via tacho.

The idea is to lower the speed of the PSU fan (quite noisy even after using a Noctua), since at idle the PSU really doesn’t need much cooling power.

Obviously that fan must stay always on, off is not an option.

I am using “generic_fan” because I plan to adjust the speed manually via GCODE. I cannot use “output_pin” because it has no tacho.

I found generic_fan has no setting for power upon startupt (while output_pin does via value:) so I have to use a macro upon startup.

Yes when a macro can do it, we should use a macro, but isn’t this a basic feature of fans? default off, but I think it should be there! Output_pin has it, why not fans.

The macro would be:

[delayed_gcode start_psu_fan]
initial_duration: 1.0
gcode:
  SET_FAN_SPEED FAN=psu_fan SPEED=0.5

Another point is the limitation of the minimum speed. Again a macro can do it, but isn’t this another basic feature of (some) fans like mine?

[gcode_macro SET_FAN_SPEED]
rename_existing: SET_FAN_SPEED_BASE
gcode:
  {% set fan = params.FAN %}
  {% set spd = params.SPEED|default(1.0)|float %}
  {% if fan == "chamber_fan" and spd < 0.25 %}
    {% set spd = 0.25 %}
  {% endif %}
  SET_FAN_SPEED_BASE FAN={fan} SPEED={spd}

We could have “off_disabled” which, in connection with off_below, would provide the feature I refer to.

I an do these small changes, and I think that it would make the fan handling more complete, but first I need to know it’s going to be accepted, or it’s a waste of time.

@koconnor if you say you don’t want it, I’ll keep the macros, but it seems an hack which shouldn’t be needed in the first place. Especially the “power at startup” which is offered by output_pin!

Klipper has this: Display_template for fan control
Another example: TMC2240 use temp for fan control
It should cover most of the cases where one needs “custom” behaviour

Otherwise, regarding the PSU’s Fan, normally it is enough to use a thermostat to do so.
Internally, it is possible to either attach it to the MOSFETs or to the inductor coil.

-Timofey

You still use a macro to start the fan at startup…

My suggestions is not THAT unreasonable after all.

It’s just one more parameter for all fan which applies to all fan sections, it’s pretty easy to add.

But thanks for the tip about the template for fan speed over temperature, I will use it.

I was setting up the thermistor connected to an ADS1115 board but I realised that I didn’t power that board… So I need to open the printer to add a jumper wire.

I already screwed the thermistor to the heatsink of the PSU.