Filament Runout Sensor Set-Up Instructions for MakerGear M3-SE 3D Printers

Filament Runout Sensor Set-Up Instructions for MakerGear M3-SE 3D Printers

These instructions are made possible with the help of Alex K. Thanks again, Alex!

NOTE: Before doing anything, make sure your 3D printer is powered off and unplugged from any power source! 


Installing the mount and filament sensor

  • Remove the two machine screws holding the existing filament guide tube holder in place and remove the guide tube holder.
  • Reusing the two screws, install the filament sensor mount in the same location where the guide tube holder was located.
  • Slide the filament sensor into the mount until it clicks into place. The filament path of the sensor should line up with the hole at the top of the mount so filament can pass through freely.

NOTE: the arrow on the filament sensor should be pointing up


Connecting the filament sensor to the Raspberry PI

  • Remove the four screws that are holding the Raspberry PI case in place (on the underside of your MakerGear printer) and carefully remove the lid of the Raspberry PI.

Looking from the front of the printer, locate the plug on the lower left side of the Raspberry PI.

  • Unplug this plug, taking note of its orientation. 
  • Insert the wires from the filament sensor into the open positions of the plug.
    • Pin positions of the raspberry pi run from right to left starting with the pins closest to the front of the printer.
      • Red wire to position 2 (5v pin)
      • White wire to position 5 (GPIO header pin)
      • Black wire to position 9 (ground)


  • Run the filament sensor wires along the existing wiring harness, up to the location of the filament sensor and plug it in. The plug is keyed, so it will only insert in one orientation. Use the included zip ties to secure the wire to the existing wiring harness.


  • Replace the lid of the raspberry PI and reinstall the screws holding the case in place. 
  • NOTE: Be careful not to overtighten the case screws, they strip very easily!


Setting up Octoprint

  • Navigate to Plugin Manager under your settings menu (the wrench icon)
  • Install the Octoprint plugin “filament sensor reloaded”
  • Open the newly installed plugin and change the following three settings
    1. Pin: 3
    2. Switch Type: Normally Closed
    3. Board Pin Mode: BCM Mode
  • Click Save


Configure GCODE scripts

  • Navigate to GCODE Scripts under your settings menu (the wrench icon)
  • Copy and paste the following script to the “After print job is paused” section

    G91 ; sets relative position
    G1 X205 Z10 F1000 ; moves the hotend to the right and down 10mm
    G1 E-50 F1200; retract 50mm at 1000mm/min
    M104 S120 T0 ; start cooling T0 to 120 degrees Celsius
    G90 ;goes back to absolute mode

  • Copy and paste the following script to the “After print job is resumed” section

    M117 Print Resumed
    {% if pause_temperature[0] and pause_temperature[0]['target'] is not none %}
    M109 S{{ pause_temperature[0]['target'] }}
    {% else %}
    M104 S0
    {% endif %}
    G1 E60 F200; extrude 60mm at 200mm/min
    G1 X-205 Z-10 F1000

  • Click Save

That’s it, you are done! Now when the filament runs out, the printer will pause, move the extruder off the bed and retract the filament. When you are ready to resume printing, insert new filament, feed it a little bit using the “Extrude” command in the Octoprint interface and click resume.

NOTE: When resuming a print, it is a good idea to stay near the printer to pull the purged filament away, so it doesn’t drag onto your print.   

May 22, 2020 Jonah Barker - Partsbuilt 3D

Recent Posts