## Considerations when choosing stepper motors

### Number of wires (unipolar/bipolar)

The Duet boards use bipolar stepper motor drivers. This means you can use stepper motors suitable for bipolar drive, which have 4, 6 or 8 wires. You cannot use motors with 5 wires, because those are intended to be driven in unipolar mode only. (Some unipolar motors can be made into bipolar motors by cutting a trace on a circuit board.)

### Rated current

This is the maximum current you may pass through both windings at the same time. The maximum current through one winding (which is what really matters when using microstepping) is rarely quoted and will be a little higher. However, even with one winding driven at the quoted rated current, the motor will get very hot. So the usual practice is to set the motor current to no more than about 85% of the rated current. Therefore, to get maximum torque out of your motors without overheating them, you should choose motors with a current rating no more than 25% higher than the recommended maximum stepper driver current. This gives:

- Duet 0.6 and Duet 0.8.5 (recommended maximum motor current 1.5A) => Stepper motor rated current <= 1.9A
- Duet 2 WiFi and Duet 2 Ethernet (maximum motor current 2.4A) => Stepper motor rated current <= 3.0A
- Duet 2 Maestro (recommended maximum motor current 1.4A with good fan cooling) => Stepper motor rated current <= 1.7A. Hower, if you use motors with lower rated current (e.g. 1.0 to 1.2A) and 24V power, then the drivers will run cooler.

### Holding torque

This is the maximum torque that the motor can provide with both windings energised at full current before it starts jumping steps. The holding torque with one winding energised at the rated current is about 1/sqrt(2) times that. The torque is proportional to current (except at very low currents), so for example if you set the drivers to 85% of the motor rated current, then the maximum torque will be 85% * 0.707 = 60% of the specified holding torque.

Torque is produced when the rotor angle is different from the ideal angle that corresponds to the current in its windings. When a stepper motor is accelerating, it has to produce torque to overcome its own rotor inertia and the mass of the load it is driving. In order to produce this torque, the rotor angle must lag the ideal angle. In turn, the load will lag the position commanded by the firmware.

You will sometimes see it written that microstepping reduces torque. What this really means is that when the lag angle is assumed to be equal to the angle corresponding to one microstep (because you want the position to be accurate to within one microstep), higher microstepping implies a smaller lag angle, hence lower torque. The torque per unit lag angle (which is what really matters) does not reduce with increased microstepping. To put it another way, sending the motor a single 1/16 microstep results in exactly the same phase currents (and therefore the same forces) as sending it two 1/32 microsteps, or four 1/64 microsteps, and so on.

### Size

There are two relevant sizes: the Nema size number and the length. The Nema size number defines the square dimension of the body and the mounting hole positions. The most popular size for 3D printers is Nema 17, which has a body no more than 42.3mm square and fixing holes in a square of side 31mm.

**Nema 17** motors come in various lengths, ranging from 20mm long "pancake" motors to 60mm long motors. As a general rule, the longer a motor is, the greater its holding torque at rated current. Longer stepper motors also have greater rotor inertia.

**Nema 23** motors offer higher torque than Nema 17 motors. The Duet 2 (WiFi and Ethernet) can drive them if you choose them carefully, in particular in respect of rated current. Look for a rated current of around 2.8A. You should use 24V power.

### Step angle

There are two common step angles: 0.9 and 1.8 degrees per full step, corresponding to 400 and 200 steps/revolution. Most 3D printers use 1.8 deg/step motors.

Aside from the obvious difference in step angle:

- 0.9deg motors have slightly lower holding torque than similar 1.8deg motors from the same manufacturer
- However, to produce a given torque, the lag angle needed by a 0.9deg motor is slightly more than half the lag angle of a similar 1.8deg motor. Or to put it another way, at small lag angles a 0.9deg motor has nearly twice as much torque as a 1.8deg motor for the same lag angle.
- At a given rotation speed, a 0.9deg motor produces twice as much inductive back emf as a 1.8deg motor. So you generally need to use 24V power to achieve high speeds with 0.9deg motors.
- 0.9deg motors need step pulses to be delivered to the drivers at twice the rate of 1.8deg motors. If you use high microstepping then the speed could be limited by the rate at which the electronics can generate step pulses. The interpolation mode of the TMC2660 drivers on the Duet 2s can be used to overcome this issue.

### Inductance

The inductance of the motor affects how fast the stepper motor driver can drive the motor before the torque drops off. If we temporarily ignore the back emf due to rotation (see later) and the rated motor voltage is much less than the driver supply voltage, then the maximum revs/second before torque drops off is:

revs_per_second = (2 * supply_voltage)/(steps_per_rev * pi * inductance * current)

If the motor is driving a GT2 belt via a pulley, this gives the maximum speed in mm/sec as:

speed = (4 * pulley_teeth * supply_voltage)/(steps_per_rev * pi * inductance * current)

Example: a 1.8deg/step (i.e. 200 steps/rev) motor with 4mH inductance run at 1.5A using a 12V supply, and driving a GT2 belt with 20 tooth pulley would start losing torque at about 250mm/sec. This is the belt speed, which on a CoreXY or delta printer is not the same as the head speed.

In practice the torque will drop off sooner than this because of the back emf caused by motion, and because the above doesn't allow for the winding resistance. Low inductance motors also have low back emf due to rotation.

What this means is that if we want to achieve high speeds, we need low inductance motors and high supply voltage. The maximum recommended supply voltage for the Duet 2(Wifi or Ethernet) is 25V.

### Resistance and rated voltage

These are simply the resistance per phase, and the voltage drop across each phase when the motor is stationary and the phase is passing its rated current (which is the produce of the resistance and the rated current). These are unimportant, except that the rated voltage should be well below the power supply voltage to the stepper drivers.

### Back emf due to rotation

When a stepper motor rotates it produces a back emf. At the ideal zero lag angle, this is 90 degrees out of phase with the driving voltage, and in phase with the back emf due to inductance. When the motor is producing maximum torque and is on the verge of skipping a step, it is in phase with the current.

Back emf due to rotation is not normally specified on the data sheet, but we can estimate it from this formula:

approximate_peak_back_emf_due_to_rotation = sqrt(2) * pi * rated_holding_torque * revs_per_second / rated_current

The formula assumes that the holding torque is specified with both phases energised at the rated current. If it is specified with only one phase energised, replace the sqrt(2) by 2.

Example: consider a 200 step motor driving a carriage via a 20 tooth pulley and GT2 belt. That's 40mm movement per rev. To achieve a speed of 200mm/sec we need 5 revs/sec. If we use a motor with 0.55Nm holding torque when both phases are driven at 1.68A, the peak back emf due to rotation is 1.414 * 3.142 * 0.55 * 5/1.68 = 7.3V.

How accurate is this formula? dc42 measured and then calculated the back emf for two types of motor:

- 17HS19-1684S: measured 24V, calculated 24.24V assuming holding torque is specified with both phases energised at rated current.
- JK42HS34-1334A: measured 22V, calculated 15.93V assuming 0.22Nm holding torque with both phases energised at rated current. Perhaps the holding torque for this motor is specified with only one phase energised, in which case the calculated value becomes 22.53V. I have also seen the holding torque for this motor given in a different datasheet as 0.26Nm , which increases the calculated value to 18.05V.

## How to work out the power supply voltage you need

If you have a target travel speed for your printer, you can work out at least approximately what supply voltage you will need to the motor drivers. Here's how, with an example calculation:

- Decide on your target travel speed. For this example I will use 200mm/sec.
- From the target travel speed, work out the worst-case maximum belt speed. For a Cartesian printer, the worst case is a pure X or Y motion, so the worst case belt speed is the same as the travel speed. For a CoreXY printer, the worst case is a diagonal motion and the corresponding belt speed is sqrt(2) times the travel speed. For a delta printer the worst case is a radial move near the edge of the bed and the worst case belt speed is the travel speed divided by tan(theta) where theta is the smallest angle of a diagonal rod to the horizontal. In practice we can't use the target travel speed for radial moves right up to the edge of the bed because of the distance needed to accelerate or decelerate, so take theta as the angle when the nozzle is about 10mm from the edge of the bed opposite a tower. For my delta this is 30 degrees, so the maximum belt speed is 200/tan(30deg) = 346mm/sec.
- Work out the motor revs per second at the maximum belt speed, by dividing the belt speed by the belt tooth pitch (2mm for GT2 belts) and the number of teeth on the pulley. My delta uses 20-tooth pulleys so the maximum revs per second is 346/(2 * 20) = 8.7.
- Work out the peak back emf due to inductance. This is revs_per_second * pi * motor_current * motor_inductance * N/2 where N is the number of full steps per revolution (so 200 for 1.8deg motors, or 400 for 0.9deg motors). My motors are 0.9deg with 4.1mH inductance and I generally run them at 1A. So the back emf due to inductance is 8.7 * 3.142 * 1.0 * 4.1e-3 * 400/2 = 22.4V.
- Work out the approximate back emf due to rotation. From the formula given earlier, this is sqrt(2) * pi * rated_holding_torque * revs_per_second / rated_current. My motors have rated current of 1.68A and holding torque of 0.44Nm, so the result is 1.414 * 3.142 * 0.44 * 8.7/1.68 = 10.1V
- Preferably, the driver supply voltage should be at least the sum of these two back emfs, plus a few more volts. If you have two motors in series then the required voltage is doubled.

In my example, this gives 32.5V, which is above the 25V recommended input voltage for the Duet 2. But at least we know that for a worst-case delta move with 200mm/sec travel speed, if I use a 24V supply then that is more than 2/3 of the theoretical value, so the torque available for that move should not drop off by more than about 1/3 of the usual torque available. On the other hand, a 12V supply would clearly be inadequate - which explains why I was only able to achieve 150mm/sec before I upgraded the printer to 24V.

I have put a spreadsheet to do the calculation the other way (i.e. work out the speed at which torque starts to drop off) at https://www.dropbox.com/s/5z66rgjc8gptn5....

### General recommendations

- Unless you will be using external stepper motor drivers, choose motors with rated current of at least 1.2A, and at most 2.0A for the Duet 0.6 and Duet 0.8.5, or 3A for the Duet 2.
- Plan to run each stepper motor at between 50% and 85% of its rated current.
- Size: Nema 17 is the most popular size used in 3D printers. Nema 14 is an alternative in a highly-geared extruder. Use Nema 23 motors if you cannot get sufficient torque from long Nema 17 motors.
- Avoid motors with rated voltage (or product of rated current and phase resistance) > 4V or inductance > 4mH.
- Choose 0.9deg/step motors where you want extra positioning accuracy, e.g. for the tower motors of a delta printer. Otherwise choose 1.8deg/step motors.
- If you use any 0.9deg/step motors, or high torque motors, use 24V power so that you will be able to maintain torque at higher speeds.
- If using a highly-geared extruder (for example, an extruder that uses a flexible drive cable to transmit the torque from the motor to a worm reduction gear), use a short low-inductance 1.8deg/step motor to drive it.

## Stepper Driver Numbering

Drive numbers used in G-code correspond to the following driver labels on the board(s):

Drive number | Board Label | Note |
---|---|---|

0 | X | |

1 | Y | |

2 | ZA ZB | Two headers wired in series |

3 | E0 | |

4 | E1 | |

5 | E2 | On Duex 5 |

6 | E3 | On Duex 5 |

7 | E4 | On Duex 5 |

8 | E5 | On Duex 5 |

9 | E6 | On Duex 5 |

10 | n/a | On LCD_CONN header |

11 | n/a | On LCD_CONN header |

To see the exact location of the pins check the Duet wiring diagrams

## Connecting stepper motors

### Using the internal drivers

The Duet 2 WiFi, Ethernet and Maestro all have 5 on board stepper drivers.

To connect stepper motors to the internal drivers, refer to the wiring diagram at Duet 2 Wiring Diagrams or Duet 2 Maestro Wiring Diagram. The pinout of each stepper motor connector is the same as for other popular 3D printer electronics.

Note: **it is highly recommended that the stepper motor casings be grounded**, especially in belt-driven printers. Otherwise, motion of the belts causes static charge to build up, which eventually arcs over to the windings. If the motors are screwed to a metal frame, grounding the frame is sufficient.

Each stepper motor connector has four pins. You must connect the two wires for one phase of the stepper motor between the two pins at one end of the connector, and the wires for the other phase to the two pins at the other end.

#### Identifying the stepper motor phases

Here are two ways you can pair the stepper motor wires into phases:

- Use a multimeter. There should be a few ohms resistance between two wires that belong to the same phase, and no continuity between wires that belong to different phases.
- With the motor wires not connected, spin the spindle between your fingers. Short two of the wires together, then spin the spindle again. If it is much harder to spin than before, those two wires belong to the same phase. Otherwise, try again with a different pair of wires shorted together.

#### Duet 2 (WiFi, Ethernet and Maaestro)

If you have two Z stepper motors, connect them to the ZA and ZB connectors. These connectors are wired in series, which is better than wiring them in parallel for most types of stepper motor used in 3D printers.

If you have only one Z stepper motor, plug it in to the ZA connector, and plug two jumpers into the ZB connector. Duet 2 boards are normally supplied with these jumpers already fitted.

#### Duet 0.6 and 0.8.5

If you have two Z stepper motors, then for the types of motors commonly used in RepRaps (i.e. with rated current in the 1.2 to 2.0A range), it is better to connect them in series than in parallel. Google "wiring stepper motors in series" for instructions on how to do this for example:

http://www.instructables.com/id/Wiring-Y...]

### Using more than one motor on an axis with a separate driver for each motor

Use the M584 command (see http://reprap.org/wiki/G-code#M584:_Set_...) to specify which drivers are used for the axis concerned. You must be using RepRapFirmware 1.14 or later.

### Using external drivers

See the using external drivers page for more details

If your motors are rated above about 2.8A and you are using the Duet 2 (Wifi or Ethernet), or above about 2A and you are using the Duet 2 Maestro, or obsolete Duet 0.6 or 0.8.5, or if they need higher voltage than the Duet can provide, then you need external stepper motor drivers. These generally have optically isolated step/dir/enable inputs. For example, stepper motor drivers rated at up to 5A using the TB6600 stepper driver chip are widely available on eBay.

If the drivers require no more than about 2mA @ 3V on the step, dir and enable inputs, then you can drive them directly from the expansion connector of the Duet. See the Duet 2 Wiring Diagrams for the expansion connector pinouts. Otherwise, you should use 3.3V to 5V level shifting ICs such as 74HCT04 to boost the signal level to 5V and drive them. You can use the Duet Expansion Breakout Board for this purpose.

To remap the X, Y or Z motors to external drivers in RepRapFirmware 1,14 or later, use the M584 command (see M584 Gcode). The Enable signals on the expansion connector are active low by default but you can change this using the M569 command (see M569 Gcode). You can also set a minimum step pulse width in the M569 command (try 1us or 2us when using external drivers), and configure the direction.

## Checking connected stepper motors

Before conducting this step, temporarily alow axis movement without homing by navigating to the G Code console and entering: M564 S0 H0

Navigate back to the Machine Control page. At this time, we will check the operation of our stepper motors.

Move each stepper motor, individually, 1 mm in each direction.

Note that a stepper can't be moved before homing, unless the M564 command is used to override this safety default.

## 7 Comments

Hello a pleasure to greet you. I was reviewing the numbers on configuration of external drivers, but it is very brief and I am something new but my input project is to make a 3D printer of high precision and speed with low vibration etc. then for this I will use stepper motors NEMA17 Stepper Motor 1.5A 0.52Nm 2Phase 48.3mm (1.9in.), model MS17HA6P4150) 0.9 Deg Moon's brand the same brand has a driver with emulation but I have no idea what it would be like to do wired to configure in the Duet Wifi, although I understand clearly that I must use the pin com LCD, you with more experience my question would be the following, how much performance can I get to the SR3-Mini controllers from Moon's with the Duet Wifi, can give me that high precision with reduced inertia and precise control? and how would the connection between this and the Duet Wifi?

glennholguin - Reply

Please use the Duet3D forum for support :https://forum.duet3d.com/

Tony -

Would be great if you could point out that the mH must be /1000 for H in the calculation provided for INDUCTANCE. Thanks for this great practical summery!

Lucas Bahle - Reply

I noticed that the spread sheet was a bit different than the provided calculations…seemed odd. Also, where did you get all the calculations from? Is there a reference textbook you used?

Nohtal Partansky - Reply

So I’m playing with Duet RepRapFirmware configuration tool. I’m driving my nema23 with external drivers on expansion board. I got a little confused that It only allows up to 2A. Does it matter on this settings if I’m driving it on external drives? Also Duet said their drives are capable of 2.8A, this is throwing it off.

Could it be because the board is using 24V and motors usually runs 3-4V?

Nam Le - Reply

Please use the Duet3D forum for support :https://forum.duet3d.com/

Tony -

Are there any recommendations for “closed loop”? steppers?

Jim Barber - Reply