Skip to main content

Site Navigation

Your Account

Choose Language

Revisions

Revision 2.0

This uses the PAT 9130 laser sensor and has some minor firmware tweaks to improve the communication protocol and distinguish between the revisions.

The housing is slightly different for this board, although they are the same size. See the housing section below for links to the new housing.

Firmware 2.03beta are 3.0beta are required to use the version 2.0 sensor and report the correct values.

Revision 1.7

This uses the PAT 9125 laser sensor.

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.

Note on filament compatibility

Different filament materials and colours are detected with varying degrees of accuracy by the laser sensor. For most filament types this can be handled through setting an appropriate trigger value for the sensor. The sensor is accurate enough in most tested filaments to allow the print to be paused for filament run-out, jam or tangle, those filament types the sensor is less sensitive to may have 1-2mm of error in movement detection. Depending on where in the print the extruder jam or filament strip occurs will determine how much of an impact 1-2mm of unfed filament will have on the print. The sensor is proving to be inaccurate with certain PETG filament, especially from ESUN (Black tested so far) and is not recommended for this.

Installing the Laser Filament Monitor

Block Image

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.
Block Image
  • The sensor is a Class 1 Laser device. Under normal conditions, the laser beam is always below the IEC/EN 60825-1:2014 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

Caution! Check that the printed part that the sensor PCB will sit in has no blobs or other blemishes that would cause a bending force to be applied to the PCB when the screws are tightened.

It does not matter which end of the filament monitor you use as the filament inlet and which end as the outlet, direction is set as part of configuration and tuning of the monitor.

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 main board (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_LCD 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 micro-switch to the 2-pin "SW" header 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 all versions of the monitor but it can be added if desired. It is a standard a standard Molex KK 2 pin header

Configuring Filament Monitoring

revision 2.0

We recommend you use RepRapFirmware 2.03beta1 or later in order to get the correct readings.

revision 1.7

You must be using RepRapFirmware 1.21 or later.

Common configuration to both revisions

The filament monitor is configured using the M591 command, see M591. Here is an example of that command:

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

If you are running RepRapFirmware version 3 then the C parameter takes the pin name instead of the endstop number, for example:

M591 D0 P5 C"e0_stop" R40:120 E3.0 S0  ; Duet3D laser sensor for extruder drive 0, connected to endstop input 3 (E0), tolerance 40 to 120%, 3mm comparison length, disabled

You can also use M591 from the console to retrieve the current data:

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 Duex 2 or Duex 5 expansion boards cannot be used. Endstop inputs 10-11 on the CONN_LCD connector can be used. In RRF3 the pin name is used instead of the endstop number, e.g. "x_stop", "y_stop" and so on.
  • 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 43% to 115% then you might choose R30:130.
  8. It is worth testing with a wide variety of filaments that you typically use before setting the minimum and maximum trigger values as the laser sensor is sensitive to filament material. Alternatively you can use a different bracket of minimum and maximum for different filament types by setting the M591 setting within the print start gcode, through a macro or through the filament management system.

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.

Revision 2.0

OpenSCAD source and STLs from DC42's reference housing design can be found here:

https://github.com/T3P3/FilamentMonitors...

Revision 1.7

The OpenSCAD source file and STL for these parts is available on Thingiverse at https://www.thingiverse.com/thing:274634....

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

ComponentQuantityNotes
M3x25 screw2The screw length depends on the housing design, also 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

Both revisions have the same Laser sensor position, PCB dimensions and mounting holes. Some of the components are in different locations which can affect the housing which is why there are two different housing desings.

Revision 2.0

Block Image

Revision 1.7

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, see the "housing variations" sections for more information on adjusting the housing.

Housing variations

The laser sensor shows different performance based on the type of filament being used, and potentially some other variables such as the material the housing is printed from and ambient infrared light. See this forum thread for examples from testing:

https://forum.duet3d.com/topic/6092/lase...

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:

https://www.youmagine.com/designs/duet3d...

Filament Block

Block Image

This part holds the filament guide PTFE tubing 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 radiation of ~850nm
  • 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 design 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

Indirect reading

Some people have had success using the laser filament monitor to read a bearing or steel ball which the filament is turning. For example:

https://forum.duet3d.com/topic/10042/ind...

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

Communications Protocol

The filament monitor sends 16-bit words to the Duet. When the filament position is changing, a filament position word is sent every 40ms. When the data isn't changing, alternating filament position words and status words are sent every 500ms.

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.

The meanings of the 16-bit words is as follows. P is the parity bit, adjusted so that the total number of set bits in the word is even,

Word typeFormatNotes
v1 Data wordP00S 00pp pppp ppppS = switch open, pppppppppp = 10-bit filament position (50 counts/mm)
v2 Data wordP00S 1ppp pppp ppppS = switch open, ppppppppppp = 11-bit filament position (100 counts/mm)
v1 Error wordP010 0000 0000 0000
v2 Error wordP010 0000 0000 eeeeeeee = error code, will not be zero
v1 Quality wordP10s ssss bbbb bbbbsssss = shutter, bbbbbbbb = brightness
v2 Version wordP110 0000 vvvv vvvvvvvvvvvv = sensor/firmware version, at least 2
v2 Image quality worP110 0001 qqqq qqqqqqqqqqqq = image quality
v2 Brightness wordP110 0010 bbbb bbbbbbbbbbbb = brightness
v2 Shutter wordP110 0011 ssss ssssssssssss = shutter

Open Source

The hardware source files are on Github here:

https://github.com/T3P3/FilamentMonitors...

13 Comments

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:

https://forum.duet3d.com/topic/3358/lase...

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:

https://forum.duet3d.com/topic/3358/lase...

Tony -

I have posted an updated geometry for the housing on my mini factory. This geometry allows you to install the sensor inline on a Bowden Tube printer without the tubing pulling out. It also allows you to break apart the tube so that you can access the filament once it has been fed past the hob gear and can’t be accessed upstream of the extruder.

https://www.myminifactory.com/object/3d-...

Design Prototype Test - Reply

Can I get involved in the testing, or can I buy it?

Jaime Shapiro - Reply

Great product!!! Is this laser sensor able to measure filament diameter? I would like to use it in a filament maker machine to measure variance around 1.75mm filament. Is it possible to do that with this product?

M Magnus - Reply

If I see it right, due the protocoll and timings there is a limitation on filament speed of approx. 250mm/s… Im not very expirienced in 3d printing, correct me if I’m wrong, but it looks to me like a bit too low for some setups with fast retractions.

Is there further limitation from the sensor side? What is the sensor hardware is capable of?

BR

Jaroslav

Jaroslav German - Reply

They way I see it is a follows:

Each word can represent up to 1024 x 0.02 mm = 20.48 mm of travel

A word is sent every 40 ms or 25 times a second so

25 x 20.48mm = 512 mm/sec

That is much faster than the retraction speed.

Richard Boesch -

Each word can represent 1024 counts, but any value greater then 512 is considered to be a result of an uderflow (negativ value as result of retraction). The actuall range is: -250mm/s to +250mm/s

I agree, it is probably still far away from the retraction speed most people use, but not totally unrealistic.

Jaroslav German -

It would be really nice if there was less of the “may” “might” etc in this article as regards reflections, filament height and design. After all your design and testing surely you could be a bit more specific? It would also help if the author actually specified WHAT TYPES OF FILAMENT would absorb 850 nm wavelengths - I have seen a lot of spec sheets for filament and I have NEVER seen IR absorbance listed as a parameter! As 850 nm is a non visible wavelength colour is actually not much of a guide as dark blue might actually be better than black for example.

A big problem with this company is they are highly knowledgeable engineers, enthusiasts and hobbyists and forget that many people are not and just want to be able to buy something, plug it in and have it work without lots of redesigns and tweaking.

Richard Boesch - Reply

Hi Richard

Fair comments, the issue is exactly as you say. IR reflection is not listed for filaments. We only have what tests we, and our very helpful community have done. Generally ABSs tend to work well. PLAs work well to acceptable and PETGs work poorly with a few exceptions like e3d edge that is just about acceptable. There are so many variations in filament additives, let alone plastic types that it would require a dedicated team to test and qualify all of them.

Cheers

Tony

Tony -

As a suggestion - any filament with additives like wood, stone or (what I am going to use) carbon fiber would DEFINITELY block incoming IR and as they will have a rougher surface should help to eliminate reflections. A small square of black paper above the sensor would also probably help with reflected light.

Richard Boesch - Reply

Add Comment

View Statistics:

Past 24 Hours: 19

Past 7 Days: 170

Past 30 Days: 840

All Time: 13,572