How do I use the filament sensor as a trigger for autoloading??
-
Hey!
I have the orbiter with orbisens installed.
I currently have it setup so that if there is no filament loaded and it triggeres, it starts autoloading the filament. However, it is now non-functional as a filament monitor.
How do I configure it do do both?? Also, how do I write a custom script/ macro for the actions taken when filament runs out?EDIT;
What I want do do in short is;
When filament sensor (connected to 2.io2.in) goes from low to high --> filament is getting loaded --> trigger2.g is triggered.
When filament sensor (connected to 2.io2.in) goes from high to low during printing --> filament ran out --> custom script gets triggeredConfig for filament sensor;
; Filament sensors M591 D0 P1 C"2.io2.in" S1 ; simple sensor (high signal when filament present) connected to IO_4 for drive 0, enabled
Config for autoload;
; Custom buttons M950 J1 C"2.io2.in" ; define logical input for E1 filamentsensor M581 P1 T2 S0 R0 ;define trigger for filament auto load triggers trigger2.g
Script for autoload;
;E1 Autoload filament macro T0 ; select tool 0 M300 S2000 P100 ; play beep sound M291 P"Filament autoloading!" S0 T3 ; display message M302 S10 ; lower min cold extrusion G4 S1 ; wait for one second G1 E15 F500 ; load filament inside the gears ; New material type M291 R"Autoload filament" P"What material type do you want to load" S4 K{"PLA","PETG","ASA","Flex","Nylon","Other", "Cancel"} ; Display user prompt if input = 0 ; If answer is PLA --> M109 S200 ; set hotend temperature and wait set global.loadedfilament = "PLA" ; Set loaded material to PLA elif input = 1 ; If answer is PETG --> M109 S245 ; set hotend temperature and wait set global.loadedfilament = "PETG" ; Set loaded material to PETG elif input = 2 ; If answer is ASA --> M109 S260 ; set hotend temperature and wait set global.loadedfilament = "ASA" ; Set loaded material to ASA elif input = 3 ; If answer is Flex --> M109 S250 ; set hotend temperature and wait set global.loadedfilament = "Flex" ; Set loaded material to Flex elif input = 4 ; If answer is Nylon --> M109 S275 ; set hotend temperature and wait set global.loadedfilament = "Nylon" ; Set loaded material to Nylon elif input = 5 ; If answer is Nylon --> M291 R"Autoload filament" P"What temperature does your filament need?" L180, H300 S5 M109 S{input} set global.loadedfilament = "Custom" ; Set loaded material to Nylon set global.customfilamenttemp = {input} ;endif ; loading G1 E85 F1500 ; extrude fast G1 E25 F300 ; purge 25mm ; start purging loop while true M291 R"Autoload filament" P"Is the correct color filament coming out of the nozzle?" S4 K{"Yes/Close","No"} ; Display user prompt if input = 0 ; If answer is yes --> break ; Filament load successful, so skip to end of loop G1 E20 F300 ; Move Z by 5mm, normally this would be an extra purge. M400 ; Wait for E to complete ; end loop M104 S0 ; set hotend temperature to 0 M302 S170 ; disable cold extrusion M291 P"Filament autoload succesfull!" S0 T3 ; display message
-
-
You could reconfigure it in your slicer start gcode so that once the print starts, it behaves as the runout sensor.
-
@Phaedrux
How could I do that?? Because I also need to disasable the trigger button if that is the case.. -
@SanderLPFRG
I could be wrong but I think to have it do both you'd omit the M950
You've already defined the pin as a filament sensor, so just adding the trigger might be all that's required?If it does work I expect you'd have to do some conditioning checks and use M400 in your trigger to avoid thing happening when you don't expect it.
-
Thanks for your reply. I understand what you mean with "the pin is already defined", but how do I use the assigned pin to call 2 different triggers depending on the states?
Ideally, I want to be able to call 2 triggers;
-
Could I do this??;
Define in config.g;
M950 J1 C"pinx" ; define logical input for E1 filamentsensor
M581 P1 T2 S0 R0 ;define trigger for filament auto load triggers trigger2.g
(trigger 2 being the autoload script)Then in start gcode add;
M950 J1 C"pinx" ; define logical input for E1 filamentsensor
M581 P1 T3 S0 R0 ;define trigger for filament auto load triggers trigger3.g
(trigger 3 being the filament runout script)in end gcode I revert it back to;
M950 J1 C"pinx" ; define logical input for E1 filamentsensor
M581 P1 T2 S0 R0 ;define trigger for filament auto load triggers trigger2.g -
I think that may work, but you only need the M950 once at the start.
Do you have a macro for switching to the runout script that just contains this? What do you have in trigger2.g and trigger3.g?
; Filament sensors M591 D0 P1 C"2.io2.in" S1 ; simple sensor (high signal when filament present) connected to IO_4 for drive 0, enabled
Since the M591 command calls out a pin specifically, you may need to unbind the pin before configuring it as a runout sensor.
For example to set it as the runout sensor
M950 J1 C"nil" ; unbind the pin M591 D0 P1 C"2.io2.in" S1 ; simple sensor
Then to set it as the autoload
M591 D0 P0 C"nil" ; unbind the pin M950 J1 C"pinx" ; define logical input for E1 filamentsensor M581 P1 T2 S0 R0 ;define trigger for filament auto load triggers trigger2.g
Does that make sense?
-
@SanderLPFRG said in How do I use the filament sensor as a trigger for autoloading??:
Thanks for your reply. I understand what you mean with "the pin is already defined", but how do I use the assigned pin to call 2 different triggers depending on the states?
Ideally, I want to be able to call 2 triggers;
To my way of thinking, the filament sensor (having been defined as such using M591) already has a trigger from high to low and calls filament-runout.g
You just need to add a trigger for the low to high action.If you weren't defining a filament sensor, but rather just a normal gpio then you'd define the pin with a single M950 and add two M581 triggers, one with S1 and one with S0
I could be wrong, but it's easy enough to test.I was wrong.
M581 won't allow a pin name, so you have to use M950 to define a number which in turn clashes with M591.
So I think you're stuck using two triggers and not defining a filament sensor.
Or do something like @Phaedrux has shown. -
@OwenD I did exactly that yesterday late afternoon. It is working now.
; Custom buttons M950 J1 C"^io2.in" ; define logical input for E1 filamentsensor M581 P1 T2 S0 R2 ; define trigger for filament auto load (trigger2.g) M581 P1 T4 S1 R1 ; define trigger for filament runout (trigger4.g)
Thank you very much both!
-