Hi,
From memory.....
Configuration.h uncomment (remove//) - //#define FILAMENT_RUNOUT_SENSOR
//#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
// In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made.
// It is assumed that when logic high = filament available
// when logic low = filament ran out
Pins.h Depending on Marlin firmware version, you should have a definition of the filament run out pin that you will be using.
#ifdef FILAMENT_SENSOR
#define FILWIDTH_PIN 2
Then you should only be using a switch between the defined pin and 0V to short to ground when filament is not present.. Add a resistor (220 Ohm) in series if not too sure..
------------------------------------------------------------------------------------------------------------------------------------------------------------
Also......
The Marlin firmware only allows this filament run out detection when printing from SD card…see below firmware my change to allow option to function from SD card and PC .
Note: When printing from a PC and using filament monitoring, you must have communication handshaking between the PC and printer, thus you can’t use TCP mode. TCP mode is where data is streamed with no flow control.
With using Ponterface you can check what the TCP is set at; Goto- Settings > Options > Printer Settings Tab – Check that TCP streaming is not ticked. Should be below Baud rate (third option from top). Note: I have found some old PC operating systems don’t show you this option to use TCP.
Filament run out to allow running from PC as well as SD Card.
Description: Add pin definition for I/O output for E1 STEP pulse:
Marlin Sketch: Marlin_main.cpp
Line 6243
Default if (IS_SD_PRINTING && !(READ(FILRUNOUT_PIN) ^ FIL_RUNOUT_INVERTING))
Change if (!(READ(FILRUNOUT_PIN) ^ FIL_RUNOUT_INVERTING))
----------------------------------------------------------------------------------------------------------------------------------------------
Also had to do this, to make my LCD Knob to work..
Filament run out to allow LCD knob to function.
Description: Edit to allow LCD knob and beeper to function.
Marlin Sketch: Marlin_main.cpp
Line 4883
Default if (++cnt == 0) lcd_quick_feedback(); // every 256th frame till the lcd is clicked
Change comment out // if (++cnt == 0) lcd_quick_feedback(); // every 256th frame till the lcd is clicked
Line 4884
Change added if (!(READ(FILRUNOUT_PIN)^FIL_RUNOUT_INVERTING)) lcd_buzz(110,1000);
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Setting where extruder is positioned when a filament run out condition occurs.
Description: Sets axis positions when a Filament run out occurs. (Up to the user to what you may wish)
Marlin Sketch: Configuration_adv.h
Line 448 – 450
#define FILAMENTCHANGE_XPOS 0 // Tries to move to this position - Sometimes it will be at a different position to clear print position.
#define FILAMENTCHANGE_YPOS 0 // Tries to move to this position - Sometimes it will be at a different position to clear print position.
#define FILAMENTCHANGE_ZADD 10 // Increases distance between print head and Z print platform by this amount
#define FILAMENTCHANGE_FIRSTRETRACT -10 // found you need to retract some filament
//#define FILAMENTCHANGE_FINALRETRACT -100
----------------------------------------------------------------------------------------------------------------------------------------------
Setting for temporary testing of filament movement sensor
Description: Allows the testing of filament movement sensor without heating extruder – Great for Bowden extruders with tube disconnected
from hot end. Filament can be moved forwards and backwards and jam states tested before going operational.
Marlin Sketch: Configuration.h
Line 271
Default #define EXTRUDE_MINTEMP 170
Change #define EXTRUDE_MINTEMP 0
Make sure to reset back to the default setting when finished testing.
Hope this may help
Cheers