Help needed..Gcode to run exhaust fan until temp is below 40C (still trying out)

SOVOL ZERO…I print petg and don’t need to run exhaust fan during print . In printer.cfg increased target temp to 90(because bed temp is 90C). This works well

However I want to run exhaust fan to cool down at END_PRINT (before TURN OF ALL FAN)…what is Gcode or macro to be added so that exhaust fan runs until chamber temp is below 40c…I also need this to avoid heat creep at hotend which causes heartbreak clogging

Thanks in advance

Use my exhaust fan modifications PID Controlled Exhaust Fan (Quiet!) and you can use the M141/M191 commands to set whatever chamber temperature you want whenever you want. This new fan behavior is generally quieter since its throttled, rather than simply banging on or off.

Personally, I’d set a reasonable chamber temperature (32°C or 50°C are common, and possibly up to ~60°C for PETG) during the print, so your heat creep pulse at the end isn’t so extreme. However, if you’re rather keep it just in the END_PRINT macro, I’d use M191 R, so it waits until it actually cools down before turning off the fans.

Hi RPCyan…thanks for the link and changes in cfg.

However, after making modi, I ran M191 S60 and got these errors

Error on ‘TEMPERATURE_WAIT’: missing MINIMUM or MAXIMUM.

Error on ‘TEMPERATURE_WAIT’: missing MINIMUM or MAXIMUM.

What shall I do?

Thanks in advance

Ah, well I guess I haven’t tried my own M191 command yet! Evidently you have to spell out MIN & MAX, so the last few lines of that macro should read:

        {% if r != -9999 %}
            {% set tol = 1.0 %}
            {% set t_min = target - tol %}
            {% set t_max = target + tol %}
            TEMPERATURE_WAIT SENSOR="temperature_sensor chamber_temp" MINIMUM={t_min} MAXIMUM={t_max}
        {% else %}
            TEMPERATURE_WAIT SENSOR="temperature_sensor chamber_temp" MINIMUM={t_min}
        {% endif %}
    {% endif %}

I’ll make the correction in the other thread too, along with some other tweaks.

Also, I was mistaken earlier. It should be M191 R60
R60 will waits for both heating or cooling
S60 just waits for heating

Not sure why that the hot end fan continued to run indefinitely even then chamber temp and hotend temp have dropped to below 60C…this stopped the END_PRINT macro to continue to execute next few steps(esp ALL_FAN_Off -

ALL_FAN_OFF
M220 S100
M221 S100
SET_GCODE_VARIABLE MACRO=_global_var VARIABLE=filament_sensor_print VALUE=False
CLEAR_PAUSE
PRINT_END
M84 X Y Z E

Is there a way to stop all fans (and LED) once hotend has dropped to below 40C(ambient temp here is about 35C)?

Within your END_PRINT macro, try:

M191 R40
CHAMBER_OFF
ALL_FAN_OFF
mainled_off
SET_GCODE_VARIABLE MACRO=_global_var VARIABLE=filament_sensor_print VALUE=False
CLEAR_PAUSE
PRINT_END
M84 X Y Z E

still trying cos facing some irregularity

still having problem at the END_PRINT…it stays at 99% Printing

Extruder temp is at 45C (Hotned fan jumping from 0%-100% and back 0% (cycle of like less than 1 second)

Chamber temp is 45C (Exhaust fan kept running at 15% (3500rpm) indefinitely)

It does not go to LED off too

Screen on Printer showed “Printer is shutdown. Restart the Printer error code :61”

It makes sense that it stays at 99% printing - it is still running rather lengthy, possibly indefinite, commands as part of the END_PRINT macro!

I can’t speak to the extruder fan behavior, as my modifications don’t touch that. It seems like the all_fan_off is getting called, but quickly overwritten by another command, and that it may be in a loop…

Similarly strange that mainled_off isn’t getting called (or a mainled_on call is also happening shortly thereafter).

None of this should have resulted in a shutdown or error code 61.

Please post your macro.cfg and printer.cfg (along with any other modified files) in full

Also Zip and upload klippy.log. We should be able to find what is stalled or looped.

RESOLVED….went back to original Printer.cfg and Macro.cfg.

In Printer.cfg, exhaust target temp :70 C (this allows chamber to stay “warm” and little heat loss from bedplate)

As for the end_print, the heatbreak fan continue to run till below 45C( this is not set by end_print Macro. it is in printer.cfg). The heatbreak will continue to cool down by the fan if printer is On which eliminates the heatcreep/clogging problem.

Thanks to all who contributed to this thread