General Engineering Introduction/Arduino and Motors/Motor Introduction

Electronic motors are found in kids toys, RC cars, airplanes and helicopters, printers, scanners, and fax machines. They are expensive when purchased, quantity 1, new with manual. This is because the motors are part of a supply chain that is usually just making enough to fill orders for kids toys, etc. Many can be found for sale on the internet, but very few are in stock and the price is high if they are. Often it is easier to purchase the kid's toy and take it apart. The goal is to connect these motors to the arduino and then make something new with them. The goal of this document is to describe what to expect.

DC or Brushed Motors
These are also known as canned motors. Two wires go into them. They often are directly connected to a battery. A switch turns them on. Higher voltages cause them to spin faster. Often geared down in toys, they are designed to spin fast. If turned on and forced to not spin, the motor will heat up, and may even burn up. The motor is made by copper wire covered with clear paint, and wound together in a ball. When the motor heats up too much, the paint turns into smoke, nearby copper wires connect, the motor becomes weaker, the motor heats up more, more smoke comes out, etc. The winding resistance keeps going down. Measure the winding resistance when the motor is new and measure again when there are problems. Speed can be varied by either changing the voltage or pulsing the motor. Most computer controlled DC motors are pulsed. Pulses of a fixed voltage are sent to the motor, usually by an Electronic Speed Controller or ESC. A pulse of 1.5 ms causes no motion. Wider pulses cause faster spinning in one direction. Shorter pulses cause faster spinning in the opposite direction. Eventually, an overstressed ESC stops pulsing and turns one wire on and one wire off, depending on the direction. The motor can be directly pulsed by the arduino. The arduino can also supply power to the motor, but normally this is only a good idea for demonstration purposes. The arduino has a very weak power supply, and attempting to power a motor through it can destroy the arduino. Furthermore, the arduino may not be able to supply the exact correct maximum voltage. For this reason, an ESC is placed between the arduino and the motor.

Three wires of the ESC go back to the arduino. These wires are typically:
 * arduino --> ESC (5 volt pulse of various widths .. pulse width modulation (PWM))
 * arduino --- ESC ground
 * arduino <-- ESC can supply power to the arduino (normally don't want to do this)

The ESC has two wires coming from a battery, and then two wires going to the DC brushed motor. These can be any voltage that maximizes the motor's revolutions per minute (RPM). Ideally the ESC optically isolates the arduino from the DC motor.

Servo Motors


2 wires. Servomechanisms are designed to move to a spot and hold it's position. They are not designed to spin continuously. Used to position print heads in ink jet printers, plotters, scanners. Travel at set speeds. Go to a spot and stop. When stopped and still turned on, will attempt to hold it's position. Forcing it to move in this position can damage the motor. Typically is controlled by a circuit board that counts shadows with an LED and light sensor or has a resistor that changes value depending upon position. Often zooms to one side when powered on to figure out where it is at.

Servo motors are usually mounted on a circuit board. Some have two wires traveling to the circuit board much like between a DC motor and ESC. Attached to the board are wires for motor power and again three wires going to the arduino, the same three wires mentioned above.

The arduino sends pulses to the servo motor much like sending them to an ESC. The pulses have a different meaning. The pulses describe a spot to go to. Within the servo there is a feedback mechanism that counts shadows or turns a variable resistor. The servo circuit board then moves the servo to that spot. It knows when it has reached the spot when a certain number of shadows have past or when the resistance reaches a certain value. The arduino has to keep sending the same position over and over again to hold the motor in a current spot. Short pulses go one direction, long pulses the opposite direction, medium pulse widths go to the middle. Middle is typically 1.5 milli seconds.

Identical model motors vary, so each needs to be calibrated by banging against some edge ... think of the banging noise when an inkjet printer is turned on.

Servo motors are good for robot wheels that have to turn a certain distance then stop. They are good for robots that have to balance themselves somehow. Auto pilots can use these to navigate a hallway. They are not good for spinning propellers like brushed dc motors and brushless motors.

Brushless Motors
3 wires. Brushless motors are more expensive than dc brushed motors. Lots of PC fans are brushless motors. The motor that drives the paper path in laser printers is brushless.

They are built differently than servo or brushed motors. There are no places where metal is rubbing against metal. Brushless motors will last longer, spin faster, and help batteries last longer. They have three wires instead of two. There are two types: inrunner and outrunner.

Inrunner
Brushless inrunners are very similar from the outside to a brushed DC motor in terms of size. They are usually mounted on a circuit board like a servo motor with a gear box. They spin very fast and have to be geared down like a brushed dc motor. They are different than a brushed dc motor in that they are stronger, more efficient and last longer. They can be matched to a wider variety of propellers or loads by adjusting the gearing.

The five wires coming off the circuit board are the same as those coming off the ESC attached to the brushed dc motor and the servo motor circuit board (2 for power in and 3 go to the arduino). The pulses mean the same as the brushless dc motor. The only difference is that at maximum RPM, there are still pulses. There is not one long pulse like the brushed dc motor. The only physical difference is that there are three wires into the motor (you may not be able to see them when it is mounted on a circuit board.)



Outrunner
The outrunner is already the standard motor in laser printers, copy machines, fax machines, scanners, blue ray players, cd players, where a very precise, constant speed is needed. It is also found in model helicopters, RC airplanes and other variable speed applications where there are light weight requirements. It is totally different than all other motors. It appears to be falling apart like a vacuum cleaner motor. You don't need to tear these apart. Look at these wikicommons pictures.

Taking apart a CD player and finding the motor is fairly easy.

Start by turning it upside down and removing the screws holding the bottom plate on.

The screws and plate reveal a retaining ring that pops off easily with knife or screw driver.

After the retaining ring is removed, the entire assembly that spins can be removed. There may be some resistance that feels like removing magnets from each other.

Underneath the cup of all outrunner brushless motors is a series of coils. On some motors, between the coils, are hall effect probes. Hall effect probes detect the spinning magnetic field and provide a pulse out of the brushless motors to the electronics. From this pulse the electronics can precisely control the speed of the motor. Variable speed motors don't necessary have the hall effect probes. The electronics in the ESC pulses the motor to tell it's initial direction and some other feed back system (humans using RC or an autopilot reading accelerometers or gyros adjusts the speed).

Parts of the motor are often attached to a circuit board. Magnets are attached on the inside of the can that spins with the shaft .. sort of like a spinning umbrella.

All brushless motors have a spinning umbrella. Inside the umbrella is a permanent magnet. It looks like one continuous round magnet. However it is more like [http://www.youtube.com/watch?v=F9CPX3EJoN4&feature=player_embedded#! series] of magnets.

Brushless outrunners are always built on a circuit board. This makes them cheaper. The circuit board for this CD motor has no electronics on it. A ribbon cable attaches 11 wires to another controller circuit board. But often the controller is built onto the same circuit board. The circuit boards interface with a controller in two ways. Fixed speed motors have a cable that contains power, inputs (motor on, motor half speed) and an output pulse related to the motors motion.

Variable speed motors typically have no circuitry directly associated with the motor. Instead there are typically three wires coming out that attach to an "Electronic Speed Controller."

ESC
Outrunners and inrunners both use the same ESCs. This ESC is different than that of the brushed DC motor. There are three wires going to the motor instead of two. The wiring between the ESC and the Arduino consists if the same 5 wires. The three wires give the brushless motors more pulling power. Understanding this helps understand stepper motors below.

The two wires of the brushed dc motor can be thought of as forward and reverse. The three wires of brushless can be thought of as 1, 2 and 3. Going forward would be this sequence 1-2, 2-3, 3-1, 1-2, etc. Going backwards would be 1-3, 3-2, 2-1, 1-3, etc. What this means is that one third of the motor is helping maintain momentum while another third is pulling the motor in a new direction.



Stepper Motors
Stepper motors are like a servo motor in that they move to a spot and hold their position. But they can also spin like a DC and Brushless Motor. They can not hold their position as strongly as a servo motor, and they can not spin as fast as a brushed or brushless motor.

They are not controlled through a circuit board or ESC. They have to be connected to the arduino through a motor shield or custom built circuit. They are typically the most expensive.

Stepper motors can have 4, 5, 6, or 8 wires. To use them with the arduino, understanding the internal wiring is absolutely necessary.

The best way to learn the internal wiring is to assume no manual exists, and "discover" the internal wiring.