View Full Version : Basics on control and positioning with stepper motors
29-06-2014, 12:15 PM
Hi. Can I just ask a few basic questions about control and positioning with stepper motors employed CNC machines, linear actuators (gantry type or otherwise).
I think most people here make CNC machines. Okay here are my questions:
* Are you accelerating and decelerating the stepper (ramping up/ramping down the step frequency). Or, are you operating the stepper at the maximum starting frequency (fs) to get "instant" start and stop?
* To get an accurate stop position, are you programming (via a counter, or whatever) the number of steps to the stop position? I suppose you must be with open loop.
* Is braking used?
* Do you find it necessary to use open loop with the stepper motor?
ADDING: The thing is, I'm not seeking to build a CNC machine as such. So, my technical requirements might be somewhat different. Just wanting to grasp what the CNC machinists are doing, as it's not a million miles from what I'm trying to do.
29-06-2014, 07:04 PM
Let me just add a bit more:
I can see that if the mass the stepper motor has to move is too great for an "instant" start or stop, the only way to avoid stepper missteps is to ramp up the frequency of the pulses for a soft start and ramp down for a soft stop.
Just wondering then if it's normal for the CNC machine to be programmed to ramp the stepper frequency up and down or whether that in practice is not usually necessary.
The alternative of course is to always keep the step frequency below the maximum starting frequency of the stepper motor when it's coupled to the load. Because then you don't need to ramp the frequency. You could though use different step frequencies (thus different motor spindle speeds) - just no ramping of frequency.
I note that whether you frequency ramp or not, the motor still does the same number of steps.
29-06-2014, 09:04 PM
Most common approach for the typical size CNC router is to dump the whole problem on the machine control software! So, Mach3, LinuxCNC or whatever sorts it out. However, part of the software configuration for a particular machine is to define max travel velocity and max acceleration. The software then generates pulses at a varying rate to ramp speed up to the max (assuming that the travel is long enough) at a max acceleration as defined by the user. Deceleration also uses the same "max acceleration" value, which is the equivalent of braking. For a given machine, you choose speed and acceleration either by copying what someone else with similar hardware has done, or, better, by testing at different rates until you find the values at which the motor "loses steps" - i.e. loses position as it is unable to keep up with the demanded pulse rate. Easy enough to do - just check that the axis returns to its starting point after a trial run. Because the steppers are then run within their capability, most machines run open-loop. Larger/faster/more powerful machines will tend to go for servos set up as closed loop.
My 3D printer doesn't ramp up and just takes off at full speed, but the moving masses and the actual speeds are low enough that this works OK.
29-06-2014, 11:24 PM
There will be a speed below which you can do an "instantaneous" start or stop in X,Y without losing steps. It is very possible that this speed will be below your cutting speed so you only need to worry about rapid transits.
Z shifts will probably be different and are not to be forgotten when setting your accelerations.
Accelerations are really easy to code until you reach the point when the idiot operator suddenly presses the STOP button causing accelerations to become decelerations and a new plan has to be formulated to get everything going again when the IO presses RESUME. If you are coding accelerations plan for IO commands early on in the process or you will end up with a mess.
The other consideration is what happens when you get to the end of something and need to load the next movement despite the fact that you have 3 axes going like the clappers and you are in danger of over-running your step interval.
I usually create an acceleration table which is a list of numbers that will reload the timer that initiates the step. Each straight line has 3 components, accelerating steps, constant velocity steps, deceleration steps. This needs a bit of sorting out when the IO strikes but it is compact and fast and I am getting a bit too geeky :culpability:
30-06-2014, 08:39 AM
Robin - your experience is probably more relevant to the original question, given that the majority of us delegate all the clever bits to off-the-shelf software, but I did wonder if you've ever looked under the covers of LinuxCNC, given that it is open-source. Is there anything there that might help someone developing their own machine control application?
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.