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

    Connecting and reading a pulse generating encoder

    Scheduled Pinned Locked Moved
    Firmware wishlist
    7
    35
    2.9k
    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.
    • oc_geekundefined
      oc_geek
      last edited by oc_geek

      I try to ask even if i fear to know the answer already..

      For an Multi-Material-Unit project (in the Voron 3D printer context) we would need the ability to :

      • reset the counts
      • fetch the actual counts

      out of a pulse generating encoder (200 to 500 Hz is the rate)

      Is there any way to do so with Duet fw at present ?
      If so how... 🙂

      (looked at the 1HCL too but it's targeting quadrature encoders..so..no go)

      thanks

      T3P3Tonyundefined dc42undefined 2 Replies Last reply Reply Quote 0
      • pfnundefined
        pfn
        last edited by

        @oc_geek I thought about doing g this with a smart filament sensor.

        For the purpose of loading and changing filaments, I would set the sensor pin to gpio input and reset a global count variable 0. As a load operation runs, the gpio input should run a triggerN.g file, that would increment the global variable by one for each pulse.

        Once the operation is done (checking if the bowden got loaded, or if the extruder was able to feed filament) read the global variable and reset it to 0.

        This should work well for the carrot feeder and avoids having to setup a print head filament sensor (that is setup after the extruder gears, a real pain for non voron printers)

        oc_geekundefined 1 Reply Last reply Reply Quote 0
        • oc_geekundefined
          oc_geek @pfn
          last edited by oc_geek

          @pfn yeah that is indeed for the new CF 1.1 which uses a pulse counter on the unit. In clipper they dev a piton module so macros are gone and the porting to RRF is no more an option

          I like your idea. And yeah i'm in on the global variables (that was my target too) but i miss the way to count the pulses event (at that speed too)

          Could you please elaborate more on the wiring and how would you read (or detect the trigger in that logic) the pulse.
          On the printhead (extruder) there is a (hall sensor) filament sensor which detects the filament reached past the gears but that is something manageable which (i thinnk) is doable
          thanks

          (p.s. Mini 5+ it is in my case)

          pfnundefined 1 Reply Last reply Reply Quote 0
          • T3P3Tonyundefined
            T3P3Tony administrators @oc_geek
            last edited by

            @oc_geek how is it interfaced? What protocol?

            www.duet3d.com

            oc_geekundefined 1 Reply Last reply Reply Quote 0
            • pfnundefined
              pfn @oc_geek
              last edited by

              @oc_geek the output signal pin from the TCRT5000 would go into any of the ioN.in pins

              Configure the pin as appropriate with
              M950 J0 C"ioN.in"
              M581 P0 T0 ...

              Create /sys/trigger0.g and add code in there to do whatever is needed.

              I haven't tried putting together an ercf yet, but it's on my list of things to investigate.

              oc_geekundefined 1 Reply Last reply Reply Quote 1
              • oc_geekundefined
                oc_geek @T3P3Tony
                last edited by oc_geek

                @t3p3tony Hi Tony, thanks for coming by

                I have to confess i'm totally ignorant. I'm just trying to figure out if there is a way for RRF to use the Enraged Rabbit MMU 1.1 (Voron)

                The pulse sensor is a TCRT5000 (IR Infrared)

                TCRT5000 infrared reflective sensor
                Detects the reflected distance: 1mm ~ 25mm Applicable
                The working voltage: 5V
                The output format: digital signal (0 and 1)

                I suppose it just sends digital 0 or 1 (without a specific protocol)

                d69bf68a-6024-47e5-aa71-575a2613cf3e-image.png

                Any advice help is very much appreciated in advance

                46ae3ca1-dea6-4b97-8de2-5c90e26e7a01-image.png

                1 Reply Last reply Reply Quote 0
                • oc_geekundefined
                  oc_geek @pfn
                  last edited by oc_geek

                  @pfn
                  Thanks for the explanation.

                  I realize just now that this is the same "trick" i use for the filament sensor which is on my Mini5+ while i use the 1LC as tool board. Makes sence

                  That way you basically invoke the trigger and add 1 to the counter. Good idea. I hope it can stand the 500 Hz rate though... @T3P3Tony (do you know ?)

                  So couple of macros (count and reset) and we shall be in the game

                  I'm at the same stage of yours atm.
                  I have bought some of the key parts but have not yet printed it.
                  I hope we RRF folks are in the game too 🙂

                  T3P3Tonyundefined pfnundefined 3 Replies Last reply Reply Quote 0
                  • T3P3Tonyundefined
                    T3P3Tony administrators @oc_geek
                    last edited by

                    @oc_geek so this is generating pulses at 500hz? There must be more too it if there is a pulse counter on the unit itself.

                    www.duet3d.com

                    1 Reply Last reply Reply Quote 0
                    • pfnundefined
                      pfn @oc_geek
                      last edited by

                      @oc_geek 500Hz rate? why is it so high? It should only trigger once per unit distance (which shouldn't be much lower than about 1mm per pulse...)

                      1 Reply Last reply Reply Quote 0
                      • T3P3Tonyundefined
                        T3P3Tony administrators @oc_geek
                        last edited by

                        @oc_geek yeah the TCRT5000 is a reflective optical switch or potentially a distance sensor depending on how it was used. is there a rotating element with slots in?

                        www.duet3d.com

                        oc_geekundefined 1 Reply Last reply Reply Quote 0
                        • o_lampeundefined
                          o_lampe
                          last edited by

                          @oc_geek you could use a frequency divider to reduce pulse count/second . They will reduce by 2,4,8 a.s.f. depending on their setting.
                          A small ATtiny or PIC processor can do the trick, too.
                          Then, when Duet gets triggered , add 2,4,8 pulses to the equation instead of 1.

                          In any case make sure, the pulse counting macro is as short as possible. Otherwise you might miss incoming pulses.
                          Write another macro to read the global pulsecounter and go on from there.

                          1 Reply Last reply Reply Quote 1
                          • oc_geekundefined
                            oc_geek @T3P3Tony
                            last edited by

                            @t3p3tony as far as i could see from the Discord ERCF 1.1 discussion it reads a Bondtech gear which rotates with filament
                            Filament running at 20 mm / sec so that's where the 200 - 500 Hz comes from (i'm just reporting what i was told)

                            T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
                            • T3P3Tonyundefined
                              T3P3Tony administrators @oc_geek
                              last edited by

                              @oc_geek so whats the pulses/mm of this sensing arrangement. There is existing code for using a pulse based filament monitor
                              https://duet3d.dozuki.com/Wiki/M591#Section_M591_RepRapFirmware_Num_3

                              Type 7

                              www.duet3d.com

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

                                @oc_geek what's the purpose of measuring the counts? Is it to detect if the mechanism is jammed?

                                With a simple pulse generating encoder, you will not be able to determine in which direction the mechanism is moving. Might that be a problem?

                                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

                                oc_geekundefined 1 Reply Last reply Reply Quote 0
                                • oc_geekundefined
                                  oc_geek @dc42
                                  last edited by oc_geek

                                  @dc42 i understood they use it to determine the filament position (real travel distance) when loading a specific filament in the MMU down to the tool head
                                  With the encoder they say it is possible to meisure with a precision of 1 mm
                                  Direction is derived by other means and hold by other variables

                                  All that said would it be possible to use triggers to follow it up @ e.g. 250 Hz ?

                                  pfnundefined 1 Reply Last reply Reply Quote 0
                                  • oc_geekundefined
                                    oc_geek @T3P3Tony
                                    last edited by

                                    @t3p3tony i saw that but it wont be possible to inquire the position nor to reset it (unless i'm reading it wrong)

                                    1 Reply Last reply Reply Quote 0
                                    • Dan1990undefined
                                      Dan1990
                                      last edited by Dan1990

                                      The Klipper firmware seems to work fine with the ERCF, so perhaps will be valuable to check their code? It wIll gives more understanding towards what oc'geek and many others trying to get. (The voron - duet community is big )

                                      That is the link to the PCB for ERCF:

                                      https://github.com/Tircown/ERCF-easy-brd

                                      Link to the project:

                                      https://github.com/EtteGit/EnragedRabbitProject

                                      oc_geekundefined 1 Reply Last reply Reply Quote 0
                                      • oc_geekundefined
                                        oc_geek @Dan1990
                                        last edited by

                                        @dan1990 rightly said

                                        in particular the part responsible for the Pulse Generating encoder is a Klipper module written in python

                                        1 Reply Last reply Reply Quote 0
                                        • pfnundefined
                                          pfn @oc_geek
                                          last edited by pfn

                                          @oc_geek why would you need 250hz? 1 pulse per mm, feed rates are usually like 10mm/s at most... (browsing that code, it looks like it's set at 1.5mm/pulse and something like 100mm/s feed rate, it's probably reasonable enough?)

                                          oc_geekundefined 1 Reply Last reply Reply Quote 0
                                          • oc_geekundefined
                                            oc_geek @pfn
                                            last edited by oc_geek

                                            @pfn as i wrote this came from the Author of the unit itself... it's not that i need something..

                                            834f357d-1bea-404a-89f1-28ae18572708-image.png

                                            The sensor is used ONLY when loading / unloading the chosen (between nine) filament to the tool to make sure it arrives where intended and does not jam the unit and so on...
                                            I think they do that faster than a print feed rate to reduce the overall print time...(e.g. 1000 filament changes in a print would matter..)

                                            that said i did not got any data point from the Duet team on which rates (Hz) are reachable using a trigger... or any other offered solution...

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