Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Filament monitor using HC-020K encoder

    Scheduled Pinned Locked Moved
    Filament Monitor
    5
    51
    7.8k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • pabomanundefined
      paboman
      last edited by

      Upgraded to:
      1.21RC5+ (2018-03-17 build 2)

      I have changed my settings in config.g to:

      [c]; Filament Monitor HC-020K
      M591 D0 P7 S23.5 C3 R50 E3.0 ; Duet3d sensor for extruder drive 0 is connected to endstop input 3 (E0), S=23.5mm/rev, R=50% error detection tolerance, C=3mm comparison length

      M591 D0 ; display filament sensor parameters for extruder drive 0[/c]

      Still getting [c]Extruder 0 reports too little movement[/c]

      the strange thing is that The S parameters is set to 23.5 while after M591 D0 I get :
      [c]M591 D0
      Pulse-type filament monitor on endstop input 3, enabled, sensitivity 28.80mm/pulse, allowed movement 50% to 160%, check every 3.0mm, current position 0.0, no calibration data[/c]
      the S parameter is 28.8 instead of 23.5

      I will be more than happy to send you one HC-020K encoder, just send me the adress to info@3dbnz.com and on Monday UPS will collect the parcel.

      in the mean time, thank you

      1 Reply Last reply Reply Quote 0
      • pabomanundefined
        paboman
        last edited by

        setting the sensitivity very low to 0.2 makes the print goes thru
        then issuing M591 D0
        I get [c]Pulse-type filament monitor on endstop input 3, disabled, sensitivity 28.80mm/pulse, allowed movement 20% to 160%, check every 3.0mm, current position 0.0, measured sensitivity 160.73mm/pulse, measured minimum 0%, maximum 2877% over 63648.7mm [/c]
        so i set S value to 160 but then i get again:
        [c]Extruder 0 reports too little movement[/c]
        and the printer go to pause

        PS
        while the S is 0.2 there is no difference if I remove the sensor from the wheel, the print does not go to pause

        Why M591 D0 is telling me [c]disabled[/c] ?

        1 Reply Last reply Reply Quote 0
        • dc42undefined
          dc42 administrators
          last edited by

          As I said, I brought the parameters into line with the other filament monitors. So S now enables or disables filament monitoring, and L sets the sensitivity. See https://duet3d.dozuki.com/Wiki/Gcode#Section_M591_Configure_filament_sensing.

          You will probably need to increase the E parameter.

          160mm/pulse sounds far too high. Can you measure it?

          Duet WiFi hardware designer and firmware engineer
          Please do not ask me for Duet support via PM or email, use the forum
          http://www.escher3d.com, https://miscsolutions.wordpress.com

          1 Reply Last reply Reply Quote 0
          • pabomanundefined
            paboman
            last edited by

            what P parameter should I use?
            still P7 for pulse-generating sensor or P3 for rotating magnet sensor ?

            One complete rotation of the wheel is 20 pulses
            Encoder wheel diameter is 26mm
            E0 stepes per mm is 1166 ( 13to1 gearbox ratio)

            1 Reply Last reply Reply Quote 0
            • dc42undefined
              dc42 administrators
              last edited by

              Strill P7.

              Are you saying that 26mm filament movement give 20 pulses? If so that's 1.3mm per pulse.

              I've put a new firmware binary with more sensible default values at https://www.dropbox.com/s/iq9pzfaugyfei7x/Duet2CombinedFirmware.bin?dl=0.

              Duet WiFi hardware designer and firmware engineer
              Please do not ask me for Duet support via PM or email, use the forum
              http://www.escher3d.com, https://miscsolutions.wordpress.com

              1 Reply Last reply Reply Quote 0
              • pabomanundefined
                paboman
                last edited by

                Diameter of the encoder wheel is 26mm so the circumference is 26 x 3.1416 = 81.7 mm
                So 81.7mm of extruded filament is one full turn of the encoder wheel which gives 20 pulses
                81.7 / 20 = 4
                if so 4mm per pulse

                upgraded to: 1.21RC5+ (2018-03-18 build 1)

                with this config.g:
                [c]; Filament Monitor HC-020K
                M591 D0 P7 C3 S0 R70:130 L4.1 E50 ; D= sensor for extruder drive 0, C= E0 endstop input, P=Sensor type, S1= Enable, R=70% to 130% tolerance, L= mm/pulse, E= detection length
                M591 D0 ; display filament sensor parameters for extruder drive 0[/c]

                i get this response:
                [c]10:16:26M591 D0
                Pulse-type filament monitor on endstop input 3, disabled, sensitivity 4.10mm/pulse, allowed movement 70% to 130%, check every 50.0mm, current position 0.0, measured sensitivity 12778.21mm/pulse, measured minimum 0%, maximum 33% over 1763392.6mm
                10:14:15M591 D0
                Pulse-type filament monitor on endstop input 3, disabled, sensitivity 4.10mm/pulse, allowed movement 70% to 130%, check every 50.0mm, current position 0.0, measured sensitivity 12296.81mm/pulse, measured minimum 0%, maximum 25% over 479575.5mm[/c]

                If I enable the monitor with S1 i get "Extruder 0 reports too little movement":
                [c]10:18:18Printing paused
                10:18:17Resume-after-power-fail state saved
                10:18:16M591 D0
                Pulse-type filament monitor on endstop input 3, enabled, sensitivity 4.10mm/pulse, allowed movement 70% to 130%, check every 50.0mm, current position 0.0, measured sensitivity 25.00mm/pulse, measured minimum 16%, maximum 16% over 50.0mm[/c]

                The strange thing is the measured sensitivity of 12778.21mm/pulse while monitor is disabled

                1 Reply Last reply Reply Quote 0
                • dc42undefined
                  dc42 administrators
                  last edited by

                  So the filament runs on the outside of the 26mm diameter encoder wheel?

                  The measured sensitivity is clearly absurd, as is the recorded extrusion amount (1.76km in the first report). I'll take another look at the code.

                  Duet WiFi hardware designer and firmware engineer
                  Please do not ask me for Duet support via PM or email, use the forum
                  http://www.escher3d.com, https://miscsolutions.wordpress.com

                  1 Reply Last reply Reply Quote 0
                  • pabomanundefined
                    paboman
                    last edited by

                    yes, the filament runs on the outside diameter of the 26mm encoder wheel for now. later I will change that to a smaller diameter

                    1 Reply Last reply Reply Quote 0
                    • dc42undefined
                      dc42 administrators
                      last edited by

                      I found a likely explanation for the absurd values. Please pick up a new binary from https://www.dropbox.com/s/iq9pzfaugyfei7x/Duet2CombinedFirmware.bin?dl=0.

                      Duet WiFi hardware designer and firmware engineer
                      Please do not ask me for Duet support via PM or email, use the forum
                      http://www.escher3d.com, https://miscsolutions.wordpress.com

                      1 Reply Last reply Reply Quote 0
                      • pabomanundefined
                        paboman
                        last edited by

                        ok, upgraded the firmware, now im getting "Extruder 0 reports too much movement" 🙂
                        also reducing the E Value from 50 to 10 gives the same result
                        [c]11:18:53M591 D0
                        Pulse-type filament monitor on endstop input 3, enabled, sensitivity 4.10mm/pulse, allowed movement 70% to 130%, check every 10.0mm, current position 0.0, measured sensitivity 0.66mm/pulse, measured minimum 439%, maximum 801% over 22.5mm[/c]

                        1 Reply Last reply Reply Quote 0
                        • dc42undefined
                          dc42 administrators
                          last edited by

                          Are you certain that he pulse rate of your encoder is 4.10mm of filament per pulse? What happens if you set it to 0.66mm as reported by the calibration?

                          I'll have the calibration value reported to 3 decimal places in the next build.

                          Duet WiFi hardware designer and firmware engineer
                          Please do not ask me for Duet support via PM or email, use the forum
                          http://www.escher3d.com, https://miscsolutions.wordpress.com

                          1 Reply Last reply Reply Quote 0
                          • pabomanundefined
                            paboman
                            last edited by

                            Correct me if I am wrong, the 4.1mm per pulse is given by this calculation:
                            Diameter of the encoder wheel is 26mm so the circumference is 26 x 3.1416 = 81.7 mm
                            So 81.7mm of extruded filament is one full turn of the encoder wheel which gives 20 pulses (the wheel have 20 slots thru light can pass)
                            81.7 / 20 = 4.085
                            I rounded it to 4.1

                            As you said with L= 0.66 I get "Extruder 0 reports too much movement"
                            [c]
                            Pulse-type filament monitor on endstop input 3, enabled, sensitivity 0.66mm/pulse, allowed movement 70% to 130%, check every 10.0mm, current position 0.0, measured sensitivity 0.59mm/pulse, measured minimum 60%, maximum 168% over 21.3mm[/c]

                            so I changed L= 0.59 but I get "Extruder 0 reports too little movement"

                            [c]
                            Pulse-type filament monitor on endstop input 3, enabled, sensitivity 0.59mm/pulse, allowed movement 70% to 130%, check every 10.0mm, current position 0.0, measured sensitivity 0.80mm/pulse, measured minimum 39%, maximum 111% over 42.6mm[/c]

                            then I changed L= 0.80 but I get "Extruder 0 reports too much movement"

                            [c]Pulse-type filament monitor on endstop input 3, enabled, sensitivity 0.80mm/pulse, allowed movement 70% to 130%, check every 10.0mm, current position 0.0, measured sensitivity 0.94mm/pulse, measured minimum 83%, maximum 86% over 20.7mm
                            [/c]

                            1 Reply Last reply Reply Quote 0
                            • dc42undefined
                              dc42 administrators
                              last edited by

                              Can you post a photo of how you are using that encoder to measure filament movement?

                              The calibration data indicates that there is quite a large variation in the amount of extrusion commander per revolution of the wheel. One possible reason for that may be that when filament is retracted, it doesn't force the wheel to rotate backwards because you haven't constrained the filament path sufficiently; so that when forward extrusion is commanded after a retraction, initially the wheel doesn't rotate because there is slack filament to take up.

                              Unless you can make it more reproducible, you will need to increase the allowed tolerance. For example, when you had the sensitivity set to 0.66 it reported:

                              measured minimum 60%, maximum 168%

                              which means that in order to avoid spurious alarms you would need to use R60:168 or wider, not the R70:130 that you are currently using.

                              Duet WiFi hardware designer and firmware engineer
                              Please do not ask me for Duet support via PM or email, use the forum
                              http://www.escher3d.com, https://miscsolutions.wordpress.com

                              1 Reply Last reply Reply Quote 0
                              • pabomanundefined
                                paboman
                                last edited by

                                In the youtube link you can see my test setup: https://youtu.be/0md1yE183kc

                                The encoder wheel is directly connected to the stepper shaft, that way the encoder is reading the real revolution of the extruder and no slippage may occur as no filament is being pulled.
                                This setup is simulating the filament being pulled by the extruder gear and consequently rotating the encoder wheel with a perfect ratio of 1:1. This way im taking out of the equation any filament slippage, dont you think so?
                                Secondly the Gcode I am running is without retraction.

                                1 Reply Last reply Reply Quote 0
                                • dc42undefined
                                  dc42 administrators
                                  last edited by

                                  I suspect that you are not getting clean edges from that sensor because of a fundamental flaw in its design. This would also account for the average mm/pulse being lower than you expect. See https://androminarobot.blogspot.co.uk/2016/04/tutorial-sobre-el-encoder-fotoelectrico.html. That design needs a resistor added between pins 1 and 3 of the LM393 to make it stable. A value of 47K should be about right.

                                  Duet WiFi hardware designer and firmware engineer
                                  Please do not ask me for Duet support via PM or email, use the forum
                                  http://www.escher3d.com, https://miscsolutions.wordpress.com

                                  1 Reply Last reply Reply Quote 0
                                  • pabomanundefined
                                    paboman
                                    last edited by

                                    ok, I can try ! 🙂

                                    two questions:
                                    1. right now I have 15k resistors, can I add 3 in series to have 45k ?
                                    2. Is Pin 1 of LM393 marked with a circle near the corner ?

                                    1 Reply Last reply Reply Quote 0
                                    • pabomanundefined
                                      paboman
                                      last edited by

                                      EUREKA!
                                      adding 45k (15x3) resistor between pin 1 and 3 of LM393 solved the issue

                                      [c]Pulse-type filament monitor on endstop input 3, enabled, sensitivity 1.89mm/pulse, allowed movement 70% to 130%, check every 10.0mm, current position 0.0, measured sensitivity 1.88mm/pulse, measured minimum 100%, maximum 101% over 373.1mm
                                      [/c]

                                      holding the extruder wheel from turning trigger the pause as it should

                                      now the last question is: why the sensitivity calculated is 1.89 instead of the 4.1 that mathematical model gives us ?

                                      thank you David!

                                      1 Reply Last reply Reply Quote 0
                                      • dc42undefined
                                        dc42 administrators
                                        last edited by

                                        Perhaps your extruder steps/mm is wrong? Please explain how you arrived at 1166. From your video, I think you don't have an extruder connected to the extruder drive yet, only the encoder wheel - is that correct?

                                        I guess it's also possible that you are still getting more than one edge at each transition. If that's the case, reducing the value of the resistor will help, for example try 15K. If you make the value too low then it won't produce any pulses at all. However, as your variation during calibrarion seems to be very low now, that's probably not the cause.

                                        Duet WiFi hardware designer and firmware engineer
                                        Please do not ask me for Duet support via PM or email, use the forum
                                        http://www.escher3d.com, https://miscsolutions.wordpress.com

                                        1 Reply Last reply Reply Quote 0
                                        • pabomanundefined
                                          paboman
                                          last edited by

                                          The motor have 200 full steps per revolution (1.8 deg per full step)
                                          The gear ratio is 1:13.76 so the number of full step per revolution is 13.76 x 200=2752 full steps
                                          The hobbed gear diameter is 12mm so the Circumference is 3.14 x 12=37.68mm
                                          with full step than the steps/mm is 2752/37.68=73.03 step/mm
                                          Driver works at 1/16 step so 16x73.03=1168 steps/mm

                                          The extruder motor is connected to E0 but instead of the hobbed gear i mounted the encoder wheel (only for testing)

                                          1 Reply Last reply Reply Quote 0
                                          • dc42undefined
                                            dc42 administrators
                                            last edited by

                                            So instead of a 12mm diameter hobbed gear you have a 26mm extruder wheel. So the amount of extruded filament will be 12/26 of the amount you have assumed in the encoder wheel calculations. (12/26) * 4.1 = 1.89.

                                            Duet WiFi hardware designer and firmware engineer
                                            Please do not ask me for Duet support via PM or email, use the forum
                                            http://www.escher3d.com, https://miscsolutions.wordpress.com

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA