
Orbiter Filament Sensor Summary

Hi! This is my filament sensor add-on for the Orbiter extruders.
The main features are:
Compatible with Orbiter v1.0, v1.5 and v2.0
Firmware fully supporting this sensor: RRF and Klipper, Marlin very limited - not recommended.
Before I reached this solution, I have tried many sensor types and
sensing methods, in the end this is the final solution I considered most
suitable for this purpose.
Basically, as you can see it in the pictures it uses a special
push-button (like the ones used in computer mouses, rated to over five million clicks).
When filament is inserted the 6mm steel ball pushes the button triggering a
filament presence sensing. This is information is used in the firmware to
launch a macro to auto load the filament.
The unload button is connected to an input of the control board
which is configured to trigger the unload macro.
The filament entry ring is printed out of a transparent material which is lit by a bicolor LED to show status as follows:
Please note the filament sensing button used here is not a standard TACT
switch. It has a different internal construction. The button movement range is
about 0.7mm, the output contact is engaged @ about 0.3 mm and released @ about
0.2mm.
Demo
*Note in this video a beta version was used in which the LED colors where mixed up.
the filament sensor
1. Orbiter sensor v1.0
This is the first released version of the sensor design.
Some users reported fake filament runout detections with the
sensor leading to pause of the print.
The main root cause for this is the tolerance of the MJF
printed housing. Honestly, I had the impression that MJF printing has a much
better tolerance, but in fact I learned is much worse compared to FDM printing.
As end effect the PCB is to lose inside the MJF printed housing allowing it to
move too far away from the filament leading to fake detections.
Make sure you use a reverse bowden tube, this allows the filament to enter the sensor in the correct path. If you do not use a reverse bowden tube please add a short PTFE tube (2-3 cm length) inside the filament input light guide.
1) Press some shims behind the sensor PCB to force the PCB towards the front
You may use some plastic material less than 1mm thick to stick it between the PSB and the highlighted guide surface.

2) Using a soldering iron lift the position of the sensor switch by about 0.3-0.5mm.
This gets the sensor switch closer to the filament ensuring proper triggering of the switch when filament is inserted.

3) One user successfully fixed it by adding a piece of plain paper between the sensor switch and the metal ball. The paper shall be thick enough to get the sensor triggered tor a lower distance. Maybe you need to fold paper in two or three to get the right thickness.
4) Since the issue is the MJF print tolerance you may print the housing using your printer, a well calibrated printer will print it with much better tolerance and fixing this issue.
In the new version v2.2 of the sensor housing this issue is addressed, I redesigned the internal shape of the housing so print tolerance affect less the position of the PCB, it holds the PCB more tight compared tov1.4. Moved the sensor PCB 0.3mm closer to the filament to even further reduce the possibility of fake runout detection.
2. Orbiter sensor v2.2
Orbiter sensor v2.2 design changes:
Electronic design changes
-
Improved sensor signals hardware filtering which
cannot be done effectively in software.
-
Unload signal blocked when there is no filament
detected.
-
Output logic of the sensor inverted (compared to
v1) detection leads to signal high level. This improves compatibility to other
sensors.
-
Solder jumper to select 3.3V or 5V supply for
the input illumination LEDs (JP1 and JP2). This ensures that also with 3.3V supply
voltage the LEDs are brightest possible. By default, the sensors are shipped
with jumper open. For 3.3V operation its recommended to be closed (a soldering
iron is needed). However, the only difference will be brighter input
illumination, it does not affect the sensor operation.
-
Bicolor LED changed to two separate LEDs with
much higher brightness.
Housing design changes
-
PCB guide path enlarged to better keep the PCB
in place.
-
Sensor PCB moved closer to filament by 0.3mm – avoid
fake filament runout detection due to printing tolerances of the MJF printed
housing.
-
“Unload” inscription changed to bigger
characters for an easier printability.
-
Housing inside has a version marking foe easier
versioning traceability.
The sensor is perfectly compatible with the first version. PCB size is the same. The main functional difference is the inverted logic of the output signals. Housing updates are only applicable for the MJF printed housing LDO provides for Orbiter v2.0. The new PCB design v2.2 shall perfectly fit into the v1 version printable housings for Orbiter v1.0 and v1.5.
3. Assembly instructions
Wiring configuration of the sensor
- Blue - GND
- Red -> +3.3V*
- Green -> Filament Sensor
- Yellow -> Filament Unload
* 5V supply voltage is also accepted but make sure the microcontroller input pins are also tied up to 5V otherwise the indicator LED will not work. Recommended supply voltage is 3.3V.

Make sure you use a reverse bowden tube, this allows the filament to enter the sensor in the correct path. If you do not use a reverse bowden tube please add a short (2-3cm length) PTFE tube inside the filament input light guide.
Assembly video
4. Firmware Configuration
When the filament is inserted, the firmware is configured to
launch a macro which automatically loads the filament into the extruder. The filament must be pushed in firmly until reaches the gears so when the macro
starts the extruder gears will grab the filament and pull it in.
Pushing the unload button the firmware starts a macro for automatic filament
unload.
This preheats the hotend before extraction to ~235°C (user configurable) which is fine for most
filament types.
After filament extraction the hotend heater is switched off.
Both macros shall be configured to be active only when not printing.
Note: I have not defined a macro or configuration to detect filament runout yet.
4.1 Configuration for RRF firmware - Duet boards
Configuration Step 1:
You must connect the FS pin or Filament Sensor signal to an input of your board which is able to trigger an event. I have connected this pin to the duet board ENCB pin on the alphanumeric LCD connector.
M950 J1 C"^connlcd.encb"; define logical input for filament auto load
M581 P1 T2 S0 R0 ;define trigger for filament auto load triggers
trigger2.g
Configuration Step 2
Define the firmware trigger for filament load trigger2.g macro with the following content:
;Autoload filament macro
T0 ; select tool 0
M300 S2000 P100 ; play beep sound
M291 P"Filament autoloading!" S0 T3 ; display message
M302 P1 ; enable cold extrusion
G4 S1 ; wait for one second
G1 E15 F500 ; load filament inside the gears
M109 S235 T0 ; set hotend temperature and wait
G1 E200 F500 ; extrude 200mm, you may need to reduce speed for very soft TPU
M104 S0 T0 ; set hotend temperature to 0
M302 P0 ; disable cold extrusion
M291 P"Filament autoload complete!" S0 T3 ; display message
Configuration Step 3
You must connect the FU pin or Filament Sensor signal to an input of your board which is able to trigger an event. I have connected this pin to the duet board ENCA pin on the alphanumeric LCD connector.
M950 J2 C"^connlcd.enca"; define logical input for filament unload
M581 P2 T3 S0 R0 ; define trigger for filament auto load triggers
trigger3.g
Configuration Step 3
Define the firmware trigger for filament load trigger3.g macro with the following content:
;Auto unload filament macro
T0 ; select tool 0
M300 S4000 P100 ; play beep sound
M291 P"Filament unloading!" S0 T3 ; display message
M109 S235 T0 ; set hotend temperature to 235 and wait
G0 E-5 F3600 ; extract filament to cold end
G4 S3 ; wait for 3 seconds
G0 E5 F3600 ; push back the filament to strive stringing
G0 E-15 F3600 ; Extract fast in the cold zone
G0 E-70 F300 ; continue extraction slow allow filament to be cooled enough
before reaches the gears
M104 S0 T0 ; set hotend temperature to 0
M291 P"Filament unload complete!" S0 T3 ; display message
Note: Do not assign macros to trigger0.g or trigger1.g as they are already reserved for other function in RRF!!!
Make sure the macro's cannot be triggered during printing, this will avoid the unwanted start of the loading / unloading filament macros by accidental triggering of the sensor. See M581 description for details.
4.2 Configuration for Klipper
Connect the FS (Filament sensor signal) pin and the FU (Filament unload signal) to spare digital inputs of your main board. Best is to use pins from spare pin headers or unused expander board connections. Supply the sensor board with +3.3V and GND.
It is not recommended the use inputs with pull up resistor to 5V like end stop inputs. If these are the only spare inputs you have you may use them but in this case supply the sensor board also with 5V!
Upload the orbiter sensor configuration file, OrbiterSensorV2.2.1cfg to your configuration files as shown in the next picture:

Edit the pin configuration for the gcode button ([gcode_button sensor_fs]) and type in the pin name to which the filament sensor signal is connected.
Edit the pin configuration for the gcode button ([gcode_button sensor_fu]) and type in the pin name to which the filament unload signal is connected. Note for the v2.2 sensor the signals shall be inverted to place "!" before the port name.

Include the orbiter sensor configuration file into the printer.cfg as follows:

In the [extruder] section the minimum extruding temperature must be configured! The macro is not working with cold extrusion enabled (extruder min temp set to 0). Klipper sets this parameter by default to 170deg C, My recommendation is to change that to 180deg C.
min_extrude_temp: 180
Restart Klipper & enjoy!
The story of the Orbiter sensor
Before I reached this solution, I have tried many filament sensing
methods. My main goals were a very compact design (maximum 7mm height) and
working with all kind of filaments. In addition, should work in my future
projects as well where the space is extremely limited. For those interested
here is a summary of my investigations.
1 Panasonic detector switch ESE24MV
First version of this sensor used a panasonic detector switch ESE24MV like the one used in the mosaic palette design.
It has a very good detection performance and very compact but during testing I have found a potential issue.


If the filament forms a kind of blob or ball shape at the end of the
filament during extraction, this causes the filament to be stuck inside
the sensor. Happened to me several times, not easy to get the filament out and
there is a potential risk to break the sensor lever if the filament forced. This is because the tip of the lever is to sharp, if it would be rounder
shaped would work perfectly.
2 TOF (Time of Flight) based sensor
The idea is to sense
presence of filament based on time taken for light to be reflected back in the
sensor. I've made a cavity in which when no filament was present the light
travel distance was about double. The sensor gives a different distance reading
when filament was present or not.


I have written an Arduino software with a filtering solution to detect
all kind of filaments. I have tested with over 30 filaments I had in my stock. The solution looked excitingly promising. It was working even with transparent filament. The weakest signal I got was from Black filament, nevertheless it was still detectable. Below you can see the distance reading of the sensor. Peaks - no filament, dips are with detected filament.



After deeper investigations I discovered that the sensor changes its distance reading a lot
with temperature. There is an internal temperature compensation but is not a
continuous type it’s a stepwise compensation (the compensation is done for
temperature intervals of about 30 degrees) which made impossible to make a
difference between 6 and 12mm reading over temperature with the same threshold setting . It would need a threshold compensation over temperature, this means a need for calibration of each produced device, which means of course high effort in manufacturing, therefore this is not a very practical solution for filament presence detection. But I have to admit its a cool concept to bad it do not work perfectly. In addition, the sensor has low accuracy below 10mm.
3 Snap Action Switch
This is a widely used simple
filament sensing method. Pretty reliable however it does not fits into the space
I intended. Filament sensor based on this kind of switch is to big for my purpose. The one in the picture is also a very bad design, they shall use snap action switch with bent round metal ending not with plastic sleeve. We print kilometers of plastic (one kg spool is around 300 meters) that sleeve simply cannot resist so rolling.

4 IR filament sensor
Similar solution used
in many Prusa printers. Uses an indirect sensing method. A mechanical lever is displaced by the
filament which interrupts the IR signal emitted from the IR led to the IR
sensor. It’s a very reliable solution but occupy more space than I planned for
my Orbiter sensor.

5 Hall based sensor
The idea is to detect movement of a steel or a neodymium ball magnet displaced
by the filament.
To detect steel, we
need a sensor which includes a tiny magnet. Detection is based on closing the
sensor magnetic circuit by an external magnetic material like a steel ball. One
of the disadvantages of such method is the difficulty to reliably detect a
movement of ~1mm.
Hall sensors have a
huge parameter drift over temperature. Its easy to make it work in a narrow
temperature range as room temperature, but using it with enclosed chamber,
temperature compensation it’s a must. I abandoned the idea due to high concerns
if such method can offer a reliable solution of detecting ~1mm displacement in
a wide operating temperature range.

6 REED switch + ball magnet
The switching
mechanism is comprised of two ferromagnetic blades, separated by only a
few microns. When a magnet approaches these blades are pulled toward one
another. Once touching, the blades close the normally open (NO) contacts,
allowing current to flow.


The delta distance between engagement and disengagement is too big,
higher than 1mm plus distance depends on the magnet orientation so a ball
shaped magnet cannot be used
7 Inductive proximity Sensor
They are successfully used
as bed level sensor. The operation principle is based on inductance change of an
energized coil in presence of a metal (steel ball displaced by the filament).


Here we can have two
effects. Inductance change due to ferromagnetic material placed closer to the
coil. Like a steel ball. Or interaction with eddy current induced into a metal –
effect used to detect aluminum heated bed.
These sensor types are
capable to detect ~1mm distance change but do not fit into the space I planed.
8 Capacitive proximity sensor
They look similar to
inductive sensors but the operating principle is completely different. They detect
changes of a self-generated electrical field due object moving in front of the
sensor. One main advantage over inductive sensors is that capacitive proximity sensors can detect also nonmetallic materials. On the downside they are less
accurate and affected a lot by temperature change, not suitable to detect displacement
of ~1mm.


9 LASER filament sensor
Similar to the filament monitor developed by Duet 3d. Uses surface movement tracking like LASER
computer mouse's. The sensor itself would fit but direct reading of all filament
types is not possible. Indirect reading would work perfectly, I'm using such solution for long time ago, but its not fitting in my
target space.
I’ve made a remix to
use indirect reading of a CF rod rotated by passing filament. The result is
very consistent, however support of this kind of sensor has been dropped by
developers. You can find the senor design here:

10 Magnetic position encoder
It’s a very widely used
and very reliable position sensing method used in many applications like: closed
loop stepper drivers or rotor position sensing of BLDC motors. Its indirect
filament movement detection mechanism based on a small magnet rotated by the filament.
Unfortunately, it’s not fitting into the space I proposed. I prefer such
monitoring systems to be used remotely attached to the printer frame.

11 Optical Endstop and Encode Wheel
Simple cheap and well
working solution but is not fitting into my purpose. The idea is similar to movement trackers of computer mouses used before LASER technology. The filamenl rotates an encoder wheel (a disc full of slots) Every time a slot passes trough the IR sensor it generated a pulse.
Here you can find
very nice well working design done by Yves from Fractal Engineering:
