Motion control

Smoothie reads G-code instructions, and converts those into movement, typically by turning motors.

While that might sound pretty trivial to do, the laws of physics actually make this a bit more challenging that one might expect.

This page explains how to configure the different motion control parameters you can tune in Smoothie.


Or "the increase of speed". You experience it everyday.

When you ask Smoothie to move a certain distance at a certain speed, it starts at a speed of 0 ( not moving ).

If it goes instantly to the requested speed, in most cases, that won't work : A motor can not go from a speed of 0 to several rotations per second instantly. It needs to accelerate to that speed.

Similarly, the axis which is controlled itself has a given weight that needs to be moved. The faster you accelerate, the more force is required to accelerate the mass to the target speed.

This means that for any given machine, you must tune your acceleration. And that acceleration's value is a function of the torque of your motors, and the weight of whatever needs to move.

You set the acceleration value by modifying the acceleration value in your configuration file :

acceleration                                 3000             # Acceleration in mm/second/second.


Force is mass times acceleration

The units is millimeters per second per second, which means how many “millimeters per second “worth of speed is added every second.

3000 is a pretty common value for a 3D printer or laser cutter, since they have very little mass to move.

200 is a common value for CNC mills or routers since they have much more mass to move, and have to apply forces to their tool.

There is no mathematical/easy way of determining a perfect value : you are going to need to try values and find the one that works best for you.

If you feel like your machine is too slow, you increase acceleration. If your machine starts loosing steps, loosing it's position, or shakes too much, you reduce acceleration.

Note that you do not need to reset your Smoothieboard to try new values. You can start a “job”, and while the job is executing, try new values using the M204 M-code. For example, M204 S2000 sets acceleration to 2000 ( it takes a few seconds for this to take effect after the command is sent ).

Z axis

On some machines, your Z axis is very different from the others and has different requirements and capabilities.

On those machines, you can set the acceleration for Z separately, by editing the z_acceleration value.

Smoothie accelerates when it starts a move, and decelerates when it stops the move.

But what about if you move forward, then need to move somewhat to the right ? Do you really want to decelerate to a speed of zero before moving to the right ? That'd be a huge waste of time.

Junction deviation determines how much to slow down, proportional to how much the direction changes.

It doesn't really have a unit, it's just an arbitrary ratio. The smaller junction deviation is, the more we slow down on direction changes. The larger it is, the less we slow down on direction changes.

This generally means you can configure how much the machine “shakes” when moving : The less the machine slows down when changing direction, the more force is transfered to the structure of the machine, and the more the machine will shake.

But the more sturdy the machine it is, the higher junction deviation it will be able to handle without shaking.

Like acceleration, this is a value you will have to “play with” to find the right value for you.

You change it by changing the junction_deviation value in config.

junction_deviation       0.05       # Similar to the old "max_jerk", in millimeters,

0.05 is a typical value for a 3D printer. If your printer is very sturdy, you could use 0.1.
0.005 is a typical value for a CNC mill or router, though for some machine you might need to go to smaller values like 0.001.

Where speeds are concerned, Smoothie makes the distinction between two very important things : axes and actuators.

An actuator and an axis are two different things. An actuator is the thing that the motor causes to move directly. The axes are pretty much the coordinate system for the “tool”, and the system the Gcode uses.

On a cartesian machine, they are the same thing. But on a linear delta machine for example, they are different.

On a linear delta, the actuator is the linear axis that moves along a tower, while the axis ( or effector ) is the thing at the end of the arms that moves the tool.

In Smoothie, you can set maximum speeds for both of those systems separately.

Setting a maximum speed ensures that Smoothie will never go higher than that speed for that axis or actuator. This is useful if the machine would “skip” steps or have other problems if a too high speed was required, which is the case in most machines.

To set the maximum speed for an axis, edit the max_speed configuration option for that axis : 

x_axis_max_speed            30000      # mm/min

The units for the speed limit is millimeters per minute.

To limit the speed for an actuator, set the max_rate for that actuator : 

alpha_max_rate       30000.0         # mm/min


Note that decreasing acceleration allows reaching higher maximum speeds, in general.

But decreasing acceleration also decreases the average movement speed over a whole G-code file.

This is because of physics and inertia.

There are all the options related to motion control

Option Example value Explanation
default_feed_rate 4000 Default rate for G1/G2/G3 moves in millimetres/minute. This is overrided by the first F ( feedrate ) parameter after reset, and never used again.
default_seek_rate 4000 Default rate for G0 moves in millimetres/minute
mm_per_arc_segment 0.5 Arcs are cut into segments ( lines ), this is the length for those segments. Smaller values mean more resolution, higher values mean faster computation
mm_per_line_segment 5 Lines can be cut into segments ( generally not useful with cartesian coordinates robots ), this sets the maximum length of any given segment. Segments longer than this will be cut into several segments.
delta_segments_per_second 100 Instead of cutting lines into segment based on a distance, cut them based on time : segments will be cut so that Smoothie executes -about- delta_segments_per_second segments each second. This is mostly useful when using linear_delta arm solutions.
planner_queue_size 32 Defines how many blocks ( line segments ) are stored in RAM for look-ahead acceleration calculation. Do not change this unless you know exactly what you are doing, the reason why is increasing the size of the queue makes it take up more RAM space and can result in Smoothie running out of RAM, depending on your configuration and how much the rest of your modules take up space.
acceleration 3000 Acceleration in millimetres/second/second. Higher values make your machine faster and shakier, lower values make your machine slower and sturdier. This is generally proportional to the weight of the tool you are trying to move.
alpha_acceleration Acceleration in millimetres/second/second for the alpha actuator ( X axis on cartesian ), do not set on deltas
beta_acceleration Acceleration in millimetres/second/second for the beta actuator ( Y axis on cartesian ), do not set on deltas
gamma_acceleration Acceleration in millimetres/second/second for the gamma actuator ( Z axis on cartesian ), do not set on deltas
junction_deviation 0.05 Similar to the old “max_jerk”, in millimeters. Defines how much the machine slows down when decelerating proportional to the vector angle of change of direction. See here and here. Lower values mean being more careful, higher values means being faster and have more jerk
z_junction_deviation 0 Junction deviation for Z only moves, -1 uses junction_deviation, 0 disables junction_deviation on z moves. Do not set this value if you use a delta arm solution.
minimum_planner_speed 0 Sets the minimum planner speed in millimetres/sec. This is the lowest speed the planner will ever set a move to. Not generally useful.
microseconds_per_step_pulse 1 Duration of step pulses to the stepper motor drivers, in microseconds
base_stepping_frequency 100000 Base frequency for stepping, higher values gives smoother movement. Do not modify unless you know exactly what you are doing, 100khz is the only officially supported value.
2017/01/25 14:19 · arthur

Under the hood

Smoothie's main job is to convert Gcode into movement. Motion control modules ( in the source code src/modules/robot ) are the various steps in that process. For more on that process, see Howitworks, for general use and configuration documentation on Smoothie's motion control, see bellow : 

Video about maximum speeds