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

Define RC Servo as Axis?

Scheduled Pinned Locked Moved
Firmware wishlist
3
9
274
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
    DocTrucker
    last edited by DocTrucker 1 Nov 2024, 14:51 11 Jan 2024, 14:50

    Is it possible (if not then this is one for the wishlist) to define a servo as an axis?

    I have a twin hotend head with a servo mechanism that drops one nozzle while lifting the other to change over active hotends. This changes the distance between the nozzle and the extruder drive. So at the moment I would need to retract the filament that is o the active nozzle, servo lift one and drop the other nozzle, and finally prime the new active nozzle. It woould be great if the extrusion moves could happen at the same time as the servo swap. Less chance of sucking air back into the hotend.

    Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

    undefined 1 Reply Last reply 11 Jan 2024, 16:50 Reply Quote 0
    • undefined
      droftarts administrators @DocTrucker
      last edited by 11 Jan 2024, 16:50

      @DocTrucker No, as far as I know servos cannot be defined as an axis. Could you control the servo in a second motion system, and coordinate it with the extrusion move that way? See https://docs.duet3d.com/en/User_manual/RepRapFirmware/Multiple_motion_systems

      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 0
      • undefined
        o_lampe
        last edited by 12 Jan 2024, 07:00

        The problem I see with a hobby servo as axis is: you can't control the speed very well. It would be a jerky start/stop motion at best.
        Alternatively, there are tiny "N20" geared motors with AB-encoder. You can use simpleFOC to control them via their step/dir interface.
        I did similar things with a RP2040 or ESP32 and a BLDC motor

        undefined 1 Reply Last reply 12 Jan 2024, 07:30 Reply Quote 0
        • undefined
          DocTrucker @o_lampe
          last edited by 12 Jan 2024, 07:30

          Not that it really needs showing but here is the mechanism viewed upside down. those clamps secure to the cool side of the heat break after the heat sinks:

          https://youtu.be/mDKmF9O7StE?si=4yzGWXIKaESQB9Nr

          @o_lampe at slow speeds fair enough, but at higher speeds the motion is smooth enough to be able to move in sync with a stepper. PWM is after all an analogue signal, it just happens that most control systems impose a microsecond resolution to the control. That said few servos even reach that level of resolution. Hooking up Duet systems to the DroneCAN servos would be great, but: [far to little use case/not apropriate for this use case/to expensive].

          Well guess that answers my next question which was how to control speed! Not enough use case to add the control loop. I will look into conditional gcode and a loop to increment stepper and servo.

          Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

          undefined 1 Reply Last reply 12 Jan 2024, 07:45 Reply Quote 0
          • undefined
            DocTrucker @DocTrucker
            last edited by 12 Jan 2024, 07:45

            ...the blocking nature of the G1 Ex Fx commands could be used to time seperate the servo update commands. Just a little work to find usec per mm and max speed of the lift mechanism. Think the conditional gcode loop has legs for this.

            Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

            undefined 1 Reply Last reply 16 Jan 2024, 11:35 Reply Quote 0
            • undefined
              DocTrucker @DocTrucker
              last edited by DocTrucker 16 Jan 2024, 11:35

              I had a crack at the conditional gcode this morning and it worked reasonably well, but the movement is sloooow! I will be reading the PWM setting using the object model and developing the code so that it moves from any position. Parking the nozzles to a known position before shut down will also simplify things.

              ; test
              ; T0 Nozzle movement = 1.15mm
              ; T1 Nozzle movement = 1.40mm
              ; PWM Settings T0 = M280 P0 S1750
              ; PWM Settings T1 = M280 P0 S1250
              ; PWM range = 500us
              var e_range = 1.15
              var e_step = 0.10
              var num_steps = var.e_range / var.e_step; = 28
              var e2_step = -1.40 / var.num_steps
              var pwm_start = 1750 ; T0 high
              var pwm_end = 1250 ; T0 low.
              var pwm_current = var.pwm_start
              var pwm_step = (var.pwm_end - var.pwm_start) / var.num_steps
              var loop_count = 0
              while var.loop_count < var.num_steps
              set var.loop_count = iterations
              set var.pwm_current = var.pwm_start + (var.pwm_step * iterations)
              M280 P0 S{var.pwm_current}
              G1 E{var.e_step}:{var.e2_step}
              set var.pwm_current = var.pwm_end
              M280 P0 S{var.pwm_current}

              Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

              undefined 1 Reply Last reply 17 Jan 2024, 08:32 Reply Quote 0
              • undefined
                o_lampe @DocTrucker
                last edited by 17 Jan 2024, 08:32

                @DocTrucker said in Define RC Servo as Axis?:

                the movement is sloooow!

                There is no F-param in the G1 E..... line, maybe it runs at turtle speed?

                undefined 1 Reply Last reply 17 Jan 2024, 09:05 Reply Quote 0
                • undefined
                  DocTrucker @o_lampe
                  last edited by 17 Jan 2024, 09:05

                  @o_lampe Good spot. Can't see the wood for the trees after a while. 🙂

                  I'll be using whatever the previous F setting was. The other issue that will be choking speed a bit is it will be looking to come to a full stop before executing each change of PWM.

                  Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

                  undefined 1 Reply Last reply 18 Jan 2024, 08:53 Reply Quote 0
                  • undefined
                    o_lampe @DocTrucker
                    last edited by 18 Jan 2024, 08:53

                    @DocTrucker That's what I meant with jerky motion. You can use bigger steps than 5 microseconds for more speed, but too much and they get jerky.

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