Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    How to home filament in 5x Bowden extruder drives?

    Scheduled Pinned Locked Moved Unsolved
    Using Duet Controllers
    2
    3
    128
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • futureforgedundefined
      futureforged
      last edited by

      How does one put an endstop on an extruder to detect the presence of and home/set the location of filament in the extruder? I have 5 Bowden extruders in one machine that manifold into 1 optical endstop switch for the purpose of loading different materials into a single extruder.
      Ive got the optical switch working but want to be able to load filament in and home each extruder and then retract to a know distance to stage each filament to be sent to the extruder at a known distance into a serving system.
      I'm really stuck here and need to get this working. Currently I have to manually load the filaments in and then cut them off at a known distance. There has to be a better way!

      Using Duet 6hc board with the 3hc expansion board & Simplify3d?
      Optical switch TCST2103
      I've got CAD drawings and diagrams. I just don't know how to code the filament loading process to get the filaments staged at the right distances from the extruder.
      Please help!!

      OwenDundefined 1 Reply Last reply Reply Quote 0
      • OwenDundefined
        OwenD @futureforged
        last edited by OwenD

        @futureforged
        I don't think RRF has native capabilities to extrude until a sensor or end stop is triggered.
        I have a day off today, so for giggles I thought I'd try a macro to do it.
        I don't really know how your system is configured so I've tried to do the macro so that you can pass parameters to cover as many things as possible.
        For example I don't know if a tool change is necessary between each filament of if you use a mixing hotend.
        If the latter then the G1 commands would have to be altered.
        Hopefully it's commented well enough to make sense.

        ; extrude_to_stop.g
        ; Parameters can be passed to macro.  e.g. 
        ;M98 P"extrude_to_stop.g" A0.05 R100 S100 Q200 T1 M1 C0 B0
        
        ; adjust defaults as required.  
        var minVoltage = 23.8 ; set to minimum acceptable voltage.  Change to suit your system
        var extrudeDistance = 0.1 ; amount extruded with each iteration until stop is detected. Over-ridden if parameter "A" passed
        var retractDistance = 50 ; amount to retract after stop detected. Over-ridden if parameter "R" passed
        var extrudeSpeed = 320 ; speed in MM/min to extrude. Over-ridden if parameter "S" passed
        var retractSpeed = 600 ; speed in MM/min to retract. Over-ridden if parameter "Q" passed
        var cancelAmount = 300 ; maximum extrusion amount before macro cancels.  This should stop an endless loop
        var amountExtruded = 0 ; storage for counter
        var whichTool = 0 ; assume tool 0 to start. Over ridden if parameter "T" passed
        var whichSensor = 0 ; assume sensor number is 0 to start Over-ridden if parameter "M" passed
        var doToolChange = 0 ; Over-ridden if parameter "C" passed (C0 or C1)
        var whichDrive = 0 ; Over-ridden if parameter "B" passed
        var sensorState = 0 ; sensor state when macro run
        
        ; check that we have power
        if (state.atxPower != null)
        	if state.atxPower = false
        		M80 ; turn on ATX power
        		G4 S3 ; wait a few seconds to power up
        
        ;echo "check voltage"
        if (boards[0].vIn.current) < (var.minVoltage)
        	abort "ABORT: Voltage too low for motor movement"
        
        ; check if parameters have been passed and adjust variables accordingly
        if exists(param.A)
        	set var.extrudeDistance = param.A
        
        if exists(param.R)
        	set var.retractDistance = param.R
        
        if exists(param.S)
        	set var.extrudeSpeed = param.S
        
        if exists(param.Q)
        	set var.retractSpeed = param.Q
        
        if exists(param.T)
        	set var.whichTool=param.T
        	
        if exists(param.M)
        	set var.whichSensor = param.M
        	
        if exists(param.C)
        	set var.doToolChange = param.C
        
        if exists(param.B)
        	set var.whichDrive = param.B
        
        
        T{var.whichTool} P{var.doToolChange} ; select tool and run toolchange macros if required
        
        ; check if the filament sensor is enabled and record it for resetting to original later
        if (sensors.filamentMonitors[var.whichSensor].enabled != true)
        	M591 D{var.whichDrive} P1 ; enable the filament monitor
        	set var.sensorState = 0
        else
        	set var.sensorState = 1
        
        ; make sure sensor filament isn't already detected
        if sensors.filamentMonitors[var.whichSensor].status = "ok"
        	M291 R"Error" P"Filament is already detected.  Macro cancelled" T1 S3
        	M591 D{var.whichDrive} S{var.sensorState} ; reset sensor state
        	M99 ; exit macro
        
        ; start the movement section
        M83 ; relative extrusion
        M302 P1; allow cold extrude
        M291 P"Press OK to begin" R"Ready?" S3 ; wait for user action
        while (sensors.filamentMonitors[var.whichSensor].status != "ok") && (var.amountExtruded < var.cancelAmount)
        	G1 E{var.extrudeDistance} F{var.extrudeSpeed}
        	if result != 0 ; check if command was succesful
        		var.amountExtruded = var.cancelAmount ; cancel out if there was a problem in the move command
        		break ; exit the loop
        	set var.amountExtruded = var.amountExtruded + var.extrudeDistance ; increment the counter to track how far we've moved
        	M400 ; wait for move to finish before starting loop again
        	M291 P{"Moved " ^ var.amountExtruded} S0 T0.5
        
        if var.amountExtruded >= var.cancelAmount
        	M291 P"Extrusion limit reached or error occured - macro cancelled" R"Error"	S1 T3
        	M302 P0; Dissallow cold extrusion again
        	M591 D{var.whichDrive} S{var.sensorState} ; reset sensor state
        	M99 ; exit macro
        	
        ; if we got this far the limit switch has been tripped
        M291 P{"Limit switch found after " ^ var.amountExtruded ^ "mm. Retracting " ^ var.retractDistance ^ "MM"} R"Retracting" S1 T3
        G4 S3 ; Delay for a few seconds	for popup to expire
        G1 E{0 - var.retractDistance} F{var.retractSpeed}
        M400 ; wait for move to complete
        
        M591 D{var.whichDrive} S{var.sensorState} ; reset sensor state
        M302 P0; Dissallow cold extrusion again
        
        M291 P"Filament in position" R"Done" S1 T3
        
        1 Reply Last reply Reply Quote 1
        • OwenDundefined
          OwenD
          last edited by

          The code I suggested is based on using the sensor you have as a filament monitor.
          If that is not the case and you simply have it connected to an input then you will need to replace any reference to sensors.filmentMonitors[var.whichSensor]status with something like sensors.gpIn[var.whichSensor].value ,where whichSensor is your gpIn value for the switch
          You would also not need anything referring to M591

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Unless otherwise noted, all forum content is licensed under CC-BY-SA