Site Navigation

Your Account

Choose Language

Duet3d Filament Monitor: Laser Version

The Duet3D filament monitors sense filament movement and so can indicate that filament has run out, jammed or has been ground away in the extruder. This version uses a laser sensor to detect movement. There is also a version using a rotating magnet under development

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 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.

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.

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.

Configuring Filament Monitoring ¶ 

You must be using RepRapFirmware 1.21RC0 or later.

The filament monitor is configured using the M591 command, see [[G-code#M591:_Configure_filament_sensing| 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.
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. If you haven't done so already, send the M591 command with the correct D, P and C parameters to tell the firmware about the sensor.
  2. 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.
  3. Send M591 D# R-1 where # is the extruder number. The negative R parameter puts the firmware in calibration mode.
  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 measured mm/rev averaged over the print, and its variation.
  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. The calibration factor goes into the S parameter of the M591 command. Use a positive or negative sign as reported by M591. Set the R (tolerance) parameter to somewhat more than the reported variation.

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 ¶ 

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 https://www.thingiverse.com/thing:274634....

Base plate

This part fits on top of the PCB.

Top plate

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

Other parts ¶ 

ComponentQuantityNotes
M3x16 screw2Use longer screws if you wish to secure the filament monitor to something else
2
M3 nut2Use Nyloc nuts or thread lock for security
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. 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

TODO - image

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 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.

TODO - image

PCB Dimensions ¶ 

The beta 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.

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.

0 Comments

Add Comment

View Statistics:

Past 24 Hours: 16

Past 7 Days: 110

Past 30 Days: 510

All Time: 1,137