As we've already discussed, a generator converts mechanical energy into electricity. A motor works on the same principles, but in the opposite direction -- it converts electrical energy into mechanical energy. To do this, a motor needs a special kind of magnet known as an electromagnet. In its simplest form, this consists of an iron bar wrapped in a coil of wire. If you pass an electric current through the wire, a magnetic field is formed in the iron bar, and it becomes a magnet, with definite north and south poles. Turn off the current, and the magnetic properties disappear.
By themselves, electromagnets are useful things. You can use them to pick up metal objects, carry the objects somewhere and then drop them by just turning off the power. For example, roofers use them to pick up nails that have fallen by accident into a homeowner's yard. And wrecking yards have cranes with built-in electromagnets strong enough to pick up and move entire cars.
Electromagnets are especially useful when they're placed on an axis between two stationary magnets. If the electromagnet's south pole is situated against the south pole of one stationary magnet and its north pole against the north pole of the other stationary magnet, the electromagnet will rotate until opposite poles line up. This wouldn't be very helpful, except the polarity of electromagnets depends on the direction of current flow. Pass electric current in one direction, and the magnet's north pole will be on one side; reverse the current flow, and the north pole will be on the opposite side. In motors, a device known as a commutator reverses the direction of flow of electric current. As the poles of the electromagnet flip back and forth, the magnet is able to rotate without interruption. This is a brief explanation of course, so you may want to read How Electric Motors Work for all of the details.
As it turns out, the mechanical energy created in an electric motor can be put to good use in a variety of machines. Many tools in your garage, appliances in your house and toys kids play with rely on motors. Some of these motors require a large current to operate. Others, such as small DC motors used in robots and models, need very little voltage or current to perform efficiently. We'll continue our conversation about voltage and current in the next section.