Question about M591



  • Hi,

    I've got two printers - one running firmware 3.1.1 and the other 3.2.0 - both with Duet 2 WiFi/Duex 5 combos.

    I just installed a simple micro switch based filament sensor on both printers.

    I added this to both config.g files M591 D0 P2 C"e1stop" S1

    There is an LED on the sensor which indicates when filament is missing - it is working.

    I can see the e1stop LED on the Duet 2 WiFi changing state tracking the state of the sensor as I insert/remove a piece of filament.

    The documentation says monitoring is only done when printing.

    Executing M591 D0 from the DWC console doesn't seem to report the correct state.

    On the 3.1.1 it reports filament present, on 3.2.0 it reports filament missing - even though the e1stop LED on both boards is on.

    Does that mean I have to print something just to check if the sensors are working?

    Thanks.

    Frederick


  • administrators

    M591 D0 should report the correct state always.

    Please provide the datasheet for the sensor (if it has an LED then it is not just a microswitch). Does the e1stop LED light up when filament is present, or when it is absent?



  • @dc42 said in Question about M591:

    M591 D0 should report the correct state always.

    Please provide the datasheet for the sensor (if it has an LED then it is not just a microswitch). Does the e1stop LED light up when filament is present, or when it is absent?

    The e1stop LED either matches the LED on the sensor or is the "inverse" of the LED on the sensor depending on the type (1 or 2) specified in M591.

    Inserting/Removing a piece of filament into/from the sensor changed the state of the LED on the sensor and the e1stop LED also changed.

    The reported state using M591 D0 never changed.

    I will do the tests again just to be sure.

    Thanks.

    Frederick


  • administrators

    @fcwilt said in Question about M591:

    The e1stop LED either matches the LED on the sensor or is the "inverse" of the LED on the sensor depending on the type (1 or 2) specified in M591.

    Are you sure? That seems very unlikely to me.



  • @dc42 said in Question about M591:

    M591 D0 should report the correct state always.

    It looks like the sensor is acting strangely.

    I powered on the printer with filament in place.

    I ran M591 D0 and it reported that filament present.

    I removed the piece of filament.

    I ran M591 D0 and it reported that filament missing.

    I inserted the piece of filament.

    I ran M591 D0 and it reported that filament missing.


    Let me get my scope out and check the actual signal - I will let you know.

    Thanks.

    Frederick


  • administrators

    One possibility is that the filament sensor is not pulling the input line low enough to register consistently as low in the firmware, but is pulling it low enough to light the endstop LED at least partially. That would be unusual for a microswitch-based sensor, but not unusual for an optical sensor that was designed originally to be used with a 5V supply.



  • @dc42 said in Question about M591:

    One possibility is that the filament sensor is not pulling the input line low enough to register consistently as low in the firmware, but is pulling it low enough to light the endstop LED at least partially. That would be unusual for a microswitch-based sensor, but not unusual for an optical sensor that was designed originally to be used with a 5V supply.

    Thanks for the feedback.

    The problem is the design or perhaps the assembly of the device.

    The device only has three connections: power_in, signal_out and ground

    When the filament is missing the micro switch connects power_in to signal_out.

    When the filament is present that connection is broken and signal_out is pulled to ground with a 4.7 K resistor.

    The value is too large to pull the e1stop input to a valid logic low.

    It should be easy enough to open the unit and add a resistor of suitable value, from signal_out to ground, to obtain a valid logic low.

    I did some searching but could not find what voltage constitutes a valid logic low. Do you know?

    Thanks again.

    Frederick


  • administrators

    Maximum input low voltage is about 1V. Try adding an external 1K pulldown resistor.



  • @dc42 said in Question about M591:

    Maximum input low voltage is about 1V. Try adding an external 1K pulldown resistor.

    I miss the days when my eyesight was better and my hands were steadier.

    I finally got a 680 ohm 1/8 watt soldered into place and the logic low level looks good.

    M591 D0 is now reporting correctly and consistently.

    All the other SMD resistors were 470 ohm - only the pull down was 4.7 K ohm - I wonder if the assembler just made a mistake. The printing on those parts is tiny.

    Thanks again for your help.

    Frederick


  • administrators

    @fcwilt said in Question about M591:

    I miss the days when my eyesight was better and my hands were steadier.

    I use 3.5 diopter reading glasses when soldering.


Log in to reply