Giter Club home page Giter Club logo

Comments (29)

TacII avatar TacII commented on August 17, 2024 4

I feel you. As everyone who owns a 3D-printer, I was standing at the cliff of despair myself. So here's how I did it, for the Creality 4.2.7 system board. You need to free up one pin-pair on the system board, which you already did if you own a BL/CR-Touch, then the Z- pin-pair should be available.

The Black and Green contact (the motion sensor) should go to the Z- pin pair on the board. It's three pins wide so you need to either cut the outer part of the contact with a sharp pair of scissors (quite easy actually) or solder on a two pin contact to the black and green wires. Black is ground and should be on the left, Green is PA7 and should be on the right.

Here's what the wiring looks like from the manual.
image

This is where the Motions Sensor Cable goes on the system board.
image

The Blue and Red wire pair (Switch Sensor) goes the the filament runout port on the system board and can be inserted as normal.
image

Then you'll need this in printer.cfg in Klipper. Sorry I don't use Marlin anymore but I think you could probably follow the manual and use PA4 for the Switch Sensor and PA7 for the Motion sensor.

#Switch sensor, blue @PA4 + red VCC 3,3V
[filament_switch_sensor btt_switch_sensor]
switch_pin: ^PA4 
pause_on_runout: false
runout_gcode:
  M117 Switch Runout!
  {action_respond_info("BTT: Switch Runout detected!")}
  PAUSE
insert_gcode:
  M117 Filament inserted
  {action_respond_info("BTT: Filament inserted.")}
  
#Motion sensor, Green @PA7 +Black GND
[filament_motion_sensor btt_motion_sensor]
switch_pin: ^PA7 # Previous Z- on 4.2.7
detection_length: 2.88 # accuracy of motion sensor 2.88mm
extruder: extruder
pause_on_runout: false
runout_gcode:
  M117 Motion Runout
  {action_respond_info("BTT: Motion Sensor Runout detected!")}
  PAUSE
insert_gcode:
  M117 Filament inserted
  {action_respond_info("BTT: Filament inserted.")}

[delayed_gcode DISABLEFILAMENTSENSOR]   
initial_duration: 1
gcode:
    M117 Motion FIL. SENSOR OFF.
    SET_FILAMENT_SENSOR SENSOR=btt_motion_sensor ENABLE=0
    SET_FILAMENT_SENSOR SENSOR=btt_switch_sensor ENABLE=0

And for START you will have to add two lines more:

######################################################################
# Start Print and End Print
######################################################################

# Replace the slicer's custom start and end g-code scripts with
# START_PRINT and END_PRINT.

[gcode_macro START_PRINT]
variable_bed_temp: 60
variable_extruder_temp: 185
gcode:
    # Start bed heating
    M140 S{bed_temp}
    # Use absolute coordinates
    G90
    # Reset the G-Code Z offset (adjust Z offset if needed)
    SET_GCODE_OFFSET Z=0.0
   
    ## Home the printer
    G28

    # Reset Extruder
    G92 E0

    ## Move to start position
    G1 X2.1 Y20 Z0.28 F5000.0

    # Move the nozzle near the bed
    G1 Z5 F3000
    # Move the nozzle very close to the bed
    G1 Z0.15 F300
    # Wait for bed to reach temperature
    M190 S{bed_temp}
    # Set and wait for nozzle to reach temperature

    #KAMP Calibrate print area only
    BED_MESH_CALIBRATE
    
    M109 S{extruder_temp}
  
    # Move Z Axis up
    G1 Z2.0 F3000

    #KAMP Line Purge
    LINE_PURGE
        
    SKEW_PROFILE LOAD=my_skew_profile_231010
   
    _M117 BTT SENSOR ON.
    SET_FILAMENT_SENSOR SENSOR=btt_motion_sensor ENABLE=1
    SET_FILAMENT_SENSOR SENSOR=btt_switch_sensor ENABLE=1

For CANCEL:

[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
    TURN_OFF_HEATERS
    CANCEL_PRINT_BASE
    M117 MOTION FIL. SENSOR OFF.
    SET_FILAMENT_SENSOR SENSOR=btt_motion_sensor ENABLE=0
    SET_FILAMENT_SENSOR SENSOR=btt_switch_sensor ENABLE=0

And lastly for END:

# ---------------------------- End Print -----------------------------
[gcode_macro END_PRINT]
variable_machine_depth: 235
gcode:
    # Turn off bed, extruder, and fan
    M140 S0
    M104 S0
    M106 S0
    # Relative positionning
    G91
    # Retract and raise Z
    G1 Z0.2 E-2 F2400
    # Wipe out
    G1 X5 Y5 F3000
    # Raise Z more
    G1 Z10
    # Absolute positionning
    G90
    # Present print
    G1 X0 Y{machine_depth}
    # Disable steppers
    M84
    M117 BTT SENSOR OFF.
    SET_FILAMENT_SENSOR SENSOR=btt_motion_sensor ENABLE=0
    SET_FILAMENT_SENSOR SENSOR=btt_switch_sensor ENABLE=0

from smart-filament-detection-module.

negativefate83 avatar negativefate83 commented on August 17, 2024 1

Believe it or not, I actually got it to work today. I needed to resolder a cable to get both sensors to work on the Ender3 v4.2.7 system board. I’ll post more details here as soon as I have time.

mate if you could, youd be a life saver
just unboxed the sfs 2.0 and now im just scratching my head questioning my life choices

from smart-filament-detection-module.

negativefate83 avatar negativefate83 commented on August 17, 2024 1

mate, to say im grateful doesnt even come close
love your work, thankyou so much

from smart-filament-detection-module.

Ltek avatar Ltek commented on August 17, 2024

I have this same problem just with the Artillery Sidewinder X2... I don't think they really support the product. They clearly do not monitor this site at all. And over a week I put in a tech support ticket I entered on their site - they have never responded.

from smart-filament-detection-module.

TacII avatar TacII commented on August 17, 2024

Believe it or not, I actually got it to work today. I needed to resolder a cable to get both sensors to work on the Ender3 v4.2.7 system board. I’ll post more details here as soon as I have time.

from smart-filament-detection-module.

TacII avatar TacII commented on August 17, 2024

It seems that I haven't really got the motion sensor working fully as I thought yesterday. Sometimes it is detected and sometimes not (often it is there after a firmware restart.) But as soon as it starts printing it is empty. Not sure what is going on here. I'll dig on. At least the Switch works which is more important, so if the printer runs out of filament it'll pause the print.

from smart-filament-detection-module.

negativefate83 avatar negativefate83 commented on August 17, 2024

from smart-filament-detection-module.

TacII avatar TacII commented on August 17, 2024

Hey! Yeah, no. I can't get the motion sensor to play ball, only the switch. There's got to be something with the PA7-port that is different from how BTT thinks it should work.

from smart-filament-detection-module.

negativefate83 avatar negativefate83 commented on August 17, 2024

Yeah I had a tinker with no luck either, ended up blanking it from the config
Oh well…. Maybe someone will have a victory and post what they did one day

from smart-filament-detection-module.

TacII avatar TacII commented on August 17, 2024

~PA7 instead of ^PA7 for the motions sensor actually makes Klipper detect filament - visible under the Misc part on the dashboard but also through the command "QUERY_FILAMENT_SENSOR SENSOR=btt_motion_sensor".
But as soon as it starts printing it fails after the set "detection_length".

From the Klipper manual :
Input pins may be preceded by ^ to indicate that a hardware pull-up resistor
should be enabled for the pin. If the micro-controller supports pull-down resistors then an input pin may
alternatively be preceded by ~. Pin names may be preceded by ! to indicate that a reverse polarity should be
used (eg, trigger on low instead of high).

I've also tried ^!PA7 and ~!PA7 which than makes the sensor detect a runout immediately but the sensor is not true. ^PA7 should be correct. The Z- pin should be a pull-up resistor after what I've read. But no setting I tried has made the blue led flash as it should when filament is passing by it. One thing that might work that I haven't tried is to switch the motion-cable and switch sensor cable but that requires new soldering of the contacts since the switch sensor cable contact has three poles and won't fit into the Z- port.

I'm quite disappointed in BTT who haven't answered my support request two weeks ago. They're not active here or on Discord.

image

from smart-filament-detection-module.

Ltek avatar Ltek commented on August 17, 2024

Guys, I've been trying to get this working on an Artillery Sidewinder X2 (running Klipper) -- I suspect we have similar or identical problems. It does not detect motion for me, and Pauses immediately after purging the nozzle.

The X2 only has 1 Z-Stop connector I can use for the Motion Sensor, thus the SFSv2's Runout wire/pin is not connected.

Is there code we can use to test the filament sensor without printing... just moving the filament in/out by hand?

from smart-filament-detection-module.

shaidou1287 avatar shaidou1287 commented on August 17, 2024

So, I got this working on a Creality 4.2.7 board. What I did was just set the PIN to the Z-Stop pin PA7, no pull-up or pull-down. I have tested it multiple times mid-print and it will pause the print and wait for me to resume it. Hope this helps those who are having issues. BTW this was on Klipper.

from smart-filament-detection-module.

TacII avatar TacII commented on August 17, 2024

from smart-filament-detection-module.

shaidou1287 avatar shaidou1287 commented on August 17, 2024

Yeah, the blue light is blinking and if I hold the extruder open so filament won't go through it runs my pause macro.

from smart-filament-detection-module.

TacII avatar TacII commented on August 17, 2024

Wow, interesting! Can you please share the details? So motion sensor cable (green+black) to PA7, right? And blue+red switch sensor cable to PA4 I assume? Or aren't you using the switch cable at all?

Can you please drop in your printer.cfg here so that I can compare the differences? Because I tried all combinations of Pull up/down.

Thanks!

from smart-filament-detection-module.

negativefate83 avatar negativefate83 commented on August 17, 2024

Interesting…

from smart-filament-detection-module.

shaidou1287 avatar shaidou1287 commented on August 17, 2024

Sorry for the Delay but here is the section of the Printer config I have for the sensor. The rest is just the basic Ender 3 V2 config from the example w/ a CR Touch added.

# Runout Sensor #########################################################################
[filament_switch_sensor switch_sensor]
switch_pin: PA4
pause_on_runout: False
runout_gcode:
  PAUSE # [pause_resume] is required in printer.cfg
  M117 Filament switch runout
insert_gcode:
  M117 Filament switch inserted

[filament_motion_sensor encoder_sensor]
switch_pin: PA7
detection_length: 2.88
extruder: extruder
pause_on_runout: False
runout_gcode:
  PAUSE # [pause_resume] is required in printer.cfg
  M117 Filament encoder runout
insert_gcode:
  M117 Filament encoder inserted

from smart-filament-detection-module.

Egosumumbravir avatar Egosumumbravir commented on August 17, 2024

This is where the Motions Sensor Cable goes on the system board.

Crap, what if you're already using the PA7 pin to get a Biqu MicroProbe v2 to work?

Does it need hardware pullup? The MicroProbe V2 does which is why it has to goto PA7 instead of the default touch port PB1.

I wonder if PB1 could be used in this case?

from smart-filament-detection-module.

shaidou1287 avatar shaidou1287 commented on August 17, 2024

Honestly I have absolutely no clue. All I know is that it works with out the pull up or pull down and the way I got to thinking about this is that the v1.0 doesn't use pull up or pull down for its encoder.

from smart-filament-detection-module.

Egosumumbravir avatar Egosumumbravir commented on August 17, 2024

All I know is that it works with out the pull up or pull down...

That'll be the key point - the Microprobe needs a hefty pullup to function correctly which PB1 lacks. Wiring is gonna get a bit messy but it'll be cool if it enables full functionality.
I'm compiling MRiscoC Professional Firmware for it. Will report back once I've had a chance to fiddle with it.

from smart-filament-detection-module.

sdmorrey avatar sdmorrey commented on August 17, 2024

I’m about to try this out thanks so much for your hardwork everyone!

Just a quick tip, I know the default is to want to break out the soldering iron and solder these things but it makes a mess.

With these “pinned connectors” all you have to do is repin them. It’s super easy, just grab a pair of tweezers, poke the pins latch on the flat side until it’s down a bit and remove the wire. Then use your fingernail or something to pry the latch flap back about 45 degrees and stuff it into the hole on the other connector. Repeat until there’s no more pins.

from smart-filament-detection-module.

sdmorrey avatar sdmorrey commented on August 17, 2024

Since PA7 is the old z- end stop which you no longer need if you have a bltouch, wouldn't it make more sense to make that one your runout sensor?

Then PA4 could be used for the motion encoder since that's not just a simple switch but a lightbulb and sensor counting optical interrupts.

I had them switched up (because I was doing it by myself before finding this thread, and had to swap them in the code.

from smart-filament-detection-module.

Egosumumbravir avatar Egosumumbravir commented on August 17, 2024

Since PA7 is the old z- end stop which you no longer need if you have a bltouch, wouldn't it make more sense to make that one your runout sensor?

It would if I had a BL or CR-Touch unit. I dont. I'm rocking a v2 BIQU Microprobe which doesn't work in the standard PB1 probe port because the pullup there is insufficient. So the MPv2 goes into PA7 and PB1 is free. Hence breaking out the soldering iron to make a splitter to connect the two ports.

Seems to be working so far as a simple presence detector. Haven't yet got around to compiling a custom Marlin but I think that will be an either/or situation - Marlin only supports one runout sensor per extruder AFIK.

from smart-filament-detection-module.

danderik88 avatar danderik88 commented on August 17, 2024

@TacII im so gratefull someone tryed this out before. I wanted to try it today and i made my last search on google to find out if this was already done before i make some mistakes. Thank you so much!

from smart-filament-detection-module.

ShaunTheBaa avatar ShaunTheBaa commented on August 17, 2024

Marlin only supports one runout sensor per extruder AFIK.

I didn't realize this was the case. I only just bought the BTT V2.0 run-out sensor for my Creality 4.2.7 board. I'm right now trying to figure out how to make it work in Marlin but looks like it might not be possible.
I do see the option #define FILAMENT_MOTION_SENSOR but there is no pin assignment. It looks like there was in a previous Marlin version. Nevertheless, if someone figure out how to make it work in Marlin, let me know what you did please.

from smart-filament-detection-module.

BakoBangBang avatar BakoBangBang commented on August 17, 2024

Hello, I am trying to add the BTT SFS V2.0 with the command lines mentioned above but I am not having any luck. Could anyone get it to work? Ender 3 V2 whit klipper

from smart-filament-detection-module.

shaidou1287 avatar shaidou1287 commented on August 17, 2024

Hello, I am trying to add the BTT SFS V2.0 with the command lines mentioned above but I am not having any luck. Could anyone get it to work? Ender 3 V2 whit klipper

What command lines are you using?

from smart-filament-detection-module.

BakoBangBang avatar BakoBangBang commented on August 17, 2024

Hello, I am trying to add the BTT SFS V2.0 with the command lines mentioned above but I am not having any luck. Could anyone get it to work? Ender 3 V2 whit klipper

What command lines are you using?

The ones you uploaded... I already found the error and it worked (I was placing the lines in the start and end gcode)... Is there a way to configure the times in which the motion sensor is activated? Since sometimes the head does travel too far to the edge of the bed when returning the filament that was stretched too much, it makes the sensor think that it is stuck

from smart-filament-detection-module.

shaidou1287 avatar shaidou1287 commented on August 17, 2024

from smart-filament-detection-module.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.