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

    CNC pendant encoder skipping step

    Scheduled Pinned Locked Moved
    CNC
    2
    4
    507
    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.
    • morgoth90undefined
      morgoth90
      last edited by morgoth90

      I was trying the firmware on an Arduino nano: https://github.com/Duet3D/CNC-Pendant-Firmware/tree/master
      After a few fast encoder rotations the detected pulses disalign resulting in two stray pulses after each detected movement:

      pulse1
      pulse2
      pulse3
      pulse4
      MOVEMENT +1
      ... after some fast movements...
      pulse3
      pulse4
      MOVEMENT +1
      pulse 1
      pulse 2
      

      This behaviour is probably caused by some missed pulse but as result will ignore the first movement in the opposite direction.

      After some tests I fixed the issue rewriting the encoder code using the arduino Encoder library:
      RotaryEncoder.cpp
      RotaryEncoder.h

      droftartsundefined 2 Replies Last reply Reply Quote 1
      • droftartsundefined
        droftarts administrators @morgoth90
        last edited by

        @morgoth90 Thanks for your 'input'! I've added a note on the Pendant wiki instructions referencing this thread, here: https://docs.duet3d.com/en/User_manual/Connecting_hardware/IO_CNC_Pendant#programming-the-arduino-pro-micro

        Ian

        Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

        1 Reply Last reply Reply Quote 1
        • droftartsundefined droftarts referenced this topic
        • droftartsundefined
          droftarts administrators @morgoth90
          last edited by

          @morgoth90 Your RotaryEncoder.h file has:

          #include <Arduino.h>
          #include <Encoder.h>
          

          Can you link to the source of these files? I think Arduino.h is okay (I think it's included in the Arduino IDE), but a link to the correct Encoder.h file is needed.

          See the post in this thread: https://forum.duet3d.com/post/346952

          Ian

          Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

          morgoth90undefined 1 Reply Last reply Reply Quote 0
          • morgoth90undefined
            morgoth90 @droftarts
            last edited by

            @droftarts
            Right, probably was included in the available libraries because time ago i was sperimenting with a teensy controller.
            The encoder library is from here:
            https://github.com/PaulStoffregen/Encoder

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