Types of Motors
Brushed DC Motors
These motors use brushes that rub on a segmented copper ring so that the current through the armature coils alternates as the motor spins. We opened one up in the photo below, so you can see the magnets and coils in the left and the spring-loaded brushes on the right.
Cell Phone Buzzers
- RC Servos
- Gear Motors
Good low-speed torque
- Noise - In addition to the audible whine from the commutator brushes, these motors create a lot of electrical noise which can find its way back into other circuitry and cause problems.
Brushless DC Motors
Radio Control Vehicles
- Industrial Servos
- Hybrid Vehicles
- High-End Gearmotors
Controller - Some types of brushless motors require a separate controller for operation.
- Camera rigs
- Precision Gearmotors
Precise repeatable positioning
Precise speed control
Excellent low-speed torque
Excellent 'holding torque' to maintain position
May need encoder or limit switch to establish a reference position
Subject to missed steps if overloaded
Motors in their elemental form are not always easy to work with. How do you turn 5,000 RPM of raw power into smooth controlled motion? Designing and building your own gear-reduction and/or control system is a lot of work.
Gear train construction ranges from simple plastic drive-trains for toys to beefy metal gear-trains for extra-high-torque applications.
Robot Drive Trains
Radio Control Vehicles
Speed Reduction - Many DC motors simply run too fast to be useful in direct-drive applications.
Increased Torque - A lot of work can be coaxed from a relatively small motor if fitted with a suitable gear train.
The potential downsides of adding a gear train to a motor include:
Friction - This is especially a problem with low-cost plastic gear trains used with low-voltage motors. The extra resistance can make these gear-trains balky at low speeds.
Inertia - This is more of a problem with metal gear-trains. All that additional rotating mass can inhibit rapid acceleration.
Backlash - Any sloppiness in the gear-train tolerances create slack that must be taken up whenever the direction reverses. This can be a problem in precision motion control applications.
The most common and economical type of servo motor in the hobbyist world is the RC Servo. These were originally designed for hobbyist Radio Control systems. But these days they are widely used for all sorts of small-scale projects where moderately precise positioning is required.
Most RC servos provide position control over an approximately 180 degree range. They do not provide speed control or continuous rotation. Inside, an RC servo typically consists of a brushed DC motor with a gear train and a built-in H-Bridge motor driver. A potentiometer attached to the shaft provides position feedback to the control circuit.
RC Servos are available in a wide variety of sizes, torque and speed ratings. Case dimensions and control interfaces are mostly standardized. RC servo case sizes are generally categorized as 1/4 scale, Standard, Mini and Micro.
These motors are simple and economical to drive, either with dedicated servo controllers or with a GPIO pin from a microcontroller.
One problem with RC servos is that there is only feedback to the internal controller. There is no feedback to your program, so you can't be sure that it is performing as expected. Analog feedback servos solve this problem with an extra feedback wire that you can connect to an analog input pin.
The following summary applies to RC Servo Motors suitable for hobbyist use. Industrial servo motors are far more capable - but at a much higher cost!
Radio Control Cars/Boats/Planes
Low cost - (RC Servos) Smaller sized servos can be purchased for just a few dollars.
Variety - There is a wide range of sizes and torque ratings
Simple to control - using logic level pulses from a microcontroller or a dedicated servo controller
Limited range of motion - Most RC servos are limited to 180 degrees of motion.
Moderate precision - Positioning accuracy and repeatability of +/- 1 degree is typical.
- Jitter - The feedback mechanism in the servo will actively try to correct any drift from the target position. This constant adjustment can create annoying twitches while trying to hold a steady position. If this is a problem for your application, consider a stepper motor instead.
Continuous Rotation Servos
The first continuous rotation servos were simply hacked RC servos. Enterprising hobbyists removed the physical hard-stops and hard-wired the controller feedback to think it was always at the middle position. Since the controllers are 'proportional', the motor speed and direction is proportional to the difference between the command position and the measured position. This simple hack results in a miniature self-contained reversible, speed controlled gear-motor!
This modification became so popular, that manufacturers recognized the demand and started offering them too. Since they are based on the ubiquitous RC Servo motor case, the name "Continuous Rotation Servo" stuck.
We have a tutorial on how to 'DIY' a continuous rotation servo here
Robot Drive Trains
Simple to control
- Bearings - The shaft bearings on most CR servos are not designed for heavy loads. So these are best suited to smaller robot platforms.
Neutral Point - Due to variations in the analog circuitry, it can be tricky to find the precise 'neutral' point in the control signal where the motor stops moving. Usually there's a little trim potentiometer you can hand-adjust
Brushed DC Motor Control
If all you need is speed control, you can drive a motor with a PWM pin and a simple transistor circuit. The PWM pin controls the transistor which switches the current to the motor. The higher the PWM duty cycle, the faster the motor will go.
Learn how to build one in Arduino Lesson 13 from the Learning System:
Need to reverse direction too? That requires some more circuitry. The H-Bridge is a 4-transistor circuit that allows you to reverse the current flow to the motor. With an H-Bridge and a PWM pin, you can control both the speed and direction of the motor.
You can learn how to build an H-Bridge circuit using an L293D chip in these Learning System Guides:
Arduino Lesson 15 - DC Motor Reversing.
Raspberry Pi Lesson 9 - Controlling a DC Motor.
The Adafruit Motor Shield V2 is an off-the-shelf solution capable of powering brushed DC motors up to 1.2A continuous (3A peak) at up to 12v.
Learn how to use this shield for DC motors in the Adafruit Motor Shield V2 Guide in the Learning System Guide
The nice thing about the shield is it handles all the PWM speed control on its own, and uses only the two shared I2C pins to control motors. It's also stackable so you can add more shields as desired to control more motors without taking up any more pins.
Brushless DC Motor Control
Some motors have built-in hall-effect sensors that can detect the orientation of the rotor. Controllers for this type of motor require sensor inputs to read these hall sensors.
Other 'sensorless' motor controllers sense the back EMF in the motor coils themselves to detect the rotor position. Most ESC (Electronic Speed Controls) for brushless RC motors use this technique.
Many BLDC motors have integral controllers. Computer fans are one example. These may or may not have PWM inputs or tachometer outputs. If speed control is one of your goals, be sure that you understand the capabilites of the controller.
Brushless motors designed for autonomous and remote control aircraft and vehicles typically require a separate controller. These are typically of the sensorless type and use standard servo type pulsed signals for speed control.
ESCs for brushless motors are rated by amps. Select an ESC rated for at least as many amps as your motor. If you will be driving the motor hard, a 10-20% safety factor in the ESC rating is a good idea.
RC Servo Control
This is pretty simple to do using the Arduino Servo Library. Learn how in Arduino Lesson 14 in the Learning System.
The Motor Shield Guide has a page devoted to Servo Control here:
Stepper Motor Control
The versatile Adafruit Motor Shield V2 has 4 H-bridges and can drive as many as 2 steppers. What's more, it is stackable to control dozens of motors.
Powering your Motors
It is important to choose the right voltage for your power supply. Too low will result in reduced performance. Too high will cause damage to the motor and/or the controller.
- Make sure that your power supply voltage does not exceed the rated voltage for your controller.
- Unless you have a current limiting controller, make sure that the voltage does not exceed the voltage rating of your motor.
Current draw is determined by the motor. As long as you stay within the voltage rating for the motor, the motor will only draw a safe amount of current. To protect the power supply from overload:
- Make sure that the current rating for the power supply is at least as high as the motor.
- Keep in mind that stepper motors are rated 'per phase'. To calculate the current demands of a stepper motor, multiply the current per phase number by 2.
I don't think Edmund Burke was referring to motors when he said that. (In fact, they hadn't even been invented yet!) But his wise words are still applicable.
If you experiment with motors long enough, you will probably burn out one or two in the process. For smaller motors, this usually just means some very smelly smoke. But larger motors and their associated circuitry and power supplies can become a real hazard if you are not careful.
Use caution when handing high current power sources, circuitry and attached machinery.
- Avoid skin contact with live circuits. You can get a pretty nasty shock from a 12v circuit!
- Short circuits in batteries and power supplies can result in fire and/or explosion. Always double-check polarity and use caution when making connections.
- Beware of loose wires and stray tools that can cause short circuits or get caught in moving machinery.
- Wear eye protection.
- Stand clear of moving parts such as robot arms and other machinery when applying power. Unexpected rapid movement can cause injury.
Understand the capabilities of the components you are using and use care when connecting them:
- Make sure that the motor is matched well to the controller. If you try to pull 3A from a controller rated for 2A, you will likely end up with a burnt controller.
- Make sure the power supply is a safe voltage for the controller. Feeding 24v to a controller rated for 12v will kill the controller.
- Make sure that the power supply is the right voltage for the motor. Unless you have a constant-current controller, doubling the voltage will double the current to the motor, risking damage to both motor and controller.
- Don't make connections to live circuits. Make all connections first before powering up the system.
Overloaded wiring can quickly turn red-hot and burn through insulation and whatever else is nearby.
- Always use a wire gauge large enough to handle the expected current. This chart from Georgia State University is a handy reference.
- If your power supply is rated for more current than the wire, add a fuse to protect against short circuits.
- If you are powering several circuits from one large supply, fuse each one separately to protect the wiring.