Summary
12/30/17 Update
This part supports Filament Out sensing directly by the Prusa Mini-Rambo 1.3a board. See section below for implementation. Please note this requires a non-standard firmware load. This far I have not found any item supported by Prusa 3.1.0 firmware that this modified firmware does not support as well. This has the advantage of supporting Filament Out sensing when printing from the SD card as well as OctoPrint.
This Prusa i3 MK2(S) Filament Run Out Sensor detects filament exhaustion and triggers a Filament Change using M600 command. After the filament is changed, printing is resumed at the point of interruption.
This design depends on Octoprint to process the Pause, Filament Change, and Resume commands. Other applications could utilize this accessory as long as they rely on GPIO4 (Board Pin 7) to signal Filament exhaustion.
Print Settings
Printer:
Prusa i3 MK2S
Resolution:
0.20
Infill:
15%
Notes:
Printed in PLA. Temperatures:
- Nozzle - 200°C
- Bed - 70°C
How I Designed This
Overview
The Prusa i3 MK2S is a great printer especially for the hobbyist or light industrial desktop user. That having been said it is a raw printer without a lot of accessories that would make it a great printer. The is the fifth in a series of accessories that I designed for the i3. The others are:
Enclosure
https://www.thingiverse.com/thing:2396990
HEPA Filter
https://www.thingiverse.com/thing:2394452
Spool Holder
https://www.thingiverse.com/thing:2398480
Print Server
https://www.thingiverse.com/thing:2401423
The Filament Out Sensor consists of a small micro switch housed in an adapter that installs into the above referenced Enclosure Filament Guide. A SPDT Micro Switch provides a discrete input to the Raspberry Pi (RPi) representing the Filament Present state. This signal wire is connected to GPIO4 (Board Pin 7) on a RPi running Octoprint. See wire harness connection table below.
The signal wire is left to float when filament is present and is otherwise connected to GND. A Green LED is illuminated when filament is present, otherwise a Red LED is illuminated. If neither LED is illuminated either the Sensor is disconnected from the RPi or Octoprint is not running.
Wire Harness Pin Terminations:
Signal RPi Micro Wire Pin Switch Color -------------------------------------------------------------------------- 3.3vdc 1 N/C Red (Connected to LED Anodes - Not Switch)* GND 6 N/O Black Signal 7 Common White --------------------------------------------------------------------------- * Resisters in line with LED cathodes are required for proper illumination: Red = 56ohm; Green = 10 ohm; Slightly higher values can be used to dim the LEDs as desired. Caution: too high a resistance will turn off the LEDs.Operation
Use the following set of instructions to set up the Filament Out Sensor and replace the filament when it runs out:
- Install the Filament Sensor into the Printer Enclosure Filament Guide. This is a press fit and no fasteners are required to hold the Sensor in place.
- Insert the filament through the Sensor and Load it into the Extruder.
- Print via Octoprint as usual.
- When the filament runs out, Octoprint will:
-- Pause i3 Printing
-- Issue Change Filament command (M600)
-- Wait for operator to load filament and press Resume on the OctoPrint UI.
-- Purge the nozzle
-- Resume printing at the suspended position.
See Video: https://youtu.be/zdDrvbGfRas
Bill of Materials
- 1ea 5A SPDT 1NO 1NC Momentary Hinge Roller Lever
https://www.amazon.com/gp/product/B00MFRMFS6 - 2ea Cap Screw, Plain Finish, Flat Head, Internal Hex Drive
https://www.amazon.com/gp/product/B005DS4UR8 - 2ea M3x0.5mm Zinc Plated Nylon Insert Hex Lock Nuts
https://www.amazon.com/gp/product/B015A3DT2W - 1ea 3mm Light Emitting Diode LED Lamp Assorted Kit (See Alternative Below)
https://www.amazon.com/gp/product/B01AUI4W5U - 1ea 5mm RGB LED Diode Lights Tricolor - Common Anode (Alternative)
https://www.amazon.com/gp/product/B01C3ZZT8C - 1ea 1/8W Resistor Kit
https://www.amazon.com/Ltvystore-2425pcs-Values-ohm-Assortment/dp/B06XSHCMVV
Build Details
1. Print 3 files contained herein,

3D Printed Parts
2. Ream Base & Upper body screw holes with 3MM bit. Also ream the two LED Mount holes with a 3mm or 5mm bit depending on LED option. Insert two M3 lock Nuts in nut wells as shown:

Lock Nut Detail
3. Fasten the Base to the Upper Body using two M3x10 Counter Sink Cap Screws:

4. Ream filament guide hole through the Base and Upper Body joined parts from the Base end with a #41 Drill bit (2.41mm),
5. Construct a 3 wire cable using Red, Black, and White 26 gauge wire. Twist the wire harness so that at least 3 turns per inch is accomplished. Solder one end of the cable as follows:

6. Wire relay:
Black - Relay Common (Right Most lug with roller arm to up & to the left. White - Center Lug.Optional LED Installation:
Red Wire - Solder Anode of both Red and Green LED to Red Wire. LED wiring - 1) Cut Green LED Cathode wire to 4mm length, 2) Cut one led of 10ohm resister to 4 mm & solder to Short LED wire 3) Install head shrink over the resistor and solder connection. Trim the heat shrink exposing the remaining resistor wire just enough to allow a connection to the center relay lug,Note: The LEDs must be positioned so that the base of the LED is just to the right of the right side of the micro switch
4) Solder the resistor free wire to the center Relay lug, 5) Repeat above steps for the Red LED using a 56 ohm resistor and connecting to the resistor free wire to the left Relay lug.
7. Insert Relay/LED into Upper Body,
8. Install Lid unto Upper Body taking care not to pinch wire harness and that the strain relief secures harness,
9. Install Filament Out Sensor into Enclosure Filament Guide,

OctoPrint Configuration
1) Load Octoprint on a Raspberry Pi Zero W or later version. Full Size RPi will also work,
2) Load Filament Sensor Reloaded Plugin,
3) Configure Filament Sensor Reloaded Plugin as follows:
4) Configure G Codes:
After Job is Paused:
M117 Print Paused {% if pause_position.x is not none %} ; relative XYZE G91 M83 ; retract filament, move Z upwards G1 Z+25 E-5 F4500 ; absolute XYZE M82 G90 ; move to a safe rest position, adjust as necessary G1 X250 Y0 M600 {% endif %}After Print Resumes
M117 Print Resumed {% if pause_position.x is not none %} G28 W G1 Y-3.0 F1000.0 ; prepare to prime G92 E0 ; reset extrusion distance G1 X60.0 E9.0 F1000.0 ; priming G1 X100.0 E12.5 F1000.0 ; priming; ;relative extruder M83 ; absolute E M82 ; absolute XYZG90 ; 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 %}Optional Prusa i3 MK2S Printer board implimentation
The Filament Out Sensor can be wired directly to the Mini-Rambo 1.3a Board that was delivered with the i3 MK2S printer and perhaps other models as well. This will require loading a non-standard 3.1.0 version of the Prusa Firmware:
https://github.com/3d-gussner/Prusa-Firmware/releases
Connect the Filament Out Sensor Cable as indicated in the Image below. I used a 3 pin Servo Connector but I believe a mini Molex connector would also work and might provide a more robust retention latch.

Mini-Rambo Board - Sensor Out Connection.
Configure Sensor:
- Filament Out sensor can be set via LCD menu Settings->Fil.Runout S,
- Fil.Runout S [ON/OFF] to activate and deactivate the function,
- Fil.RS [S to VCC/S to GND] to specify sensors pulling the Signal to GND,
- Fil.RSPullup [ON] set the internal pull-up resistor.
- The status of the Filament runout sensor if activated can be seen via g-code M119 or LCD menu Calibration->Show end stops,
- During the print the Filament Out Sensor function can be Activated/Deactivated under Tune LCD menu.
Modellquelle
