Mag Filament sensor - config clarification.

  • Received a nice new magnetic filament sensor and upon reading the instruction for RRF 3 it shows the definition as

    M591 D0 P3 C3 S1 R70:130 L24.8 E3.0

    which I have changed to

    M591 D0 P4 C"" S1 R70:130 L24.8 E3.0

    I substituted P3 for P4 (3=Duet3D rotating magnet sensor, 4=Duet3D rotating magnet sensor with microswitch) on the grounds that my sensor has two pins labelled 'SW' and there are no options to specify 'optional switch' ... therefore I assume it contains a switch of some sort, though I can't see any evidence for it other than the pins. I've left the other stuff defaulted for now.

    Is this correct or is there no such thing as a mag filament sensor with switch (in which case why the pins) - except mine clearly has a switch making the documentated example for setting up the sensor incorrect.

  • Moderator

    @Garfield No, leave it as P3 if you are not connecting a microswitch to the pins. This is for a filament-out switch, which you can add at any other time, using any microswitch and housing that you like.


  • So this is to add a local 'microswitch' of some sort then. Sensor clicks like it has a switch when I push filament in but clearly doesn't have one.

    I think an explanation of how this is intended to be used would help. Is the sensor a 'smart' device that will report the SW connection shorted ? - (I don't think that it is) - in which case why would documentation state to connect it to a pin on the Duet - makes no sense to connect SW to anything if your connecting to the Duet.

    Perhaps I'm missing something ....

  • Moderator

    @Garfield You connect SW to a microswitch. The microswitch sits in contact with the filament, usually in a housing. When configured with P4, the magnetic filament sensor reports extra information on the state of the microswitch, eg if filament is present, like it does when the filament sensor is just a simple switch. You place the microswitch filament sensor before the magnetic sensor, so it can detect filament out before it runs out in the sensor.

    No, the SW pins do not connect to the Duet. I guess you're looking at In the pictures, it does say "Switch: optional connection for switch trigger". I believe, like the simple switch filament sensor, it will call pause.g if it detects filament has run out.


  • Moderator

    @Garfield said in Mag Filament sensor - config clarification.:

    Sensor clicks like it has a switch when I push filament in but clearly doesn't have one.

    I think that's just the spring/idler mechanism of the sensor moving.

    I'll add an explanation to the documentation, once I have one set up to check how it works!


  • @droftarts said in Mag Filament sensor - config clarification.:

    Switch: optional connection for switch trigger

    I get that much but I don't see how the filament sensor then provides the information.

    And what is the point of 'C' as in C"" if you're not connecting physically to ??

  • Moderator

    @Garfield As far as I'm aware, the state of the switch is included in the messages sent by the magnetic filament sensor to the Duet. You can try it if you like; set it up as P3, send M591 D0 to poll the sensor, then set it up as P4, poll it again, then short the two pins and poll it again. Post the response, and I'll add it to the documentation.

    With no sensor attached, the best I get is:

    05/02/2020, 16:47:48 	M591 D0
    Duet3D rotating magnet filament monitor v1 on pin e0stop, enabled, sensitivity 24.80mm/rev, allow 70% to 130%, check every 3.0mm, no data received
    05/02/2020, 16:47:42 	M591 D0 P3 C"e0stop" S1 R70:130 L24.8 E3.0
    05/02/2020, 16:47:16 	M591 D0
    Duet3D rotating magnet filament monitor v1 with switch on pin e0stop, enabled, sensitivity 24.80mm/rev, allow 70% to 130%, check every 3.0mm, no data received
    05/02/2020, 16:47:03 	M591 D0 P4 C"e0stop" S1 R70:130 L24.8 E3.0

    So it does recognise the extra microswitch with P4.


  • Guess I need to experiment - if you connect the switch to the filament sensor I don't see the point wasting an input on the Duet itself - better to use something virtual if absolutely necessary but not consuming physical IO that you don't physically connect to - that's just plain nuts.

  • Moderator

    @Garfield I don't understand what you are concerned about! You connect the filament runout microswitch (eg something like if you're unfamiliar with the concept) to the SW pins on the magnetic filament sensor. The magnetic filament sensor sends the microswitch output, along with it's own, to the Duet on the pin it's already connected to. How is that wasting an input?! It's not either/or; you get both on one input.

    You can have a filament runout sensor on its own, without the magnetic filament sensor, but then it won't pick up all the print failure modes that the magnetic filament sensor will. The SW input on the filament sensor just gives you extra choice/information, with no increase in pin usage.


  • So I don't need the 'C' option ..... or is the C actually the pin that it uses for communication and NOT the filament out switch - that's more logical I guess.

    The use of pin names like endswitch don't really describe the purpose that this pin will serve - it isn't as a digital switch or an analog input but a communication channel

  • administrators

    @Garfield said in Mag Filament sensor - config clarification.:

    or is the C actually the pin that it uses for communication

    Yes, it's the pin on the Duet that the filament monitor is connected to.

  • @Garfield @dc42
    Can any of you clarify on the correct wiring for a Duet 3?
    I have mine connected as follows:
    Sensor - Duet
    3.3V to 3.3V
    GND to GND
    OUT to

    According to the dozuki you need to use a cross-over connection, however in my uneducated mind that doesn‘t really makes any sense?
    I tried putting GND to and OUT to GND but got no response from the Sensor as well....

    „No data received“

    M591 D0
    Duet3D rotating magnet filament monitor v1 on pin, enabled, sensitivity 24.80mm/rev, allow 70% to 130%, check every 3.0mm, no data received

    Any advice is greatly appreciated!

  • You don't need any crossover - at least with version 1.7a all is as per your explanation and is exactly how I wired mine. I do agree that the instruction is confusing, the text reads as though prewired cables are in use. I tested mine before committing to crimping connectors.

    This is my definition

    M591 D0 P3 C"" S1 R80:120 L25.49 E3.0

    For a filament run out switch wire it only to the filament sensor, the status is available via the sensor communications connection although I don't use it.

    I think that it is all to do with the way the plugs are reversed on the PCB but since you're wiring it all I don't see that the pin numbers matter - just pay heed to the way around the plug goes and make sure ground goes to ground and so on.

    Watch the LED ... this will let you know if it is talking.

    Note - the no data received only changes during a print ...

  • @Garfield Thanks for the heads up!

    However, despite being wired correctly (according to your wiring...the only one that really makes any sense shrug) its not working.
    The LED on the sensor does NOT light up when extruding filament.
    The print stops after priming with the error message „extruder 0 reports too little movement“ (or something like that)
    I tried io6, io8 and io5.
    My wiring again is as follows:

    Sensor - Duet 3
    PIN OUT to
    PIN 3.3V to 3.3V on io5
    PING GND to GND on io5

    The „no data received“ message on M591 D0 stays the same, always. While idle and while priming.
    I tested my wires, those should be OK. (Give a beep when using a multimeter to test)

    This is my M591 from config.g

    ;Filament sensor
    M591 D0 S1 P3 C"" R70:130 L24.8 E3.0						; Duet3D magnetic filament sensor cross-connected to```

    I‘m out of ideas.```

  • Not sure what I can add except

    Red is 3.3, Blue is Gnd



  • Thats wired the same as my own. However, its not working.
    Sounds like a defective unit to me, tbh.
    @dc42 @droftarts any ideas?

  • Moderator

    @TeddyFluffkins You say the LED does not light when extruding. Does it flash at power up? See
    Usually if it's not flashing, the magnet turning is not being sensed. Check that it has been put together correctly; I've seen other threads about getting low or no readings where the magnet is too far from the sensor.


  • @droftarts thanks for your reply!
    I checked the assembly and could not find any fault. The bearings turn, the hobbed assembly turns, no blockage or anything.
    Shall I attach some pictures of the sensor?
    The LED is NOT flashing at all. Not at start-up. Not in red, nor green.
    ...looking at the picture from the docs the magnet a separate part or is it included in the hobbed assembly part?
    I'll edit the post within the next two hours and re-check the magnet - there was no extra part that registered as a magnet to me, so maybe its gone missing?

  • Moderator

    @TeddyFluffkins if it’s not flashing at all, it’s not getting power. Check the continuity of the wires, and the connections.


  • @droftarts yea well, this is sooo crimp was bad, it got no contact on the pin. The front portion of it was flat instead of round ... idk how else to explain this.
    Its on now, flashing different colors and reporting the angle correctly. Gonna try a print 🙂
    Thanks for the help! Much appreciated.

  • Make the limits (R70:130) pretty wide i.e. R40:160 until you get some sampling done and set the L value appropriately - especially if you're using a Raspberry Pi. My experience is that once it pauses on a filament event that you can't resume - of course I'd be really curious if your system can resume.

Log in to reply