You are going to use the Arduino board to control motors. Many electronics that have moving parts contain motors, e.g., printers, car toys, electric toothbrushes. While there are many different types of them, you will mostly find the following three types of motors:
DC motors
If you need something to spin, but do not need precision, this is the motor you want to use. The fan inside the computer you are using is an example of a DC motor. You can also find a really small one in your mobile phone. It is a DC motor that causes the vibration by rotating an unevenly weighted disk.
A DC motor can run freely in both directions, but it is very difficult to control when it comes to speed or position. It is not easy to make it stop with exact precision. It comes with two wires: power and ground. Note that generally, an Arduino digital pin cannot power a DC motor.
The cables can be connected to GND or to a digital pin. Set the digital pin to HIGH to make it move and to LOW to make it stop. To rotate counterclockwise, reverse the wire connections.
It is possible to control the speed of a DC motor using a transistor and a technique called pulse width modulation (PWM). With several transistors arranged on an H-bridge, you can even control the direction without physically changing the connections.
Stepper motors
Stepper motors can be found in electronics where high precision is important such as scanners and printers. A stepper motor, in contrast to the DC motor, can be very precise with both position and speed.
A stepper motor’s full rotation is divided into equally big steps and you can control the motor to stop at each of these steps. The steps are measured in degrees, usually 1.8, 3.6 or 7.2. The smaller the steps, the more precise. This makes it very useful when repeated positioning is needed. However, stepper motors will never be very fast compared to a DC motor.
It generally has 4 or more wires and usually needs more than 5 volts to work. This means it can not be powered through an Arduino, but you must use an external power supply.
Servo motors
Servo motors are often used in robotics and toys. These are the type of motors that you are going to use for your project because they are simple to connect and to control from an Arduino. They have three wires: one for power, one for ground, and one for the control signal.
There are two types: standard servo and continuous rotation servo. The standard servo can rotate 180 degrees with precision like the stepper motors. The continuous rotation servo is similar to a DC motor and can spin in both directions, but not as fast. You can control both the speed and the direction without the use of transistors.