When the man (or woman!) in the street says "it works by an electric motor", that usually suffices.
If you want to use "an electric motor" in a project controlled by an Arduino, or Pi, or similar, you are going to have to learn a bit more about the group of things all called "electric motors"!
There are the big electric motors, such as the one in my table saw. They run on AC, at 110v or 240v, depending on where you live, and should be run from a microprocessor by the same means as you would run other devices powered by dangerous voltages. In some cases, you should also ask yourself if you really want something that powerful being turned on and off by a computer.
The rest of this is about the various small DC motors
Servo motor/ Stepper motors: I must admit, I was a bit hazy as to the difference between these devices.
You can buy inexpensive things called steppers and things called servos, both in one wire control and in multiple wire control forms.
According to Wikipedia, a servo motor, by definition, has a built in shaft encoder, and some electronics to use it. So I think that we should call the one wire controlled non-simple motors servo motors, and the multi-wire motors steppers. But the precise use of these two terms may be lost forever. Don't be surprised to see a stepper called a servo, or vice versa!
These have been with us for a long time... at least the early 1950s, and well before that, I would guess.
They have two wires. Hook them up to a battery, and the motor goes round and round. Hook them up the other way, and it goes around the other way.
There's a clever thing called an "H-bridge" for controlling this sort of motor, at least as far as "start/stop", and "go clockwise/ go the other way"
You can buy them for 50¢; you can pay $300. The expensive ones have internal gears to let a little motor spinning rapidly, but weakly, turn a shaft slowly but with great torque.
They all suffer (as do the others, but more so these) from not reacting well to being asked to deliver more torque than they were designed to. They spin more slowly, the current rises, and they burn out. There are clever circuits you can use to monitor the current, and shut them down if it becomes excessive.
They all share the disadvantage that, by themselves, they have no way to control how far they've turned. You may need to add a shaft encoder to keep track of how far (or how many times) they have turned, depending on your application.
You can see a project based on a geared instance of one of these simple motors in my curtain closer. It also discusses an H-bridge created with relays. (Today, I would just buy a pre-made one, done in an IC). It does not get into current sensing. It doesn't use a shaft encoder, as such... but it does have a feedback mechanism which tells the controller that the motor has done enough turns.
In a moment I will talk about the features of stepper motors and of servos.
We tend to think about things behaving as they do when in operation. But what about how they behave when they are not powered up? Will the shaft turn when not energised? Will some kind of "initialization" sequence occur (or be needed) when the device powers up?
On bit of qualified good news: In both cases- steppers and servos- I believe it is correct to say that they hold whatever position they have been turned to, at least for as long as power is applied.
Stepper motors are good, in that they will go round and round, which a servo motor won't.
But they are bad, in that they need multiple wires to control them. Even simple ones need four.
I half remember... or is it half MIS-remember? something about some stepper motors being a bit fussy about how they are started up. Do some Googling, if you think a stepper motor may be what your project needs. Check that the "start up" fussing is possible (if necessary) in your case.
I've written a separate page with the details of controlling a simple stepper motor with an Arduino.
Servo motors complement stepper motors (see above). They are good in that they only need one wire to control them, and bad in that they do not go "round and round". Some don't even have a range of 360 degrees.
A servo motor is controlled by a stream of pulses. It turns it's shaft to "face" a particular way depending on the ratio of the time the input signal is "on" to the time the input signal is "off" in the stream of pulses being sent to it, as I have tried to illustrate below....
The cyan rectangles are just the body of the servo motor. The yellow circle represents something attached to the shaft of the motor. (The shaft being perpendicular to the plane of the drawing.) The arrow is "painted" on the "something" attached to the shaft of the motor.
We see the motor as it would arrange itself in response to three different streams of pulses. (The green up/ down/ up/ down lines depict the input signals, the "steams of pulses".
In "A", we see an input signal in which the "on" times of the input are long and the "off" times are short. This causes the motor to rotate far in the counter-clockwise direction.
In "C", we see an input signal in which the "off" times of the input are long and the "on" times are short. This causes the motor to rotate far in the clockwise direction.
In "D", we see an input signal in which the "off" times of the input are about as long as the "on" times. This causes the motor to rotate to about half way between the extremes of which it is capable.
A shaft encoder is less likely to be used in connection with a stepper motor, because we know where it will be from the ratio of ons and offs in the stream of pulses we are sending it.
If you are using a servo motor with an Arduino, there is a library ("Servo") to make your life easy. It deals with generating the stream of carefully timed pulses. Beware: Only some of the Arduino's outputs can be supplied with a stream of pulses. Which outputs are pulse- stream- capable varies from device to device. In other words, the I/O pins you can use for a servo on, say, a Uno, might be different from the pins you can use on, say, a Mega.
The page you are reading is meant as an overview of various "motor" types. I also offer a page about the details of using servos/ servo motors.
Sometimes it's not the toys; it is what you do with them.
With a simple "dodge", you can control multiple servos with just one pulse train, plus some switches. I offer that page not so much because I suspect many readers will want it, but as an example of how a little lateral thinking can take you to fun places.
Page has been tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. Mostly passes.
....... P a g e . . . E n d s .....