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

Solved: Leadshine Closed-Loop External Motor Drivers with Duet2

Scheduled Pinned Locked Moved
General Discussion
9
20
2.3k
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
    Cameron
    last edited by 11 Jul 2020, 18:29

    Solved: How to use Leadshine Closed-Loop External Motor Drivers with Duet 2 Wifi and Breakout Expansion Board

    Note: I have wired the external drivers as "Common-Anode" and have supplied them with a +5v power supply. I have also set the DIP Switches to be 6400 Pulses/Revolution.
    0.png

    1- Start with a fresh config file and run through the basic setup as you would for any printer. I used the RRF Config Tool that can be found here: https://configtool.reprapfirmware.org/Start

    2- Now go into the Config file and make the following adjustments. (do this before you try using the machine)

    Set the M569 values for all of the External Motor Driver Axis

    • in the Config file place the M569 Parameters before all other drive settings. for me this was just after the network settings.

    • The "P" parameter is very straight forward. Just put the Pin Number from the Expansion Board for each axis. You can find this by looking for the Printed Labels next to each Header and add then add 3.1.png

    • The "S" parameter will be determined by your machine layout. you can always come back and change this if an Axis is running in the wrong direction.

    • Set the "R" parameter to "R1" Active High

    • Use the "Taa:bb:cc:dd" parameter and set it to "T5:2.5:5:7.5" (5us minimum step pulse, 2.5us minimum step interval, 5us DIR setup time and 7.5 hold time. This is the setting I found that worked will all of the different Leadshine Closed-Loop External Motor Drivers I have. if these setting do not work for you begin increasing the minimum step pulse (aa) by intervals of 0.5 until it they work. You can also try reducing the minimum step pulse (aa) and the hold time (dd) by intervals of 0.5 to increase motor speed however these settings are probably plenty fast. Note: Make sure that you do not set the minimum step pulse (aa) below a value of 2.5

    • The finished M569 parameters should look like this: M569 P7 S0 R1 T5:2.5:5:7.5 Make sure to do this for all of the External Headers you are using.

    3- Next add the Drive Mapping Parameter M584 to your Config File. Note: Make sure that this comes after the M569 parameters.

    Simply match the Header Numbers to the Axis that you have wired them to.
    mine ended up looking like this: M584 X7 Y6 Z5 E9

    With these setting uploaded you should now be able to move each axis on the machine. once you have verified that all of the External Drivers are moving the stepper motors without an unexpected sounds or movements, you will need to go through the process of setting the M92 (steps per mm) parameter.

    You Should now be ready to print! 😎

    After much trial and error, here is what my Drive Settings in my Config File ended up looking like.

    ; Drive Settings
    ; Drives driver direction, enable polarity and step pulse timing
    ;------------------X MOTOR-------------------------------------------------------------
    M569 P7 S0 R1 T5:2.5:5:7.5 ; driver 7 direction is backwards and requires an active high enable, 5us minimum step pulse, 2.5us minimum step interval, 5us DIR setup, and 7.5us hold time
    ;------------------Y MOTOR-------------------------------------------------------------
    M569 P6 S0 R1 T5:2.5:5:7.5 ; driver 6 direction is backwards and requires an active high enable, 5us minimum step pulse, 2.5us minimum step interval, 5us DIR setup, and 7.5us hold time
    ;-----------------Z MOTOR--------------------------------------------------------------
    M569 P5 S0 R1 T5:2.5:5:7.5 ; driver 5 direction is backwards and requires an active high enable, 5us minimum step pulse, 2.5us minimum step interval, 5us DIR setup, and 7.5us hold time
    ;-----------------EXTRUDER 0 MOTOR-----------------------------------------------------
    M569 P9 S0 R1 T5:2.5:5:7.5 ; driver 9 direction is backwards and requires an active high enable, 5us minimum step pulse, 2.5us minimum step interval, 5us DIR setup, and 7.5us hold time
    M584 X7 Y6 Z5 E9				   ; set drive mapping to external drivers
    M92 X171.00 Y171.00 Z1290.00 E400.00               ; set steps per mm
    M566 X100.00 Y100.00 Z60.00 E120.00                ; set maximum instantaneous speed changes (mm/min)
    M203 X2000.00 Y2000.00 Z180.00 E1200.00            ; set maximum speeds (mm/min)
    M201 X100.00 Y100.00 Z100.00 E1000.00              ; set accelerations (mm/s^2)
    M906 X1000 Y1000 Z1000 E1000 I30                   ; set motor currents (mA) and motor idle factor in per cent
    M84 S30                                            ; Set idle timeout
    
    

    I found this information to be hard to find, but the community here helped me piece it together so I though it would be good to compile it all in one location. I hope that this will help you through your build!

    1 Reply Last reply Reply Quote 6
    • undefined
      OwenD
      last edited by 11 Jul 2020, 21:04

      Well done.
      It would be interesting to see a before/after comparison of print quality and speed.

      1 Reply Last reply Reply Quote 0
      • undefined
        Cameron
        last edited by Cameron 14 Jul 2020, 15:54

        @OwenD Here are some initial results. I am still working on tuning the machine and am currently working on a new extruder/hotend design, but so far I am quite happy with the prints. This Bottle is almost 1 meter tall and used 1Kg of material. I printed it spiralized at .8mm layer height and it tool just over 3 hours. Once I have designed the new extruder assembly I will post an update. my goal is to get to 1kg of material in under an hour and maintain a decent print quality.

        Orange Sharpie for Scale 🖊
        Screen Shot 2020-07-14 at 11.17.36 AM.png
        Screen Shot 2020-07-14 at 11.27.33 AM.png

        1 Reply Last reply Reply Quote 3
        • undefined
          Phaedrux Moderator
          last edited by 14 Jul 2020, 17:43

          1KG/hour is into pellet extruder territory. Very impressive.

          Z-Bot CoreXY Build | Thingiverse Profile

          1 Reply Last reply Reply Quote 1
          • undefined
            baird1fa
            last edited by 17 Jul 2020, 13:17

            That’s cool. And I thought I had a big printer, not compare to that one.

            1 Reply Last reply Reply Quote 0
            • undefined
              mrehorstdmd
              last edited by mrehorstdmd 17 Jul 2020, 14:04

              @Cameron Do you see any advantage or effect on print quality in using the closed loop motors instead of open loop steppers?

              https://drmrehorst.blogspot.com/

              undefined 1 Reply Last reply 17 Jul 2020, 14:50 Reply Quote 0
              • undefined
                Cameron @mrehorstdmd
                last edited by 17 Jul 2020, 14:50

                @mrehorstdmd I am mostly using the Closed Loop system to detect/prevent collisions because of the high speeds that I am running the printer at and Id like the machine to not destroy itself. They are very good at maintaining position at high speeds and after pausing. I have noticed that they do not seem to perform well with coasting setting in prints. I am working on a new print cooling system and should be able to increase my speeds.

                undefined ? 2 Replies Last reply 17 Jul 2020, 15:06 Reply Quote 0
                • undefined
                  mrehorstdmd @Cameron
                  last edited by 17 Jul 2020, 15:06

                  @Cameron Are you using a closed loop stepper for the extruder, too? What does the hot end look like?

                  https://drmrehorst.blogspot.com/

                  1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User @Cameron
                    last edited by 17 Jul 2020, 15:42

                    @Cameron

                    So the answer to the gents question about improving print quality is no then..

                    undefined 1 Reply Last reply 17 Jul 2020, 16:18 Reply Quote 0
                    • undefined
                      arhi @A Former User
                      last edited by 17 Jul 2020, 16:18

                      @CaLviNx said in Solved: Leadshine Closed-Loop External Motor Drivers with Duet2:

                      So the answer to the gents question about improving print quality is no then..

                      It depends on the setup you are replacing 🙂

                      I'm using few leadshine closed loop steppers for some testing (mostly low power laser and some light milling) and compared to some sanguino board with old pololu stepper driver and some second hand el cheapo nema23 I was using for test initially the difference is staggering..

                      I'll try to find images, I'm sure I saved them, it is very easy to see with laser as with original setup I had issues that line looked "pointy" and not smooth as stepper was not moving at constant speed but was "stopping" after every step and you see that by laser blacking paper more. Also the "points/dots" were not equaly spread on the line but were more concentrated around full and half step positions (no matter if I was using 1/16 microstepping or 1/32 the spread was same). With leadshine (I got both motor and driver from them "matched") the line is straight and smooth

                      No clue if that would be visible on 3d print (as I don't see that with duet and different nema17 motors I tested) .. so as I said, depends what you are comparing it to. If you compare it to crappy open loop setup - it's better, microstepping is not only allowing for "smooth start" but is actually precise

                      1 Reply Last reply Reply Quote 0
                      • undefined
                        mrehorstdmd
                        last edited by 17 Jul 2020, 16:42

                        I recently put iHSV servomotors in my sand table and they perform so much better than steppers in that application I'm going to try putting them into my printer. I am not expecting the sort of improvements I saw in the sand table performance, mainly because the application is so much different. In the sand table, I need high speed (1000-1500 mm/sec), high acceleration, and quiet operation, with precision and accuracy being secondary considerations- sand is not a high resolution medium.

                        In the 3D printer I need low to moderate speed and acceleration, high precision and accuracy, and quiet operation. I think they'l be quiet, but I'm not sure how they'll behave at 3D printing speeds/accelerations. There are many parameters to tune in the driver to optimize performance, but no information in the manual or software about how do actually do the tuning, so I'll probably just run them at the factory default settings and hope for the best.

                        https://drmrehorst.blogspot.com/

                        undefined 1 Reply Last reply 17 Jul 2020, 17:30 Reply Quote 0
                        • undefined
                          arhi @mrehorstdmd
                          last edited by 17 Jul 2020, 17:30

                          @mrehorstdmd said in Solved: Leadshine Closed-Loop External Motor Drivers with Duet2:

                          I'll probably just run them at the factory default settings and hope for the best

                          3D printing speeds should be covered by default settings as we go from ~10mm/sec up to 200mm/sec .. rarely below or above that, this is "inside" the normal range for e.g. milling machines or plazma cutters or wood routers.. thay are usually used for at factory settings and those cut sometimes at much lower speeds than our 10mm/sec and have free moves faster than 200mm/sec so IMHO factory will work perfectly for 3d printer

                          1 Reply Last reply Reply Quote 0
                          • undefined
                            baird1fa
                            last edited by 29 Aug 2021, 00:41

                            Did you find you have to use the 5V rather than the 3.6v on the expansion board? I just hooked some up and they don’t appear to work using the +/- 3.6V.

                            I guess I change the wiring to use the 5V and see if that works.

                            undefined dc42undefined 2 Replies Last reply 29 Aug 2021, 01:10 Reply Quote 0
                            • undefined
                              mrehorstdmd @baird1fa
                              last edited by 29 Aug 2021, 01:10

                              @baird1fa I connected the motors directly to the expansion board differential outputs using whatever voltage comes off it and it works fine.

                              https://drmrehorst.blogspot.com/

                              undefined 1 Reply Last reply 29 Aug 2021, 02:07 Reply Quote 0
                              • undefined
                                baird1fa @mrehorstdmd
                                last edited by 29 Aug 2021, 02:07

                                @mrehorstdmd

                                Oh, where did you put the 5V power supply that you used then? Or did you run 5V to all the +ve terminals then the -ve to the expansion board? Maybe my issue is I’m hoping to run at the highest steps possible 51200 I think.

                                undefined 1 Reply Last reply 29 Aug 2021, 03:44 Reply Quote 0
                                • undefined
                                  mrehorstdmd @baird1fa
                                  last edited by mrehorstdmd 29 Aug 2021, 03:44

                                  @baird1fa I just took the output directly off the expansion board. There was no separate 5V power supply.

                                  This is how I wired it- the controller in the diagram is the Duet expansion board:

                                  undefined

                                  I did not use the alarm outputs so that stuff is not connected.

                                  The motor and controller board have their own 24V power supplies (I had an incident...) and I'm adding a protection circuit to prevent power supply over-voltage death (from happening again...).

                                  This is the protection circuit. It protects the power supply and the motor driver which are both connected to the same power supply from overvoltage condition. It operates when the motor voltage is higher than the power supply voltage. That can happen when you get the motor moving really fast and then your mechanism slams into a mechanical stop, stopping the motor suddenly, or just exceeding the motor's rated speed limit. The transistor turns on and shunts the voltage to almost-ground (the 33 Ohm current limiting resistor). Once the normal relationship is restored, Q1 shuts off and the motor and power supply go on as if nothing happened.

                                  undefined

                                  https://drmrehorst.blogspot.com/

                                  1 Reply Last reply Reply Quote 0
                                  • dc42undefined
                                    dc42 administrators @baird1fa
                                    last edited by 29 Aug 2021, 08:35

                                    @baird1fa said in Solved: Leadshine Closed-Loop External Motor Drivers with Duet2:

                                    Did you find you have to use the 5V rather than the 3.6v on the expansion board? I just hooked some up and they don’t appear to work using the +/- 3.6V.

                                    I guess I change the wiring to use the 5V and see if that works.

                                    Did that work for you?

                                    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 29 Aug 2021, 13:54 Reply Quote 0
                                    • undefined
                                      baird1fa @dc42
                                      last edited by baird1fa 29 Aug 2021, 13:54

                                      @dc42

                                      I was going to try that this morning but first I’ve connected an oscilloscope to the pul +/- wires to see what signals I can see just to make sure the software is sending pulses. So far I’m not seeing any signals. Just some repeating noise in the range of 30ms. I must have something wrong in my config.g.

                                      Edit: They are working now. I’m not certain what I did to get them working I made some changes to my end stops and my spindle tool and all of a sudden then work, both with the +/- 3.6V and the use of a common 5V positive input.

                                      1 Reply Last reply Reply Quote 0
                                      • undefined
                                        martin7404
                                        last edited by 5 Feb 2022, 01:51

                                        I do not understand where on DUET you wire Alarm signal from the external driver

                                        Muldex IDEX Duet2+Duex5
                                        Custom CoreXY 600x400 Hemera , Duet3+Toolboard+1HCL closed loop
                                        Sapphire Pro with Duet2, with closed-loop motors
                                        custom high temp E3D tool changer with Duet2+Duex

                                        undefined 1 Reply Last reply 5 Feb 2022, 03:18 Reply Quote 0
                                        • undefined
                                          baird1fa @martin7404
                                          last edited by 5 Feb 2022, 03:18

                                          @martin7404

                                          You can wire them into any of the stop inputs. I have used a long ribbon cable to access the e2 and up stop lines for my closed loop steppers.
                                          They trigger a pause command.

                                          1 Reply Last reply Reply Quote 0
                                          • undefined martin7404 referenced this topic 7 Feb 2022, 17:25
                                          • undefined martin7404 referenced this topic 27 Feb 2022, 07:16
                                          • First post
                                            Last post
                                          Unless otherwise noted, all forum content is licensed under CC-BY-SA