Gcode to turn Chamber fan on after printing ASA

Hi peeps
I would like to turn on the chamber fan after a print with ASA until the bed goes down below 50deg. I have run an exhaust duct from the printer’s chamber fan outlet to the window next to the printer.
eg
M106 P3 S255 >50 deg bed temp
M106 P3 S0 <50 deg bed temp
I know thats not the correct gcode but hopefully people will get the idea.

Cheers in advanced

Hi.
I am printing, so I cannot verify it, but you may try to add in the filament end gcode, M190 R50:
image
Note that even if it works, it is not a very good macro as the loop has no break command.

2 Likes

Agreed with @JayZay , for ease of use just put it in the filament end g-code

But if you want to multimaterial print with asa and another material, the printer will always wait at the materialchange for the hotbed to cool down.
Instead you could add the following to the machine end g-code:

{if filament_type=="ASA"}
    M106 P3 S255
    M190 R50
    M106 P3 S0
{else}
{endif}

Thanks heaps for that. Bambu got back to me and said the same gcode
M106 P3 S255
M190 R50
M106 P3 S0
I gave it a go on a small PLA print and it worked as I wanted BUT the print head doesn’t move from its last point and sits on the print and melts it. I looked as the gcode and it won’t move until the M106 P3 S0 comes true. Not sure which part to add at the top before turning the fan on. This? I also don’t want to stuff the normal gcode that comes after. I have attached what comes after circled in blue

G91
G1 Z5 F900 ; lower z a little
M106 P3 S255
M190 R50
M106 P3 S0

Screenshot 2023-09-27 185234

@tgsparky77 i would nod do that, i did it on a few models as was thinking is clever idea and on a big Models had some warping when i used max fan 255, both with ABS and ASA , or reduced layer adhesion as a minimum . both ABS and ASA love really slow cooling to release the internal pressure of the material On some models actually i added code to slowly reduce the bed temperature not using it often , but if you want just to use teh carbon filter would replace M106 P3 S255 with M106 P3 S40 (10%-20% fan max ) . If in a hurry i still do it at max but only on a small models , better than opening the door where can warp badly

1 Like

The problem with 190 is precisely the one you notice; it may get frozen, and I am not aware which Bambu command can be used to override.
It seems that editing the printer end g-code instead of the filament (see @ZundersHD ) is the most straightforward method.
There are undoubtedly elegant ways to do it, but a simple method is using the if from ZundersHD’s suggested script in two zones of the printer end g-code.

  1. Instead of :

G1 X65 Y245 F12000
G1 Y265 F3000
M140 S0 ; turn off bed
M106 S0 ; turn off fan
M106 P2 S0 ; turn off remote part cooling fan
{if filament_type=="ASA"}
         M106 P3 S255; set the fan speed
{else}
         M106 P3 S0 ; turn off chamber cooling fan
{endif}         
  1. Add at the end of the printer’s “end g-code”.
{if filament_type=="ASA"}
         M190 R50 
{endif}   
3 Likes

Hey guys would it be possible to add something like a time relation?
I dunno gCode, but in pseudo code:

if (print == done)
set_chamber_fan_speed = 100%;
wait (300sec);
set_chamber_fan_speed = 0%;

Hi guys,I need it so,timekeeping is a great function,if you know that,please told me how to change the gcode.

@Joe1 Take a look at @NeverDie or @ZundersHD code - it waits until temp reaches specific value which is probably better but if you really need it the gcode command is:
G4 P60000
or
G4 S60
or
M400 S60 ( Bambu specific)

wait/pause for 60 seconds

Strongly recommend against using the exhaust fan for ASA , initially i used it to clean the air for many reasons but affects the print . Much better just to wait with out any fan until the chamber or bed temperature is low enough

2 Likes

If you just want to wait a specific time, use G4 (Dwell), like @vladimir.minkov sugested.

@JayZay

Hello, following your good idea I wanted to do something like think to run the chamber fan 3 minutes at end of print (I cannot use the temp sensor on my P1S so I tried to use a timer).
So I tried to ad this lines in the end G-code but I got an error.

Do you see what is wrong ?

After some Google search I found a “filament_type[0]” function.
Should I use this fonction “filament_type[0]” instead of “filament_type” ?

I’m newbie in Gcode…

Thank you

Échec de la génération du G-code pour un G-code personnalisé non valide.
machine_end_gcode Parsing error at line 18: Referencing a vector variable when scalar is expected
{if filament_type=="ASA"}
    ^

My code is

G1 X65 Y245 F12000
G1 Y265 F3000
M140 S0 ; turn off bed
M106 S0 ; turn off fan
M106 P2 S0 ; turn off remote part cooling fan

;M106 P3 S0 ; turn off chamber cooling fan
;==== AJOUT PERSO =========
;==== ABS/ASA Air filtering ====
{if filament_type=="ASA"}
        M106 P3 S65   ; set the fan speed S255=100% ; S65=25%
{else}
        M106 P3 S0     ; turn off chamber cooling fan
{endif}         
;==== FIN AJOUT PERSO ====

And at the last lines

;==== AJOUT PERSO ====
{if filament_type=="ASA"}
        G4 S300          ; wait 5 minutes
        M106 P3 S0    ; turn chamber fan off
{endif} 
;==== FIN AJOUT PERSO ====

I found the solution

Instead of filament_type[0], the good code is

filament_type[current_extruder]

Now it works fine.

Finaly the solution is :

;M106 P3 S0 ; turn off chamber cooling fan ; REMOVE THIS LINE
;==== ABS/ASA Air filtering ====
{if filament_type[current_extruder]=="ASA"}
        M106 P3 S120   ; set the fan speed S255=100%
{else}
        M106 P3 S0     ; turn off chamber cooling fan
{endif}

And at the end

;==== AJOUT PERSO ====
{if filament_type[current_extruder]=="ASA"}
        M400 S300      ; wait 5 minutes
        M106 P3 S0    ; turn chamber fan off
{endif} 
;==== FIN AJOUT PERSO ====

Another way - OrcaSlicer has a built-in field to set a chamber fan speed after printing in the filament settings.