Jump to content

Btt smart filament sensor 2.0 klipper error after print start.


Recommended Posts

Posted (edited)

Hi. As my Voron is now fully build and working I wanted to install a smart filament sensor,however i came across some klipper issues with configuration that i cant find solution for. I tried many configuration cfg:s,I checked klipper config site but still cant get this thing to work.  At this moment sensor is working,detecting filament runout and motion however when print is started i get this error after few layers and printing is halted. So what is wrong with this command? Octopus pro 1.01 board,Voron 2.4R2

Malformed command 'SET_FILAMENT_SENSOR SENSOR=filament_sensor RUNOUT ENABLE=0'

config-20250607-210646.zip

Edited by SamppaD
Link to comment
Share on other sites

This is how mine is set up on my Crossant with a Kraken MCU. Seems to work fine.

[filament_switch_sensor switch_sensor]  
switch_pin: PF1
pause_on_runout: False
runout_gcode: 
        PAUSE          # [pause_resume] is required in printer.cfg  
        M118 Filament switch runout 
insert_gcode: 
        M118 Filament switch inserted
        
[filament_motion_sensor encoder_sensor]  
switch_pin: PF2
detection_length: 6    # accuracy of motion sensor 2.88mm
pause_on_runout: False
extruder: extruder
runout_gcode: 
        PAUSE          # [pause_resume] is required in printer.cfg 
        M118 Filament encoder runout 
insert_gcode: 
        M118 Filament encoder inserted 

Link to comment
Share on other sites

HiDetection length is set to 10 mm,mine sensor is triggering at about 2.8 mm..if I move filament back like 2-3mm it triggers I'm using  Ellis's filament smart sensor scripts but had to disable script part  [delayed_gcode DISABLEFILAMENTSENSORas it triggers the same error after klipper firmware restart.. Klipper error Malformed command 'SET_FILAMENT_SENSOR SENSOR=filament_sensor RUNOUT ENABLE=0 not triggers after print  starts,after skirt is printedI was searching for a solution 3 days now,to me this command looks fine..I inspected configuration pinsharness,sensor itself as a part of to be sure there is no issues with the install or sensorTried few scripts,checked Klipper documentation and watch this youtube video among others

Now only issue seems to be this klipper error,as for testing sensor is detected and working fine until print is started.

 

config-20250608-095957.zip

Edited by SamppaD
Link to comment
Share on other sites

It's looks like you are getting PAUSE/PARK  to trigger in the print. Check the lite pin that sticks out of the sensor that you can push down to ease the filament load so it screwed in some what tight. 

Test to set the length to "detection_length: 16.00" 
And do the basic scrappy test. start print -> trigger Paus manually or test to set a Paus at layer 2 see if it strigers the problem.

Check so you have the [pause_resume] in your printer.cfg file  

And if you use mainsail get the klipper log and see what it says 

For me i use the SET_FILAMENT_SENSOR SENSOR=SFS_T0 ENABLE=1 (my sensor is called SFS_T0) as the last line before i set the "status_printing"
and in the park/paus macro i have a disable in the start and enable in the end. And in the END/CANCEL print i have it disabled in the beginning

AND one big thing that i had a problem with is  INDENTATION in the cfg files.

2 thing i have done was dismantle my sensor and cleaned it and add the "perfect" amount of oil and i had a wire to the micro switch that was pinched i rerouted the wire and resolder the connection to the rountout sensor. 

this is for the runout switch sensor

[filament_switch_sensor switch_sensor]
switch_pin: ^PG12 " #Pullup
pause_on_runout: true
event_delay: 3.0
pause_delay: 0.5
runout_gcode: 
   PARK_MACRO
   M117 Filament switch runout
insert_gcode: 
   M117 Filament switch inserted 
   RESUME_MACRO

this is for the motion sensor i use 16.00 as sensor range had a few strange stops when i used 10.00 or 2.00 that had to do with the tube to the extruder flexing and the spool roller with its wight got it to roll to much out then when it started to pull it had some slack to pull in.

[filament_motion_sensor SFS_T0] 
switch_pin: ^PG13  # Pullup 
detection_length: 16.00 # accuracy of motion sensor 2.88mm
extruder: extruder 
pause_on_runout: True
event_delay: 3.0
pause_delay: 0.5
insert_gcode: 
   M117 Filament switch inserted 
runout_gcode: 
   M117 Filament encoder runout 

other than that its stock config from BTT github page ..

Edited by Lind301
duplicate lines
Link to comment
Share on other sites

Hi. I have mostly a stock config,mainsail.cfg has a pause,resume,cancel scripts. Mainsail.cfg is included to printer.cfg. 
In filament sensor.cfg i have sensor configuration files,for sensor and  ellis pause,resume and cancel scripts. Filament sensor.cfg is included in printer.cfg. 
So do i miss something here? Do i need a separate pause_resume file to add to printer.cfg?  
About sensor it had lose screws inside exactly on that pin that is used to ease filament insertion and microswitch screw was lose.. 
Fixed issues and reassembled sensor. Tested for detecting filament motion and runout works fine..Still same error..

Here is filament sensor config:

 

[filament_switch_sensor switch_sensor RUNOUT]
switch_pin: ^PG13
pause_on_runout: true
runout_gcode:
    G1 E10 F2000
    G1 E-100 F2000
 PAUSE # [pause_resume] is required in printer.cfg
 M117 Filament switch runout
insert_gcode:
    M117 Filament switch inserted
event_delay: 3.0
pause_delay: 0.5

[filament_motion_sensor encoder_sensor]
switch_pin: ^PG14
extruder: extruder
pause_on_runout: true
detection_length: 16 # accuracy of motion sensor 2.88mm by default
runout_gcode:
    PAUSE # [pause_resume] is required in printer.cfg
    M117 Filament encoder runout
insert_gcode:
    M117 Filament encoder inserted

 

And here pause resume Ellis script

 

[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
    # Parameters
    {% set z = params.Z|default(10)|int %}                                                                                    ; z hop amount

    {% if printer['pause_resume'].is_paused|int == 0 %}
        SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE={z}                              ; set z hop variable for reference in resume macro
        SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=etemp VALUE={printer['extruder'].target}    ; set hotend temp variable for reference in resume macro

        SET_FILAMENT_SENSOR SENSOR=filament_sensor RUNOUT ENABLE=0                           ; disable filament sensor
        SAVE_GCODE_STATE NAME=PAUSE                                                                                        ; save current print position for resume
        BASE_PAUSE                                                                                                                               ; pause print
        {% if (printer.gcode_move.position.z + z) < printer.toolhead.axis_maximum.z %}               ; check that zhop doesn't exceed z max
            G91                                                                                                                                           ; relative positioning
            G1 Z{z} F900                                                                                                                           ; raise Z up by z hop amount
        {% else %}
            { action_respond_info("Pause zhop exceeds maximum Z height.") }                                 ; if z max is exceeded, show message and set zhop value for resume to 0
            SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE=0
        {% endif %}
        G90                                                                                                                                              ; absolute positioning
        G1 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} F6000   ; park toolhead at front center
        SAVE_GCODE_STATE NAME=PAUSEPARK                                                                               ; save parked position in case toolhead is moved during the pause (otherwise the return zhop can error)
        M104 S0                                                                                                                                      ; turn off hotend
        SET_IDLE_TIMEOUT TIMEOUT=43200                                                                                    ; set timeout to 12 hours
    {% endif %}

[gcode_macro RESUME]
rename_existing: BASE_RESUME
variable_zhop: 0
variable_etemp: 0
gcode:
    # Parameters
    {% set e = params.E|default(2.5)|int %}                                                                              ; hotend prime amount (in mm)

    {% if printer['pause_resume'].is_paused|int == 1 %}
        SET_FILAMENT_SENSOR SENSOR=filament_sensor RUNOUT ENABLE=1                   ; enable filament sensor
        #INITIAL_RGB                                                                 ; reset LCD color
        SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout}       ; set timeout back to configured value
        {% if etemp > 0 %}
            M109 S{etemp|int}                                                                                                         ; wait for hotend to heat back up
        {% endif %}
        RESTORE_GCODE_STATE NAME=PAUSEPARK MOVE=1 MOVE_SPEED=100               ; go back to parked position in case toolhead was moved during pause (otherwise the return zhop can error)
        G91                                                                                          ; relative positioning
        M83                                                                                        ; relative extruder positioning
        {% if printer[printer.toolhead.extruder].temperature >= printer.configfile.settings.extruder.min_extrude_temp %}
            G1 Z{zhop * -1} E{e} F900                                                ; prime nozzle by E, lower Z back down
        {% else %}
            G1 Z{zhop * -1} F900                                                       ; lower Z back down without priming (just in case we are testing the macro with cold hotend)
        {% endif %}
        RESTORE_GCODE_STATE NAME=PAUSE MOVE=1 MOVE_SPEED=60                          ; restore position
        BASE_RESUME                                                                    ; resume print
    {% endif %}

[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
    SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout}       ; set timeout back to configured value
    CLEAR_PAUSE
    SDCARD_RESET_FILE
    PRINT_END
    BASE_CANCEL_PRINT


    [gcode_macro M600]
gcode:
    #LCDRGB R=0 G=1 B=0  ; Turn LCD green
    PAUSE                ; Pause

[delayed_gcode DISABLEFILAMENTSENSOR]
initial_duration: 1
gcode:
    SET_FILAMENT_SENSOR SENSOR=filament_sensor RUNOUT ENABLE=0
 

 

 

 

Edited by SamppaD
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...