Site Navigation

Your Account

Choose Language

How it works ¶ 

  • Filament moving through the filament monitor is detected by the laser optical sensor. The microcontroller in the filament monitor reads the amount and direction of motion and periodically sends the accumulated amount of motion to the Duet.
  • When net extruder movement greater than the number of mm configured in the E parameter (for example 3mm) has been commanded, the extrusion measured by the filament monitor is compared with the amount of extrusion commanded.
  • If the difference between what has been commanded and what has been measured by the filament monitor is greater than the configured tolerance (configured using the R parameter), the print is paused and an error is reported.
Block Image

Installing the Laser Filament Monitor ¶ 

Warnings ¶ 

  • The optical sensor on the filament monitor PCB is delicate! Take great care not to damage it or to touch it. Do not put the filament monitor PCB component-side down on any surface. Damage to the optical sensor is not covered by the warranty.
  • The Duet3D Laser Filament Monitor is designed to be powered with 3.3v only. If you supply 5V power to it, you will destroy the optical sensor.
  • The sensor is a Class 1 Laser device. Under normal conditions, the laser beam is always below the IEC 60825-1 maximum permitted output level of 716uW according to the manufacturer of the optical sensor; nevertheless we advise against looking into the beam when the filament monitor is powered. You should most definitely not look at the sensor through magnification when it is operating. The laser beam is invisible infra red, therefore your eye blink reflex will not protect you!

Mounting ¶ 

The Laser Filament Monitor should be mounted in such a way as to avoid dust settling on the optical sensor, which is on the component side of the PCB (the opposite side to the connectors). Do not mount it with the optical sensor facing up and connectors facing down. If you mount it with the filament path horizontal, mount it with the connectors uppermost if possible. If you mount it with the filament path vertical, orient it with the connectors at the bottom so that closed end of the housing is at the top.

Block Image

It does not matter which end of the filament monitor you use as the filament inlet and which end as the outlet.

The distance between the filament monitor outlet and the extruder drive inlet should be kept short and the filament must be constrained by PTFE tubing over this distance, so that when the filament reverses its movement direction due to retraction, the retracted filament is forced to reverse through the filament monitor.

If you need to place anything close to or on top of the rectangular aperture in the top plate of the filament monitor, it must be matt black. One option is to replace the top plate (see the Hardware section) by a deeper version that is closed at the top.

Connecting to the Duet ¶ 

Connect the filament monitor to an endstop connection on the Duet mainboard (typically E0 or E1, but you can also use any of X, Y or Z that are free), using a 3 wire straight-through cable with a Molex KK cable socket on either end. The cable does not need to be shielded.

( Note: The Filament monitor must be connected to an endstop on the main Duet board, or on the CONN_SD connector. It does not work connected to an endstop on a DueX expansion board.)

On startup, after a few seconds the green LED on the filament monitor will flash 3 times if initialisation and self-test are successful. The green and red LEDs will then flash periodically indicating communication to the Duet. If the filament is moving, the green LED will flash more frequently.

If initialisation or self test fail, the red LED will flash an error code (currently this is always 5 flashes). It will retry every few seconds.

Optional filament presence switch ¶ 

You may connect a microswitch to the 2-pin connector, arranged so that the switch contacts are closed when filament is present and open when it is not. However, this is not normally necessary, because the filament monitor will detect that there is no filament moving through just a few mm after the end of the filament has passed over the sensor, which will normally be well before the end of the filament reaches the extruder drive.

Note this switch header is not populated in newer 1.7 versions of the monitor but it can be added if desired

Configuring Filament Monitoring ¶ 

You must be using RepRapFirmware 1.21 or later.

The filament monitor is configured using the M591 command, see M591. Here are some examples of that command:

M591 D0 P5 C3 R40:120 E3.0  ; Duet3D laser sensor for extruder drive 0 is connected to endstop input 3 (E0), tolerance 40 to 120%, 3mm comparison length
M591 D0                       ; display filament sensor parameters for extruder drive 0

Brief explanation of parameters:

  • D = extruder drive number
  • P = filament sensor type. P5 = Duet3D laser filament monitor without additional filament presence detection switch, P6 = Duet3D laser filament monitor with switch.
  • E = minimum extrusion length before a commanded/measured comparison is done, default 3mm
  • C = endstop number (0 = X, 1 = Y, 2 = Z, 3 = E0 etc.). Endstop inputs 5-9 which are on the DueX2 or DueX5 expansion boards cannot be used. Endstop inputs 10-11 on the CONN_LCD connector can be used.
  • Raa:bb = minimum and maximum permitted measured movement as a percentage of commanded movement
  • S = 0 to disable comparison of commanded vs. measured output, 1 to enable comparison and pause the print if a discrepancy is detected

Initially you will not know some of the correct parameters for the M591 command, so put in the correct D, C and P parameters and set S to 0.

Calibration ¶ 

  1. Make sure you have calibrated your extruder steps/mm correctly
  2. If you haven't done so already, send the M591 command with the correct D, P and C parameters and S=0 to tell the firmware about the sensor.
  3. Run M591 D# where # is the extruder number and check that the sensor angle is reported, to confirm that communication from the filament monitor to the Duet is working.
  4. Start a print.
  5. During and after the print, as soon as sufficient filament has been extruded you can use M591 D# (where # is the extruder number) to report the minimum and maximum measured movement as a percentage of commanded movement.
  6. If you pause and then resume the print, on resuming the calibration will be re-started and the values accumulated from before you paused will be discarded.
  7. Set the R (tolerance) parameter of the M591 command to give a somewhat wider tolerance than the calibration reports. For example, if calibration reports 73 to 115% then you might choose R60:130.

Hardware ¶ 

The filament monitor consists of a PCB which carries a laser optical sensor, a 2-part printed housing, and short PTFE inlet and outlet tubes to guide the filament

3d printable parts ¶ 

Block Image

The Laser Filament Monitor uses two printed parts to constrain the filament so that it passes over the centre of the the optical sensor at the correct height. Inlet and outlet PTFE tubes are clamped between these two parts. They must be printed in black filament.

The OpenSCAD source file and STL for these parts is available on Thingiverse at

Base plate / Filament Block

This part fits on top of the PCB.

Top plate / Sensor Block

This fits on top of the base plate, The PTFE inlet and outlet tubes are clamped between the two plates.

Block Image

Other parts ¶ 

M3x16 screw2Use longer screws if you wish to secure the filament monitor to something else
M3 nut2Use Nyloc nuts or thread lock for security
M3 nylon washers2Optional
4mm OD x 1.8mm ID PTFE tubing2 piecesPreferably Capricorn or similar quality. One length is for the filament inlet and need only be a few cm long, but can be longer if you need to guide the filament from the spool. The other is for the filament outlet and must be long enough to reach the extruder drive, but short enough for the filament monitor to sense retraction accurately.

Assembly ¶ 

  1. Remove any stringing in the rectangular aperture in the top plate.
  2. Put the two screws through the top of the top plate. Turn the top plate with screws in it upside down so that the grooves for the PTFE tube are uppermost. Lay the base plate on top, with the grooves on the underside and the PCB cutout on top. Place the PCB over the screws, with the connectors uppermost, so that the PCB fits in the cutout for it. Add the optional washers and nuts and secure them loosely.
  3. Insert the two pieces of PTFE tubing into the two holes formed by the grooves in the two plates. They must not protrude at all into the rectangular opening. Tighten the nuts to secure them in place.
Block Image

PCB Dimensions ¶ 

The version 1.7 PCBs have the following dimensions, showing the key component locations:

Block Image

Adapting for 2.85mm filament ¶ 

For 2.85mm filament, we suggest you use 3mm ID PTFE tubing (not 1/8") and adjust the groove sizes in the base and top plates to accommodate the larger tubing. Also increase the thickness of the base plate by 0.6mm to keep the distance between the optical sensor and the outside of the filament the same.

Experimentation ¶ 

The laser sensor is showing different performance based on the type of filament being used, and potentially some other variable such as the material the housing is printed from and ambient IR. See this forum thread for some initial testing:

Other than determining which filaments work well and which ones work less well, areas for experimentation to determine what improvements can be made relate to housing design. Some of these options have been added to an extended version of the housing design referenced above:

Filament Block ¶ 

Block Image

This part holds the filament guide PTF against the matching part on the sensor. Potential improvements:

  • The laser light that does not reflect off the filament reflects off parts of both blocks so it might work better if printed with something that absorbs IR.
  • Having a divergent light path to reduce stray reflections back to the sensor might help, See the "divergeAmount" variable in the OpenSCAD desing on youmagine:
Block Image

this image shows the divergence exaggerated to show the effect

  • Closing the back of the filament block could prevent ambient IR from interfering with the sensor, alternatively it could increase unwanted reflections. Use the "closedTop" option in the OpenSCAD file to change this. A conical or pyramid-shaped closure might work even better, by containing light from the laser within the closure instead of reflecting it towards the sensor.
Block Image

Sensor Block ¶ 

Block Image

This part holds the filament path guides, along with the filament block. it also holds the sensor PCB. Potential areas for improvement:

  • The laser light that does not reflect off the filament reflects off parts of both blocks so it might work better if printed with something that absorbs IR.
  • Having a divergent light path to reduce stray reflections back to the sensor might help, See the "divergeAmount" variable in the OpenSCAD desing on youmagine. The flight path starts in the sensor block and the ends in the filament block so this variable affects both piece.
  • Changing the distance between the filament and the sensor changes the error level in the reading. Preliminary resting showed that ~9mm worked well for quite a few filaments. It may be that different filaments work better with different distances. To change this use the "filamentHeight" variable in the OpenSCAD file:
Block Image

Troubleshooting ¶ 

If the filament monitor fails to initialise after power up, then instead of flashing the green LED 3 times it will flash the red LED five times to indicate an error. It will continue to try to initialise and flash the red LED until successful initialisation.

Technical details ¶ 

The filament monitor sends 16-bit words to the Duet. Two types of words are transmitted: normal words, and quality information words. When the data is changing (normally because the filament is moving), a normal word is sent every 40ms. When the data isn't changing, alternating quality information words and normal words are sent every 500ms.

For all words transmitted:

  • Bit 14 is 0 for a normal word, 1 for a quality information word.
  • Bit 15 is a parity bit, adjusted so that the total number of bits set in the 16-bit word is even.

For a normal word:

  • If the filament monitor is not in an error state, bits 0-9 represent the movement count, which wraps around from 1024 to zero. Ideally, each count represents 0.02mm of filament movement.
  • If the filament monitor is in an error state, bits 0-9 represent the error code. Currently this is always zero, meaning that initialisation of the optical sensor failed.
  • Bits 10 and 11 are zero
  • Bit 12 is the state of the optional filament present switch: 1 if the input is high (meaning no filament is present) and 0 if it is low.
  • Bit 13 is 1 if the filament monitor is in an error state, 0 otherwise.

For a quality information word:

  • Bits 0-7 report diagnostic data
  • Bits 8-13 return a measure of the reflectivity of the filament and anything else in front of the optical sensor

The 16 bits are sent using a self-clocking protocol as follows. The nominal bit time is 1ms but the Duet firmware allows a reasonable tolerance because the filament monitor clock source is the internal R-C oscillator in the microcontroller, so its speed is somewhat variable.

Idle state: the line must be be at 0 for at least 8 bit times
Start bits: 1 followed by 0
Data bits 15, 14, 13, 12
Stuffing bit (inverse of bit 12)
Data bits 11,10,9,8
Stuffing bit (inverse of bit 8)
Data bits 7,6,5,4
Stuffing bit (inverse of bit 4)
Data bits 3,2,1,0
Stuffing bit (inverse of bit 0)
After the last stuffing bit, the line returns to 0 until the next start bit.


Where can I buy the laser filament sensor, because I can not find it on the page. regards

Demian Cores Mogli - Reply

Please see this forum thread, they are still in beta:

Tony -

I would like to purchase either the laser filament monitor or the rotating magnet monitor, when will they become available?

Kate Leone - Reply

They are still under testing, see:

Tony -

View Statistics:

Past 24 Hours: 8

Past 7 Days: 107

Past 30 Days: 437

All Time: 2,626