Jump to content

Exhaust fan macro?


ken226

Recommended Posts

Anyone know,  is it possible to change my exhaust fan config so that the fan stays on if the bed temp is 75° or below,   but shuts off when the bed temp reaches 76° and above?

 

The airflow from the exhaust fan tends to cause ABS to curl up from the build plate.  If I leave the exhaust fan off, I don't have the issue.   

Problem is, if I forget to comment out the exhaust fan section in the config file before I start an ABS print, I get some adhesion problems. 

 

 

Another option, perhaps, if anyone knows how?  Is there a macro I can use that would give me an on/off button in Mainsail, for the exhaust fan?

 

edit:  I figured out how to configure it as a fan_generic, which gives me a slider in Mainsail, so I can control it manually.  That'll work for me,  unless someone knows how to configure it to shut off above a specific bed temp.

Edited by ken226
Link to comment
Share on other sites

You can run a delayed_gcode macro that checks the bed temperature and only turns the fan on after the bed hits a certain temperature. Another option is to add a filament name parameter to your print_end and send that in your end gcode from the slicer, then check that in your print_end and only run the exhaust fan section if it's not ABS.

 

Link to comment
Share on other sites

48 minutes ago, claudermilk said:

Another option is to add a filament name parameter to your print_end and send that in your end gcode from the slicer, then check that in your print_end and only run the exhaust fan section if it's not ABS.

Ok.   I was able to figure out how add the filament type parameter in Prusa Slicer.  I added it to the print_start output, and verified that the print_start output from Prusa Slicer now shows the filament type.  

I havn't been able to figure out how to create macro in Klipper that checks the filament type, and activates the fan if it's not ABS. Do you happen to have an example of that macro?

 

Edited by ken226
Link to comment
Share on other sites

I don't. Since my vent fan is tied to my chamber thermistor and I run it until that drops to the set level, I'm doing the opposite of what you want.

A quick structure for what might work for you would be something like this:

 {% set _filament = params.FILAMENT|string %}
 
 {% if _filament != "ABS" %}
	# activate fan here
 {% endif %}

Basically it's just checking if your sent variable is NOT ABS, then turn on the fan.

  • Like 1
Link to comment
Share on other sites

53 minutes ago, claudermilk said:

I don't. Since my vent fan is tied to my chamber thermistor and I run it until that drops to the set level, I'm doing the opposite of what you want.

A quick structure for what might work for you would be something like this:

 {% set _filament = params.FILAMENT|string %}
 
 {% if _filament != "ABS" %}
	# activate fan here
 {% endif %}

Basically it's just checking if your sent variable is NOT ABS, then turn on the fan.

Awesome. Thank you!

I'll be able to test it this evening, when I get home.

Link to comment
Share on other sites

8 hours ago, claudermilk said:

I don't. Since my vent fan is tied to my chamber thermistor and I run it until that drops to the set level, I'm doing the opposite of what you want.

A quick structure for what might work for you would be something like this:

 {% set _filament = params.FILAMENT|string %}
 
 {% if _filament != "ABS" %}
	# activate fan here
 {% endif %}

Basically it's just checking if your sent variable is NOT ABS, then turn on the fan.

 

It almost works, but not quite.   

If prusaslicer adds PLA or PETG to the start_print output, the fan comes on, as it should.   But, the fan also comes on when ABS is present.

 

 

This is what the output in the gcode file looks like.  PrusaSlicer's output parameter simply adds "ABS".  

M190 S110 ; set bed temperature and wait for it to be reached
M104 S235 ; set temperature
;TYPE:Custom
; M190 S0
; M109 S0 ; uncomment to remove set&wait temp gcode added automatically after this start gcode
print_start EXTRUDER=235 BED=110
ABS
M109 S235 ; set temperature and wait for it to be reached
G21 ; set units to millimeters
G90 ; use absolute coordinates
M83 ; use relative distances for extrusion

 

And, this is my print_start macro:

[gcode_macro PRINT_START]
#   Use PRINT_START for the slicer starting script - please customise for your slicer of choice
gcode:
    G32                            ; home all axes
    G1 Z20 F3000                   ; move nozzle away from bed
    STOP_LED_EFFECTS ;cancel all others
    led_printing
    bed_mesh_profile load=default
    {% set _filament = params.FILAMENT|string %}
    {% if _filament != "ABS" %}
    SET_FAN_SPEED FAN=Exhaust_Fan SPEED=0.6
    {% endif %}

 

Any Idea what i'm doing wrong?

 

Also, when the print starts, I see this in the console.  The two commands in red, are me turning off the fan manually with the slider.

image.png.30d257f50093b4ef04cd258bd8abab0d.png

Edited by ken226
Link to comment
Share on other sites

That code looks ok to me. I wonder how the slicer print_start call is set up.

Here's my print_start call from SuperSlicer (Prusa Slicer and Orca Slicer are almost identical):

PRINT_START BED=[first_layer_bed_temperature] HOTEND={first_layer_temperature[initial_extruder]+extruder_temperature_offset[initial_extruder]} CHAMBER=[chamber_temperature] SIZE={first_layer_print_min[0]}_{first_layer_print_min[1]}_{first_layer_print_max[0]}_{first_layer_print_max[1]} FILAMENT={filament_type[0]}

and print_end

PRINT_END FILAMENT={filament_type[0]} CHAMBER=[chamber_temperature] 

BED and HOTEND should be obvious and pretty universal.

CHAMBER reads the Chamber setting on the Filament/Temperature section; this is informational on the slicer end, but I use it to determine whether to turn on my Nevermore during the print and the exhaust after the print.

SIZE is auto-generated and used by KAMP for adaptive purge and bed mesh

FILAMENT is what we are interested in here and picks up from the Filament Type setting. That gets read into the _filament parameter as i showed in the previous post.

Note that I am sending CHAMBER and FILAMENT in both start and end because both need it.

  • Like 1
Link to comment
Share on other sites

38 minutes ago, claudermilk said:

That code looks ok to me. I wonder how the slicer print_start call is set up.

 

Here is the Start G-code field, from PrusaSlicer:

image.thumb.png.24c972affbde5550d50bc35b81166f4e.png

 

And, here is the print_start portion of my Gcode

 

image.png.9d974ee015a58097e1f202cefa86bb29.png

 

In Prusa Slicer's Start G-code field, I've tried "Filament_type={filament_settings_id[0]}",   "Filament={filament_settings_id[0]}", and just "{filament_settings_id[0]}" 

In all cases, the exhaust fan still comes on, as if it was PLA loaded.  It seems to totally ignore the "ABS"

Link to comment
Share on other sites

Fired up my Prusa Slicer, here's my start G-code

PRINT_START BED=[first_layer_bed_temperature] HOTEND={first_layer_temperature[initial_tool]} CHAMBER={if filament_type[0] == "ABS"}28{else}0{endif} FILAMENT={filament_type[0]}

Here is the output line in the resulting G-Code from that:

PRINT_START BED=55 HOTEND=215 CHAMBER=0 FILAMENT=PLA

 

Link to comment
Share on other sites

If my Gcode file says FILAMENT=ABS,   i get an error "unknown command FILAMENT="

IF MY Gcode file says ; FILAMENT=ABS,  klipper accepts the command,  but the fan still doesn't operate correctly.    So, is the ; necessary? I noticed that you don't have it in yours.

Link to comment
Share on other sites

14 minutes ago, ken226 said:

So, is the ; necessary? I noticed that you don't have it in yours.

No, that comments the command out - Klipper then ignores this statement.

  • Like 1
Link to comment
Share on other sites

18 minutes ago, mvdveer said:

No, that comments the command out - Klipper then ignores this statement.

I'm not sure what's going on with it.  When i remove the ;  i get "unknown command-FILAMENT="

Edited by ken226
Link to comment
Share on other sites

43 minutes ago, ken226 said:

I'm not sure what's going on with it.  When i remove the ;  i get "unknown command-FILAMENT="

I am not at all confident in my abilities to write macro's. But looking at the example from @claudermilk

 

2 hours ago, claudermilk said:
PRINT_START BED=[first_layer_bed_temperature] HOTEND={first_layer_temperature[initial_tool]} CHAMBER={if filament_type[0] == "ABS"}28{else}0{endif} FILAMENT={filament_type[0]}

this needs to go in the Custom Code section of your slicer settings, not the PRINT_START macro.

Your filament settings there is commented out:

10 hours ago, ken226 said:

Here is the Start G-code field, from PrusaSlicer:

image.thumb.png.24c972affbde5550d50bc35b81166f4e.png

Why don't you copy the above line of code into your slicer and try it to see if it works.

Link to comment
Share on other sites

1 minute ago, mvdveer said:

I am not at all confident in my abilities to writ macro's. But looking at the example from @claudermilk

this needs to go in the Custom Code section of your slicer settings, not the PRINT_START macro.

Your filament settings there is commented out:

Why don't you copy tis and try

I did. 

I have tried it many, many different ways, including commented out,  not commented out, using the term "Filament_type=ABS, (in both the macro and slicer),   FILAMENT=ABS (in both the macro and the slicer).  And about a hundred other things.  

I've tried with his macro, and with several others ive found on github and discord.  It always says this,  and ignores the presence of the ABS or PLA callout from Prusa Slicer.

image.png.245eacc2e57802889f801bd426503c32.png

Link to comment
Share on other sites

I use a bedfans.cfg file with the macros for the fans in there. This is where I control the speed of the fans for different filaments. However this is set to my bed temperature.

This is where you decide when to turn the fans on:

[gcode_macro _BEDFANVARS]
variable_threshold: 80		# If bed temp target is above this threshold, fans will be enabled. If temp is set to below this threshold, fans will be disabled.
variable_fast: 0.6		# Fan speed once bed temp is reached  
variable_slow: 0.2		# Fan speed while bed is heating
gcode:

Don't know if this might solve your problem. Worth a try. 

bedfans.cfg

Link to comment
Share on other sites

23 minutes ago, mvdveer said:

I use a bedfans.cfg file with the macros for the fans in there. This is where I control the speed of the fans for different filaments. However this is set to my bed temperature.

This is where you decide when to turn the fans on:

[gcode_macro _BEDFANVARS]
variable_threshold: 80		# If bed temp target is above this threshold, fans will be enabled. If temp is set to below this threshold, fans will be disabled.
variable_fast: 0.6		# Fan speed once bed temp is reached  
variable_slow: 0.2		# Fan speed while bed is heating
gcode:

Don't know if this might solve your problem. Worth a try. 

bedfans.cfg 4.19 kB · 0 downloads

 

 

 

I'm trying to do the opposite of that.  I want the exhaust fan to stay off if im printing ABS, and to turn on if im printing PLA or PETG.   

With the fan configured as a heater_fan, i havn't been able to figure out a way to have the fan activate if the bed temp is below a specific value.   Thats why I set it as a generic_fan,  and decided to try a macro that activates the exhaust fan (generic_fan) for anything other than ABS.  

 

I've seen alot of macros very similar to Claudermilk's, and have tried most of them.  Just not having any luck getting klipper to recognize any filament related code from prusaslicer.  Pretty much everything is "unknown" command.

 

Your bedfans config looks to be way over my head.  

 

are these macros and prusa slicer outputs case sensitive?  Should i be going through and making certain the all of the "filament=ABS" and "filament=PLA" stuff is in the same case?

 

Edited by ken226
Link to comment
Share on other sites

The last attempt had Prusa Slicer outputting FILAMENT_TYPE=ABS in the start Gcode

and this in my print_start macro:

 

 

image.png.773015f3fa2279544cd9c7bf4160c8fc.png

 

 

The results were the same:

 

image.png.2f30dbd869bc1113323e49886810bf28.png

 

and, Klipper completely ignores the FILAMENT_TYPE=ABS, in the gcode file.

Link to comment
Share on other sites

Ha!! I got it working....  it's fairly simple, but I would have never figured it out on my own.  

Another headscratcher, solved.  I really appreciate the help guys.

 

Rootiest's macro and slicer settings, from Github was the starting point, then I just modified his macro.

https://github.com/rootiest/zippy-klipper_config/blob/master/macros/SET_MATERIAL.cfg

 

I set up Prusa Slicer's start gcode, as per the link above,  then created a separate SET_MATERIAL macro, in my macros.cfg file

So far, i've tested it by changing the fan speed settings and printing some little 25mm coins, in each of several materials.   So far, its working perfectly.

 

So, the Prusa Slicer start gcode:

image.png.f13a789905b306b1c1709e10fcb502e1.png

 

 

and the working macro:

image.png.0d35c789066b038059b862798ad3d541.png

 

I also added a print_end macro, to run the exhaust fan full speed for one minute, after the completion of a print.

 

 

Edited by ken226
  • Like 1
  • Voron FTW! 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...