The Filament Monitor is currently in beta testing, see the Duet3d forum for more information
Using the Filament monitor ¶
Connecting to the Duet ¶
Connect the filament monitor to an endstop connection on the Duet mainboard (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 main Duet board. It does not work connected to an endstop on a Duex expansion board.)
The filament monitor will flash green and red LEDs together 3 times to indicate the magnet is detected. The red 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 ¶
The filament monitor is configured using the M591 command. Here are some examples of that command:
M591 D0 P3 S23.5 C3 R50 E3.0 ; Duet3d sensor for extruder drive 0 is connected to endstop input 3 (E0), 23.5mm/rev, 50% error detection tolerance, 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. P3 = Duet3D filament monitor without additional filament presence detection switch, P4 = Duet3D filament monitor with switch.
- Snnn = mm of filament fed per complete rotation of the sensor wheel. May be positive or negative.
- 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.
- R = relative tolerance in %, default 20%
- E = minimum extrusion length before a commanded/measured comparison is done, default 3mm
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 use defaults for the rest.
- 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.
- 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.
- Send M591 D# R-1 where # is the extruder number. The negative R parameter puts the firmware in calibration mode.
- 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, 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 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.
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 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. The angle is reported to the Duet (see section on technical details for how this is done). This diagram shows the general principle.
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:
Hardware Assembly ¶
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.
PCB Dimensions ¶
The beta PCBs have the following dimensions, showing the key component locations:
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.
Technical details ¶
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.