Welcome! Log In Create A New Profile


Filament Runout Sensor Problem

Posted by GreatBazunka 
Filament Runout Sensor Problem
December 29, 2016 08:28AM
I am hoping someone can give me a straight forward answer for this because i haven't been able to find one. I just swapped the Melzi on my Prusa I3 for a RAMPS 1.4. Everything seems to be working great after the swap and i am trying to enable some of the new features that are at my disposal now. My problem is that i cannot get the filament runout sensor to work properly. I see the section in the configuration.h file and thought i turned it on, but configuration.h and pins.h seem to be pointing at two different pins to attach the switch to. I have tried both spots and i don't seem to get a response from the switch i have attached. Oh yeah, i am using a mechanical switch with wires coming from NO and C. I believe that is correct. Can someone please correct what i am doing wrong and maybe give me a run down of what configurations i should be changing in the firmware and where exactly i should be plugging the switch into? I can't find much information anywhere and even the RAMPS schematics dont seem to have the pins labeled the same was as the configuration files do. Thanks in advance.
Re: Filament Runout Sensor Problem
December 31, 2016 05:29PM

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.
#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..

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
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

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
Re: Filament Runout Sensor Problem
January 03, 2017 08:40AM
Thanks for the reply. Just wanted to post this for everyone out there that is trying to get this done and does have the time/expertise to dig into the code to figure out what is going on. All i had to do in the most recent version of Marlin was to uncomment the needed entry in the configuration.h and i left the pin assignment alone. It was assigned to D4 on the RAMPS 1.4 schematic. I connected to this pin with a plain manual micro switch. The catch that i was not aware of was that you need to connect C on the switch to the negative pin in that group and NO to the D4 pin. I used a 3 pin dupont connector and put the two wires on the opposite ends of the connector so they would line up with the correct pins.
Filament Runout Sensor Problem-The next tweak please!
November 18, 2017 03:40PM
Thanks to all who contributed to this thread as it solved my issue. I DO NOT use SD printing and as originally defined in Firmware this is the only way it would work until the above mentioned adjustment. HOWEVER, now the sensor is active all the time - not just when I am printing. This has caused a lot of false triggers when I am just jogging around. Does anyone now how to re-incorporate a Print timer into this line of code?

I tried this but no joy...

if (IS_print_job_timer) && !(READ(FIL_RUNOUT_PIN) ^ FIL_RUNOUT_INVERTING))

Thanks in advance for any reply/help!
Re: Filament Runout Sensor Problem
November 27, 2017 09:55AM

I've had similar issues with the Filament Runout funtionality. It appears to me, but has not yet been confirmed by others that use LCD screen and SD card cause issues, at least the two different methods I used to get it to work. Here are two youtube videos I made to help othesr having the same issue.

Mechanical Endstop method:

Optical Endstop Method:

Let me know if this helps ...


Edited 2 time(s). Last edit at 11/28/2017 09:34AM by ebraiman.
Re: Filament Runout Sensor Problem
November 27, 2017 10:50AM
I too had problems setting up the filament run-out sensor, I read every post I could find tried every suggestion that was given to me.
Finally someone mentions that they were using unused end-stop pins. so this is where I found a solution for my delima.
By using the X_MAX-PIN for the filament run-out sensor.

// define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector
// #define FIL_RUNOUT_PIN 4
// define X_MAX_PIN 2 for the filament runout sensor.
#define FIL_RUNOUT_PIN 2 // #define X_MAX_PIN 2
Sorry, only registered users may post in this forum.

Click here to login