Constant speed of extra stepper motor. How to?
-
I want to connect a stepper motor to the Duex5 and be able to send g-code through DWC to set the stepper motor's speed. This will be totally unsynchronized with whatever else the 3D printer is doing. Is this possible?
Ideally it would be stationary until I click a Macro which causes the stepper to rotate at a set RPM. And I could have different macros for different speeds. And these macros could be launched in the middle of a print without interrupting the print at all.
If its not possible currently, then I can attempt to modify the firmware to make it possible. I can make a custom g-code to take the direction and speed as an input, but I don't know what to do in the firmware to translate that to moving the stepper motor at a constant speed while allowing the firmware to just continue doing its thing.
-
That would require substantial changes to the firmware, because the firmware isn't set up to do movements that are not synchronised between motors. You might find it easier to use an Arduino and a Pololu or similar stepper motor driver to control that motor.
If you do decide to change the firmware, you may wish to make use of the SoftTimer facility to generate the step pulses for your motor, so that you don't have to modify the main step generation code.
-
@jml I am curious about the application? (I guess mixing hotend or similar?)
As it is a constant speed requirement does it have to be a stepper? How about a servo or DC motor?
-
This thread that I started comes to mind https://forum.duet3d.com/topic/6616/best-type-of-ancilliary-motor
-
I guess it could be a servo or DC motor ... would it be straightforward to control their speeds, or would those need an encoder? I may just use a arduino+pololu as dc42 suggests and communicate through I2C or something.
The purpose is to experiment with a lathe type setup but where an extruder is extruding filament onto the spinning object. So fast constant speeds would be good in some applications, slow constant speeds too but I would also like to be able to control it precisely in terms of position (where it may move back and forth instead of spinning at a constant speed) - so perhaps I should find a way to use a stepper motor.
-
@jml ah yes if you need that sort of control then a DC motor is not really suitable.
Just a thought though, if you are extruding onto a rotating surface, is that not actually an axis that you do want to synchronise with all the other gcode (albeit a very "long" axis) conceptually this is no different to extruding onto a flat surface, in that you want to precisely control the amount of extrusion in two dimensions and the distance from the surface to the nozzle in another dimension.
-
If you’re extruding onto the rotating surface, I would think you’ll want it to be synchronized with the other motors, so you don’t get inconsistent extrusion as the extruder and Y axis / cross-slide starts and stops.
-
Yeah you're all right, I would want it synchronized. I guess though that the solution might be more related to the slicing rather than the firmware.
-
@dc42 Any advice on how to use the SoftTimer for this?
-
@jml said in Constant speed of extra stepper motor. How to?:
I want to connect a stepper motor to the Duex5 and be able to send g-code through DWC to set the stepper motor's speed. This will be totally unsynchronized with whatever else the 3D printer is doing. Is this possible?
Ideally it would be stationary until I click a Macro which causes the stepper to rotate at a set RPM. And I could have different macros for different speeds. And these macros could be launched in the middle of a print without interrupting the print at all.
If its not possible currently, then I can attempt to modify the firmware to make it possible. I can make a custom g-code to take the direction and speed as an input, but I don't know what to do in the firmware to translate that to moving the stepper motor at a constant speed while allowing the firmware to just continue doing its thing.@dc42 said in Constant speed of extra stepper motor. How to?:
That would require substantial changes to the firmware, because the firmware isn't set up to do movements that are not synchronised between motors. You might find it easier to use an Arduino and a Pololu or similar stepper motor driver to control that motor.
I can't stress DC42 statements enough. The firmware is entirely oriented around the concept of coordinated motion. Using a general IO pin to start/stop something that runs at constant speed is a much better approach, if you really want non-coordinated motion.
And...
As stated, are you sure about constant speed? Coordinated motion seems to be required from your "where an extruder is extruding filament onto the spinning object" description. If for no other reason, accel/deccel during start stop of the spin.
And, coordinated motion will be incredibly easy to test. Define an extra axis, plug in a stepper, specify that axis on your moves. Getting "steps/mm" to be where you want them may take a bit of tweaking.
-
He also said I may wish to use SoftTimer if I decide to change the firmware. SoftTimer stuff will be asynchronous to the regular synchronized motion. So I decided to change the firmware. If I do it right, I'll be able to have coordinated motion in one mode, and then in another mode, have it accelerate and decelerate to desired speeds asynchronous to what the other axes are doing. I want both modes and am trying to implement it using SoftTimer, but I'm not exactly sure how to use it. I assume its similar to arduino's softtimer but it seems to have more input arguments.