- Using the Filament monitor
- Technical details
- Prototype Hardware
The filament monitor consists of a PCB which senses the rotation of a diametrically magnetised magnet. That magnet is in turn rotated by the filament motion via a hobbed part. The angle is reported to the Duet (see section on technical details for how this is done). This diagram shows the general principle.
Using the Filament monitor
Connecting to the Duet
Connect the filament monitor to an endstop connection on the Duet 2 (normally E0 or E1), using a 3 wire cable with a molex KK on either end.
( Note: The Filament monitor must be connected to an endstop on the Duet 2 Wifi, Duet 2 Ethernet or Duet 2 Maestro. It does not work connected to an endstop on a Duex expansion board.)
The filament monitor will flash the green LED 3 times to indicate the magnet is detected. The green LED will then flash periodically indicating communication to the Duet. If the magnet is rotating the LED will flash more frequently. For other LED flashing codes see the troubleshooting section below
Configuring Filament Monitoring
Important: the production version of the filament monitor requires 2.03 or later firmware running on the Duet.
The filament monitor is configured using the M591 command. Here are some examples of that command:
M591 D0 P3 C3 S1 R70:130 L24.8 E3.0 ; Duet3D rotating magnet sensor for extruder drive 0 is connected to E0 endstop input, enabled, sensitivity 24.8mm.rev, 70% to 130% tolerance, 3mm detection length M591 D0 ; display filament sensor parameters for extruder drive 0
Brief explanation of parameters:
- Dnn Extruder drive number (0, 1, 2...),
- Pnn Type of sensor: 0=none, 1=simple sensor (high signal when filament present), 2=simple sensor (low signal when filament present), 3=Duet3D rotating magnet sensor, 4=Duet3D rotating magnet sensor with microswitch, 5 = Duet3D laser sensor, 6 = Duet3D laser sensor with microswitch, 7 = pulse-generating sensor
- Cnn Which input the filament sensor is connected to. On Duet electronics: 0=X endstop input, 1=Y endstop input, 2=Z endstop input, 3=E0 endstop input etc. If you have a Duex 2 or Duex 5 in your system, note that C5 thru C9 (the endstop inputs on the DueX) cannot be used for filament monitors, but C10 and C11 (the endstop inputs on the CONN_LCD connector) can.
- Sn 0 = disable filament monitoring (default), 1 = enable filament monitoring when printing from SD card. S Filament monitors accumulate calibration data (where applicable) even when filament monitoring is disabled.
- Raa:bb Allow the filament movement reported by the sensor to be between aa% and bb% of the commanded values; if it is outside these values and filament monitoring is enabled, the print will be paused
- Enn minimum extrusion length before a commanded/measured comparison is done, default 3mm
- An (firmware 2.03 and later) 1 = check All extruder motion, 0 = only check extruder motion of printing moves (moves with both movement and forward extrusion)
- Lnn Filament movement per complete rotation of the sense wheel, in mm
Initially you will not know the exact "L" parameter to use so start with 28.4 and use the output of the calibration to tweak this.
- If you haven't done so already, send the M591 command with the correct parameters to tell the firmware about the sensor.
- 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.
- Start a print.
- 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 thus far, and its variation.
- If you pause and then resume the print, calibration will be re-started and the values accumulated from before you paused will be discarded.
- The mm/rev value goes into the L 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.
How it works
- While a file is being printed the Duet Firmware reads the angle from the Filament monitor.
- The Duet firmware uses the parameters configured in M591 to determine the angle change that relates to a specific filament movement distance.
- Once 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 there is a difference between what has been commanded and what has been measured by the filament monitor that is greater than the configured tolerance (configured using the R parameter) the print is paused and an error is reported.
The housing consists of:
- The main part that carries the hobbed assembly, idler, collets and constrains the filament path.
- A lid that mounts the PCB a set distance from the magnet.
Duet3D is supplying resin printed housings.
Note the housing can be 3d printed using an FDM printer using a fairly high resolution (e.g. 0.1 layer height) however some tweaking may be required to get the magnet distance just right.
This consists of a custom machined hobbed part, a bearing and a 6mm diametrically magnetised magnet. Together with the idler this acts to closely couple the movement of the magnet to the movement of the filament.
This consists of a bearing carrier (that can be 3d printed with sufficient accuracy) an idler bearing and a spring.
The filament monitor PCB revision 1.7 can be used to detect the movement of any appropriate diametrically magnetised magnet. It can be used in custom extruder designs, the diagram shows the critical dimensions.
Ensure the bearing in the main housing is seated properly and installer the idler carrier, idler bearing and spring.
Place the hobbed assembly on the bearing and place the lid on top. It is usual for the magnet to cause the lid to lift slightly until the PCB is screwed into place.
Screw the PCB in place as showing. note the two 12mm long M2.5 screws go to the left as show in this image, the single 6mm M2.5 screw goes to the right.
Insert the collets and collet clips. Note that they are not secure in the housing until PTFE tube is inserted.
The monitor can be installed either before or after the extruder. It can mount directly onto the PTFE filament guide or bowden tube, held in place by the collets and collet clips. alternatively there are two M3 holes in the housing to allow it to be screwed onto a flat surface.
Before the Extruder
It is important that the PTFE guide tube does not move during retraction and the filament path is constrained through the monitor so retractions are measured properly.
After the extruder
On systems that use a bowden tube it is also possible to mount the filament monitor after the extruder. In this case filament out will not be detected until the end of the filament is in the extruder. The second two pin header on the PCB is connected a separate filament sensing switch if you want to detect filament out before the extruder, but detect movement after the extruder.
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 to indicate an error. It will continue to try to initialise and flash the red LED until successful initialisation.
The number of flashes of the red LED indicates the nature of the error, as follows:
- 4 flashes: I2C communications error
- 5 flashes: I2C channel is in an incorrect state
- 6 flashes: Magnet not detected. Typically this means that the magnet is too far away from the sensor chip.
The filament monitor sends 16-bit words to the Duet. When the data is changing (normally because the filament is moving), one word is sent every 40ms. When the data isn't changing, one word is sent every 500ms.
Bit 15 of each word is 1 if the filament monitor is in an error state, 0 otherwise. Bit 14 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. However, the beta filament monitor firmware does not implement bits 14 and 15, they are always sent as 0.
Bits 0-9 represent the magnet angle measured in units of 1/1024 of a complete rotation.
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.
PCB Revision 1.7
A redesign with the following changes:
- A custom hobbed part that includes a captive bearing and the magnet swaged on to form a secure a repeatable mounting.
- PCB has been made smaller and adapted for easier mounting.
- 2 part housing that can be printed using an accurate FDM process or SLS/resin printing.
- Idler containing a spring and bearing
Note: the firmware on revision 1.7 is reported by the Duet as version 2.0 for both the magnetic and laser filament monitors
The first version produced in small numbers, see the prototype section below for more details.
This is the original version, only produced in small numbers.
3d printable parts
The design uses 2 3d printable springs, so far good results have been achieved printing these in Ninjaflex but similar flexible filament should also work
The current enclosure design is split into two parts, one part holds the mechanical components that cause the moving filament to rotate the magnet. The second part holds the PCB in line with the magnet.
Different mounts will be required to mount the sensor to different extruders, effectors etc. An example for mounting to a big box Idex is shown in the documentation right now.
The OpenSCAD source file and STLs are available on Youmagine:
The following instructions are for the standard hardware design used for the Beta test programme. Alternative housing designs and potentially ways of coupling filament movement to magnet rotation are possible. Please see the forum thread for further discussion.
1) Assemble the hobb, bearings and magnet:
|M3x16 with magnet fitted||1||Supplied assembled|
|M3 full net||1||Held in place with a drop of superglue/thread lock|
Assemble as shown in the picture, the full nut is held in place with a drop of superglue or threadlock.
2) Assemble the idler bearing and springs:
|M3x16 socket cap screw||1|
|3d printed spring||2|
Assemble as shown in the picture, the 3d printed rubber springs hold the idler bearing in place, no nut is required.
3) Print the housing and mounting parts, gather the remaining parts:
|Idler Assembly||1||previously assembled|
|Hobb Assembly||1||previously assembled|
|Mechanical enclosure||1||3d printed|
4) Fit the idler spring and hobb assembly into the mechanical enclosure.
|Mechanical enclosure||1||previously assembled|
|PCB holder||1||3d printed|
The Idler assembly fits in the larger hole in the mechanical enclosure, this should be fitted first and the 3d printed rubber springs will be tight. The off center springs should be oriented the same way, holding the idler bearing towards the hobb.
Check that the hobbed section and the idler pulley align with the filament hole:
5) Complete the assembly with the PCB, PCB holder, mount, M3 SCS and nylock nuts. Note the magnet should sit approximately 0.5mm above the sensor, the PCB holder hole sizes match
6) Mount as required.
Note different mount designs will be required to fit relative to different extruders. This is an example with it mounted on a BigBox Idex.
The beta PCBs have the following dimensions, showing the key component locations: