Filament Sensor for Octoprint (Monoprice Select Mini)

by BrianHanifin, published

Filament Sensor for Octoprint (Monoprice Select Mini) by BrianHanifin Jul 10, 2017
3 Share
Download All Files

Thing Apps Enabled

Order This Printed View All Apps

Design Tools

Fusion 360

Liked By

View All

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

Print Thing Tag


Thing Statistics

5578Views 418Downloads Found in 3D Printer Accessories


I was jealous that other 3D printer users had their own filament sensor accessories, and I thought it was about time for a Monoprice Select Mini user to have make it happen! So I ordered a Makerbot 1.2 style endstop from China^^, completed a 10 project course on Fusion 360 on Udemy, and waited 5 weeks for the endstop to arrive.

Now we have a working filament runout sensor which pauses your prints and waits for you to tell it to resume the print (ideally after you've installed a fresh roll of filament). ;)

Please look for the Supplies section below to see what parts you need to make sure you have ready to go before beginning this project. Under Post Printing you can find a brief guide for how to put these supplies together, and in particular how to setup Octoprint to pause your prints when the endstop indicates the filament is not longer present.

Print Settings


Monoprice Select Mini






FilamentSensor1.1.stl has both parts of this model nicely plated right next to each other in a way that I believe will help your mini print with less movement.

If you need to replace just one of the two parts, print FilamentSensor1.1-lid-only.stl or FilamentSensor1.1-bottom-only.stl.


Quick Setup Guide

Wiring a Raspberry Pi, installing, and configuring Octoprint is outside the scope of this guide. However, these are the tasks you will need to complete.

  1. Install the Filament Sensor Reloaded.
  2. Connect the endstop to the Raspberry Pi. (Might I suggest this printable to assist with this?) On the Raspberry Pi 3 the pins are:
    Pin 1: 3.3vdc
    Pin 6: Ground
    Pin 7: GPIO4
  3. Configure Filament Sensor Reloaded's settings:
    Pin: 7
    Debounce Time: 250 ms
    Switch Type: Normally Open
  4. Copy and paste the code from the Octoprint "GCODE Scripts" section below, into the "GCODE Scripts" section of Octoprint settings.
  5. Restart octoprint.^^^

Assembly Guide

After you have gathered your hardware, configured the software, and printed this case you are going to what to know where to put it. Well, I can help you out there.

Step 1

Remove these two screws, and set them somewhere safe. You will use them to hold the sensor case in place.

Figure 1

Step 2

Put the case in its place and secure it with the screws you removed in Step 1.

Figure 2a.

Figure 2b. This screw is designed to go in before the endstop board is installed.

Step 3

⚠ Note: This is going to be tight! ... and it was designed that way. I wanted to design an accessory that did not require any additional hardware to secure the board in place. Just be gentle when putting the switch arm in place and you will be alright.

Start with the board into the case the angle shown in Figure 3a below. Then with your fingers gently pressing on the white plug and closing the switch arm carefully lower the board into place until it is flat on the bottom and the switch arm is inside of the filament slot opening.

Figure 3a. Set the board at this angle to begin.

Figure 3b. Using two hands here will make this much easier!

Step 4

Plug your jumper wires into the board.

Figure 4. Use the cable that came with your endstop as a guide. For example, mine had red, black, and green wires (which are used for 3.3v, ground, and signal respectively).

Step 5

Test the endstop with the board plugged into your Octoprint board. If the LED is ON before you insert the filament, the metal switch arm is caught on the case and needs to be adjusted.

⚠ Note: Even though these boards are based on an open source design, there are slight variances in size from each manufacturer. I have tried two different boards and they had a 0.1mm difference in dimension in the width and depth of the board.

By trying a combination of board placement adjustment and careful bending of the metal switch arm I was able to get both endstop boards to work correctly. Keep at it until the LED stays out when filament is absent from the case.

For proper functionality to occur the LED on the endstop should turn off when the filament is removed from the case. (You can test this easily by inserting then removing a piece of filament to make sure the adjustments you performed are working well.)

Step 6

Attach the handy snap-fit lid. Start with the back side of the case as shown in Figure 5 below, then click in the front side.


If you have Octopi configured properly you should be able to insert some filament and get printing!

Figure 6. After the filament passes out the other side of the sensor, you should see the right side of the case glow red. This indicates the filament has been sensed.

Project Status

Change Log

  • 7/23/2017 12pm PST
    Actually uploaded v1.1 STL files. Thanks for the heads up Mookiefer!
  • 7/22/2017 9:15pm PST
    1.1 Release! Tolerances were relaxed a bit to better accommodate an endstop made by DAOKI. I now have this endstop working on my personal Select Mini.
  • 7/16/2017 3pm PST
    1.0 Release! Major changes since Prototype: 1.) A snap-fit lid has been added to keep the board in place, 2.) Source Files.zip includes Fusion 360 archive format and a STEP file. 3.) a visual assembly guide!
  • 7/12/3017 10:00am PST
    Prototype 8: 1.) Removed seam where stabilizer model attaches to the case. 2.) Per the recommendation of Patrick Nixon I reduce the stabilizer arm width from 5.5mm to 4mm, and the screw surround from from ~11mm to 9mm. This should help fit around more extruder assemblies.
  • 7/11/2017 4:30pm PST
    Prototype 7: Improved the filament channel and blocked all escape routes. ;) Also tightened up the overall model. The endstop board fits quite snugly and may not even need a lid to keep it in place.
  • 7/10/2017 12:20pm PST
    First draft of instructional guide.
  • 7/10/2017 7:55am PST
    Prototype 5B: Added stabilizing arm with a second screw to keep the sensor from rotating.


Question: Why did you choose this board when a plain switch would work?

Answer: Technically, we could use a switch, but I chose this board for three reasons. 1.) it's widely available, 2.) It is easy to plug in with female to female jumpers, 3.) It has an LED to provide instant feedback.

Question : I would like to create a remix. Will you share your source files?

Answer: *Download *Source Files.zip". I included a Fusion 360 archive file, as well as a STEP file.


To order (if you don't have these on hand)

You should already have these setup and working

  1. Monoprice Select Mini 3D Printer.
  2. A device with Octoprint installed on it. Might I suggest a Raspberry Pi 3 with Octopi installed?

Octoprint "GCODE Scripts"

After print job is paused

M117 Print Paused

{% if pause_position.x is not none %}
; relative XYZE

; retract filament, move Z slightly upwards
G1 Z+5 E-5 F4500 

; absolute XYZE

; move to a safe rest position, adjust as necessary
G1 X0 Y100
{% endif %}

Before print job is resumed

M117 Print Resumed

{% if pause_position.x is not none %}
; relative extruder

; prime nozzle
G1 E-5 F4500
G1 E5 F4500
G1 E5 F4500

; absolute E

; absolute XYZ

; reset E
G92 E{{ pause_position.e }}

; move back to pause position XYZ
G1 X{{ pause_position.x }} Y{{ pause_position.y }} Z{{ pause_position.z }} F4500

; reset to feed rate before pause if available
{% if pause_position.f is not none %}G1 F{{ pause_position.f }}{% endif %}
{% endif %}


^ I uploaded this early prototype per the request of Derek Were-Yeti Mitchell on the wonderfully supportive MP Select Mini Owners Facebook Group.

^^ Or you can get and endstop much quicker from Amazon (for example: this one).

^^^ Choose "Restart System" on the Power menu on the Octoprint web interface.

^^^^ Make sure the one you order looks like the one in the photos. Do not order one with a roller as it won't fit.

More from 3D Printer Accessories

view more

All Apps

Auto-magically prepare your 3D models for 3D printing. A cloud based 3D models Preparing and Healing solution for 3D Printing, MakePrintable provides features for model repairing, wall thickness...

App Info Launch App

Kiri:Moto is an integrated cloud-based slicer and tool-path generator for 3D Printing, CAM / CNC and Laser cutting. *** 3D printing mode provides model slicing and GCode output using built-in...

App Info Launch App
KiriMoto Thing App

With 3D Slash, you can edit 3d models like a stonecutter. A unique interface: as fun as a building game! The perfect tool for non-designers and children to create in 3D.

App Info Launch App

Print through a distributed network of 3D printing enthusiasts from across the US, at a fraction of the cost of the competitors. We want to change the world for the better through technology, an...

App Info Launch App

Quickly Scale, Mirror or Cut your 3D Models

App Info Launch App

3D Print a wide range of designs with Treatstock. Easy to use tools to get the perfect result. The global 3D printing network that connects you with high-quality and fast working print services nea...

App Info Launch App
Comments deleted.

I will build this tomorrow, great work. I have sugestion: I have runout of filament a couple of times, while not being at home. So the printer was running with the hotend ON like for many hours, PLA was cooked inside of it... Would it be posible to add some line into the gcode to turn off the extruder when the sensor pauses the printing?

I found some Octoprint code snippet that should turn the hotend, heatbed, fan, and motors off (I would insert this code just before the {% endif %}). However I don't know if there is a way for Octoprint to resume the previous temperatures or fan speed.

; disable motors

;disable all heaters
{% snippet 'disable_hotends' %}
{% snippet 'disable_bed' %}

;disable fan
M106 S0

Have you figured out a way for the temps to resume to previous? thanks.

Have you uploaded the version 1.1 files?

I'm still seeing the 1.0 files. With 1.0 my switch is always on even without filament in it. I'm using these: https://www.amazon.com/gp/product/B06XTB7WMK/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1

Oh my gosh! Thank you so much for the heads up! They are uploaded now.

super cool but it would be universal if it bolted on top using one of the stepper screws.

BTW, I included source files if you want to remix it be my guest. :)

There is an advantage for my current mounting method. You can use your existing screws. I could be wrong but I believe I would need to buy some longer screws to mount it on top of that back bar. I am still intrigued by your idea though. :)

i was thinking that black bar next to where its its screwed now is probably a standard height just a bit taller than the bowden connector

Hmm... that is an intriguing idea. So, universal, as in it would work with any Mk8 extruder? I will have to give it some thought. If i don't end up doing it though, I will be including some source files with this when it is complete.

FYI, I am modifying it so the stabilizer parts that go around and behind the extruder are a bit thinner based on the feedback of a user that is using this extruder base: https://www.thingiverse.com/thing:2029972 . It is printing now and after I test it to make sure I didn't break anything I will upload it.

MPSM Extruder Baseplate v1