SelectingMotors

There are many types of motors in many sizes. Choosing the right one for each part of your project is critical for getting the performance you want without putting yourself through too much work.

Parameters

Power type

Does this motor take AC? DC? Carefully controlled DC? Something else?

Torque

Torque is rotational force. So this is the measure of how much force the motor can apply to the shaft (and thus whatever is connected to it). This will most likely vary somewhat depending on the speed the motor is run at, but there will be a known relationship for the motor to define it.

Stall torque is the amount of torque the motor can apply when not moving (aka all of its energy is going into providing torque, and not rotating the shaft).

Speed

How fast can the motor go?

Positioning

Is it easy to set the motor to a known position, or drive it at a known speed. Most motors are easy to do for one, but difficult (or at least more difficult) to do for the other.

DC brushed, servomotors, and AC brushless motors are good at being set to a speed. Steppers, and servos are good at being set to a position.

Motor Types

DC Brushed

This is a simple motor that is easy to control. It has two wires (usually red and black), you apply enough voltage across them, and it spins. More voltage gives you higher speed (up to its top speed), and if you reverse the voltage, the motor spins the other way.

This is done easiest with a motor driver board, which will include an H-bridge (which lets you control motor direction), and the necessary protection circuitry (usually a few diodes).

To control a DC brushed motor (with a driver board), you will need 1 or 2 digital output pins, and one PWM output pin. The PWM pin will be hooked up to the enable input, which will then be the speed control. If there is 1 other pin, it will be direction (a high voltage is one direction, and a low voltage is the other). If there are two pins, they will either be direction and brake (where one pin is direction, like above, and the other enables the brake to stop the motor instantaneously), or L1 and L2 (when L1 is high and L2 is low the motor goes one way, L1=low and L2=high for the other way, and both high to brake). You can usually easily tell how your driver board is configured to take inputs, because the pins will be labeled (P, D, B) or (E, L1, L2). The labels may be slightly different, but there will be some Enable/PWM input, and either Direction+Brake or L1+L2 (and it may be some other letter, but you'll get the *1, *2 naming scheme).

These are useful as drive motors (for wheels) when you need high speed or high torque.

Stepper

These motors move by rotating the shaft to one of many positions. The motor steps between them (hence the name stepper). These motors are good at easily rotating to a known position, including going full circles (which servos can't do). However, they are controlled open loop, meaning that you probably don't have feedback as to where the motor shaft is, and its position is known based on where you have told it to step. This becomes a problem because you can't have high torque loads on the motor, because it can be forced to skip steps (which then creates position error).

Controlling a stepper can be done directly with a microcontroller, but this is probably a bad idea, because the microcontroller will most likely not be able to source enough current to drive it (or any real load). You should use a driver board, which lets you send simple direction and step signals. Direction determines the direction of the steps, and the step pin will cause the stepper to take one step every time you transition the pin low to high. If this is not working, you may be stepping it too fast, and the motor is not able to keep up with you toggling the step pin. Insert some delays between bringing the pin high and low.

Note: If you are using a driver board that takes direction and step signals, DO IT MANUALLY. The Arduino Stepper library will not help you!

These are good for moving a load with low torque requirements to a known position. They are often used as the axis motors on 3D printers.

Servo

Servos are easy to control, because there is a common signaling for all of them. Servos can be signaled to go to any position in their (usually limited to) 180 degree range. They will usually have a 3-wire cable coming out of them, with the classic colors being White-Red-Black or Yellow-Orange-Brown. White/Yellow is the signal, Red/Orange is VCC, and Black/Brown is ground. They are usually found in the 5V or 3.3V variety. Their positions are described on the range of 0 to 180 degrees, with 90 being the center (duh) and home position.

If you are dealing with servos and want to learn about how their signaling protocol works, read the page on ServoSignaling.

Servos are fairly popular, so there are usually libraries for controlling them. For example in Arduino:
myservo = Servo.attach(9); // Create a servo with a signal wire attached to pin 9.
myservo.write(90); // Set the servo to the 90 degree position

Some servos may not have their endpoints (0 degrees and 180 degrees) at the normal signal points. Or the clock on your microcontroller is not very accurate. If you set your servo to the end of its expected range (0 degrees or 180 degrees) and the servo makes an angry, growling sound, change the position you send it until it stops sounding angry. This new value you've discovered is the limit to where you can drive this servo with this microcontroller. Even though the values you send it are now a few degrees smaller in range, you are still getting the full range of the servo.

These are useful for arms, hand, and other mechanical actuators where you want to easily control it to a position.

Continuous rotation servo

Continuous rotation servos are controlled the same way as servos (hence the name), but instead of controlling position, you control speed. When you send the 90 degree signal, it is at stop, 0 is full reverse, and 180 is full forwards.

These are useful as drive motors (for wheels), when you want a self contained solution to control speed.

AC Brushless

These motors have three wires, and give you the highest speeds and torques. These are the types of motors used in the mill and lathe. You will need to get a motor driver to control them. You can find motor drivers that will be controlled via servo signaling (which makes your life easier).

DC Brushless

These motors are faster and more efficient than DC brushed motors, but definitely need a driver board. They work by having the current through the motor switched back and forth as it rotates, which requires the motor driver sensing the current and voltage in the motor as it drives it.