<p>With marlin firmware:</p>

<p>source here: <a href="http://marlinfw.org/docs/configuration/configuration.html#filament-runout-sensor" rel="nofollow noreferrer">filiament sensor config</a></p>

<pre><code>//#define FILAMENT_RUNOUT_SENSOR
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
  #define FIL_RUNOUT_INVERTING false // set to true to invert the logic of the sensor.
  #define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
  #define FILAMENT_RUNOUT_SCRIPT "M600"
#endif
</code></pre>

<blockquote>
  <p>With this feature, a mechanical or opto endstop switch is used to
  check for the presence of filament in the feeder (usually the switch
  is closed when filament is present). If the filament runs out, Marlin
  will run the specified GCode script (by default “M600”). RAMPS-based
  boards use SERVO3_PIN. For other boards you may need to define
  FIL_RUNOUT_PIN.</p>
</blockquote>

<p>and this is a nice piece of hardware: <a href="https://www.thingiverse.com/thing:2147179" rel="nofollow noreferrer">run out sensor</a></p>

CC BY-SA 3.0
2018-03-08T15:37:42.260Z
Gorgeous!  i was going to suggest the disastrous panic-stop by having the runout switch kill main power.  That pretty much ruins the print in progress.  I"m off to see if my driver board has those pins available.
Carl Witthoft
CC BY-SA 3.0
2018-03-09T06:34:44.697Z
Great! Now I will design the sensor.
Fernando Baltazar
CC BY-SA 3.0
2018-03-08T11:01:06.997Z
2018-03-08T11:01:06.997Z
profesor79
<p>I have the Anet A6 and I was wondering if it is possible to add a filament run-out sensor. I would feel better having something to stop the filament before it runs through and I have to take apart the extruder. </p>

CC BY-SA 3.0
2018-03-08T10:57:41.197Z
what firmware do you have on your a6?
profesor79
<anet-a6>
Adding a filament sensor
Ljk2000
# Adding a filament sensor

(Asked by: username_0 on 2018-03-07)

I have the Anet A6 and I was wondering if it is possible to add a filament run-out sensor. I would feel better having something to stop the filament before it runs through and I have to take apart the extruder.

**Tags:** anet-a6
> **Comments:**
> **username_1**: what firmware do you have on your a6?  

---

## 1 answers

### Answer by username_1 on 2018-03-08. Score: 3 | Accepted answer

With marlin firmware:
source here: filiament sensor config
//#define FILAMENT_RUNOUT_SENSOR
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
  #define FIL_RUNOUT_INVERTING false // set to true to invert the logic of the sensor.
  #define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
  #define FILAMENT_RUNOUT_SCRIPT "M600"
#endif


With this feature, a mechanical or opto endstop switch is used to
  check for the presence of filament in the feeder (usually the switch
  is closed when filament is present). If the filament runs out, Marlin
  will run the specified GCode script (by default “M600”). RAMPS-based
  boards use SERVO3_PIN. For other boards you may need to define
  FIL_RUNOUT_PIN.

and this is a nice piece of hardware: run out sensor

> **Comments:**
> **username_2**: Gorgeous!  i was going to suggest the disastrous panic-stop by having the runout switch kill main power.  That pretty much ruins the print in progress.  I"m off to see if my driver board has those pins available.  
> **username_3**: Great! Now I will design the sensor.  

---

