• Models
  • Contests
  • Slicer
  • Login
  • Start Here
    thingiverse-iconprintables-iconcults3d-iconmakerworld-iconmyminifactory-icon

    3D GO

    3D ModelsContestsCollectionsSaved ModelsOn a mobile device?

3D GO

Privacy Policy
smart filament sensor 3D Printer File Image 1
smart filament sensor 3D Printer File Image 2
smart filament sensor 3D Printer File Thumbnail 1
smart filament sensor 3D Printer File Thumbnail 2

smart filament sensor

Di-Jo Heemskerk avatarDi-Jo Heemskerk

May 27, 2023

printables-icon
DescriptionCommentsTags

Description

 i liked this model but i had the wrong sensor. so I edited it 

for my case i had to change two wires before my printer recognised it. (if you only see a dimmed light then you should to

Also i had to paint the wheel black (i used black nailpollish for that :) )
for klipper i wrote some code

for klipper add:


[filament_motion_sensor filament_sensor]
detection_length: 10
extruder: extruder
switch_pin: ^!PE4
pause_on_runout: false
runout_gcode: FILAMENT_ISRUNOUT

 

and the macros

[gcode_macro FILAMENT_ISRUNOUT]
description: Is called when filament runout is detected by filament_motion_sensor
gcode:
 {% set runout_state = "delay_runout_check" if printer.print_stats.print_duration < 30 else "runout" %}
 {% set runout_state = "not_printing" if printer.idle_timeout.state != "Printing" else "runout" %}
 # {% set runout_state = "nope" if 1 == 2 else "runout" %}
 {% set counter = printer["gcode_macro cfgs"].counter + 1 %}
 SET_GCODE_VARIABLE MACRO=cfgs VARIABLE=counter VALUE='{counter}'
 # { action_respond_info("counter: %i" % (counter)) }
 { action_respond_info("runout state: %s" % (runout_state)) }
 {% if runout_state == "delay_runout_check" %} 
     { action_respond_info("No runout detection first 30 seconds of print duration.") }
 {% elif runout_state == "not_printing" %}
     ## Printer not in printing state
     { action_respond_info("No runout detection as printer is not in printing state.") }
 {% else %}
       {% set breaker = namespace(found=False) %}
       {% if runout_state == "runout" %}
           {% if counter < 4 %}
               UPDATE_DELAYED_GCODE ID=RECHECK_FILAMENT_ISRUNOUT DURATION=5 ; Recheck after XXs duration
               { action_respond_info("Detected possible runout. Recheck runout sensor in 5s.") }
           {% else %}
               SET_GCODE_VARIABLE MACRO=cfgs VARIABLE=counter VALUE='0'
               { action_respond_info("Detected actual runout. Go to filament change position.") }
               M600 ; Go To Filament Change position
              {% set breaker.found = true %}
           {% endif %} 
       {% endif %} 
 {% endif %}
[gcode_macro M600]
gcode:
    SAVE_GCODE_STATE NAME=M600_state
    CLEAR_PAUSE
    PAUSE
    G91
    G1 E-.8 F2700
    G1 Z50 F600
    G90
    G1 X10 Y10 F10000
    G92
    G92 E0  
    RESTORE_GCODE_STATE NAME=M600_state

 

[delayed_gcode RECHECK_FILAMENT_ISRUNOUT]
gcode:
    {% set rechecks = printer["gcode_macro cfgs"].rechecks %}
    {% set rechecks=rechecks+1 %}
    SET_GCODE_VARIABLE MACRO=cfgs VARIABLE=rechecks VALUE='{rechecks}'
    {% if printer["filament_motion_sensor filament_sensor"].filament_detected == True %}
        { action_respond_info("filament found, total rechecks: %i"  % (rechecks | int)) }
        SET_GCODE_VARIABLE MACRO=cfgs VARIABLE=counter VALUE='0'
    {% else %}
         { action_respond_info("no filament detected, total rechecks: %i"  % (rechecks | int)) }
        FILAMENT_ISRUNOUT
    {% endif %}

[gcode_macro cfgs] 
variable_counter: 0
variable_rechecks: 0
gcode:
      { action_respond_info("var is loaded.") } 

 

[delayed_gcode SETFILAMENTSENSOR_ON]
gcode:
 SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=1

 

 

[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
  SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=last_extruder_temp VALUE="{printer[printer.toolhead.extruder].target}"
  PAUSE_BASE
  _TOOLHEAD_PARK_PAUSE_CANCEL {rawparams}
    
  #filament runout sensor needs to pause to
  SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0

[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
variable_last_extruder_temp: 0
gcode:
  ##### get user parameters or use default #####
  {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %}
  {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %}
  {% set velocity = printer.configfile.settings.pause_resume.recover_velocity %}
  {% set sp_move        = velocity if not macro_found else client.speed_move|default(velocity) %}
  ##### end of definitions #####
  #M109 S{last_extruder_temp}
   TEMPERATURE_WAIT SENSOR=extruder minimum={last_extruder_temp-2} maximum={last_extruder_temp+2}

  _CLIENT_EXTRUDE
  RESUME_BASE VELOCITY={params.VELOCITY|default(sp_move)}

  #filament runout sensor needs to resume to
  UPDATE_DELAYED_GCODE ID=SETFILAMENTSENSOR_ON DURATION=5

License:

Creative Commons — Attribution

Related Models

#3DBenchy - The jolly 3D printing torture-test by CreativeTools.se preview image

#3DBenchy - The jolly 3D printing torture-test by CreativeTools.se

CreativeTools profile image

CreativeTools

90,898

Important information sign for 3D printers / Wichtiges Hinweisschild für 3D-Drucker :) preview image

Important information sign for 3D printers / Wichtiges Hinweisschild für 3D-Drucker :)

Pat_S profile image

Pat_S

sign: don't touch my 3d printer preview image

sign: don't touch my 3d printer

Izzodesign74 profile image

Izzodesign74

583

Self-Watering Planter (Small) preview image

Self-Watering Planter (Small)

parallelgoods profile image

parallelgoods

73,139

X, Y and Z calibration tool for IDEX / dual extruder / dual color 3D printers preview image

X, Y and Z calibration tool for IDEX / dual extruder / dual color 3D printers

Voxel3D_NL profile image

Voxel3D_NL

203

Gift Box preview image

Gift Box

roby85r profile image

roby85r

1,509

All In One 3D Printer test preview image

All In One 3D Printer test

majda107 profile image

majda107

64,493

axes calibrage cube-xyz for 3d printers preview image

axes calibrage cube-xyz for 3d printers

H- printed profile image

H- printed

9

7