An electric motor is an electromechanical device that converts electrical energy into mechanical energy. Most electric motors
operate through the interaction of magnetic fields and current-carrying conductors to generate force. The reverse process,
producing electrical energy from mechanical energy, is done by generators such as an alternator or a dynamo; some electric
motors can also be used as generators, for example, a traction motor on a vehicle may perform both tasks. Electric motors
and generators are commonly referred to as electric machines. Read more on wiki.
An electric motor converts electric energy into mechanical energy that can be used to do work. In the experiment we first use DC current to flow through the wire. Remember that DC current flows in only one direction unless there is a switch to reverse its direction. When the current is first turned on, the like magnetic poles are near each other. Recall from past experiments that like magnetic poles repel each other, and they are forced to move away from each other.
Since the electromagnet is free to move, its south pole moves away from the south pole of the fixed magnet. However, as it rotates it moves closer to the north pole of the fixed magnet and is pulled toward it by an attracting force because unlike magnetic poles attract each other. When we reverse the direction of the current flow, the location of the poles change places, and again, you have two like poles near each other. This arrangement causes the electromagnet to rotate again as the like poles are forced away from each other and the unlike poles attract each other. Then, again, the movement stops until the current is reversed and the magnetic poles in the electromagnet change places another time.