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

Duet 3 Magnetic Encoder Usage

Scheduled Pinned Locked Moved Solved
Duet Hardware and wiring
4
9
145
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.
  • undefined
    StefanSch
    last edited by 9 Apr 2025, 14:30

    Dear all,

    we recently installed our first magnetic encoder from duet together with the 1HCL extension boards.
    Our mainboard is a Duet3 6HC board together with an RasPi.
    Everything went quite smoothly, including the calibration and manual tuning.

    However, I have a more general question about the capabilites of the generated encoder data, with the aim to evaluate different printing settings in hindsight. In the bestcase I would prefer to either capture the data directly into an .csv file or to set a global variable with the respective values, e.g. the current error.

    So far I found the following approaches (with some questions attached):

    M569.5: Closed loop data collection - Can I use this command for a "long time" data capture? The variables are all documented, however I did not fully understand if that can be implemented to supervise a full printing process. Am I supposed to just leave out the "T" and "V"?

    Object model:
    I could find 7 different entries in the object model that refer to the "closed loop" section for the extension boards (see below). However, I did not really find any explanation in the Documentation what those actually refer to. I think the "Position Error" might be the best indicator for me? Does this refer to the "Current Error" that is plotted in the Duet Plugin for the PID Tuning?

    Thanks for the help and any further suggestions!

    boards[].drivers[].closedLoop
    Closed-loop settings (if applicable)

    boards[].drivers[].closedLoop.currentFraction
    Current fraction

    boards[].drivers[].closedLoop.currentFraction.avg
    Average fraction

    boards[].drivers[].closedLoop.currentFraction.max
    Maximum fraction

    boards[].drivers[].closedLoop.positionError
    Position error

    boards[].drivers[].closedLoop.positionError.max
    Maximum position error

    boards[].drivers[].closedLoop.positionError.rms
    RMS of the position error

    undefined 1 Reply Last reply 9 Apr 2025, 15:22 Reply Quote 0
    • undefined
      droftarts administrators @StefanSch
      last edited by droftarts 4 Sept 2025, 15:23 9 Apr 2025, 15:22

      @StefanSch I don't think there's any way to collect data directly from the encoder or 1HCL. I also don't think M569.5 can be used, as the data is collected into memory before being written to the csv, so is limited by the available memory. As you need to specify the number of samples and the sample rate, it might be possible to collect a short amount of data. I guess it depends on what data you need from the ones that can be recorded.

      You can query the Object Model at up to 250ms intervals. We have done this in the past to collect data over a long period of time; the OM can be queried and data captured and recorded (we have shown a demo using RESTful API to capture data, recording to an InfluxDB time-series database), then queried (we used Grafana to graph the data).

      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

      undefined 1 Reply Last reply 10 Apr 2025, 06:22 Reply Quote 0
      • undefined
        StefanSch @droftarts
        last edited by 10 Apr 2025, 06:22

        @droftarts ok, thank you so far, even if that's a little pitty 😄
        I will try to figure around with the M569.5 a little then. Nevertheless, is there some additional information in regards to the object model entries available?

        undefined 1 Reply Last reply 10 Apr 2025, 06:54 Reply Quote 0
        • undefined
          jay_s_uk @StefanSch
          last edited by 10 Apr 2025, 06:54

          @StefanSch https://github.com/Duet3D/RepRapFirmware/wiki/Object-Model-Documentation

          Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

          undefined 1 Reply Last reply 10 Apr 2025, 06:55 Reply Quote 0
          • undefined
            StefanSch @jay_s_uk
            last edited by 10 Apr 2025, 06:55

            @jay_s_uk jeah thats where I looked first, but the documentation is really just the name of the variables, which makes it kinda hard to understand for me what the meaning of those really is.
            Thanks for the reply!

            undefined 1 Reply Last reply 10 Apr 2025, 07:11 Reply Quote 0
            • undefined
              dc42 administrators @StefanSch
              last edited by 10 Apr 2025, 07:11

              @StefanSch for the 1HCL boards and M23 motors running in closed loop mode there is additional data available in the object model, under boards[N].drivers[0].closedLoop. The values available are the average and maximum fraction of the configured motor current used, and the rms and maximum position error in full steps of the motor. Both of them refer to the preceding 250ms interval.

              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

              undefined 1 Reply Last reply 10 Apr 2025, 07:28 Reply Quote 0
              • undefined
                StefanSch @dc42
                last edited by StefanSch 4 Oct 2025, 07:29 10 Apr 2025, 07:28

                @dc42 thanks a lot! That's exactly what I needed. Maybe it would be worthwhile to add this to the objectmodel documentation directly?
                Do you know if there is a current development to provide additional data? That might be useful for reasearch centered applications as well.

                EDIT: Does "RMS" stand for the root mean square of the motor error? Or is there Another meaning in this context?

                undefined 1 Reply Last reply 11 Apr 2025, 08:38 Reply Quote 0
                • undefined
                  dc42 administrators @StefanSch
                  last edited by dc42 4 Nov 2025, 08:41 11 Apr 2025, 08:38

                  @StefanSch yes rms is root mean square.

                  The closed loop documentation already mentions these but without any detail, https://github.com/Duet3D/RepRapFirmware/wiki/Object-Model-Documentation#boardsdriversclosedloop. @chrishamm can you add the detail that I gave in my previous post in this thread?

                  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

                  undefined 1 Reply Last reply 11 Apr 2025, 10:54 Reply Quote 0
                  • undefined
                    StefanSch @dc42
                    last edited by 11 Apr 2025, 10:54

                    @dc42 perfect, thanks a lot! I think the topic can be closed then.

                    1 Reply Last reply Reply Quote 0
                    • undefined dc42 marked this topic as a question 11 Apr 2025, 15:59
                    • undefined dc42 has marked this topic as solved 11 Apr 2025, 15:59
                    7 out of 9
                    • First post
                      7/9
                      Last post
                    Unless otherwise noted, all forum content is licensed under CC-BY-SA