An electric generator

A electric motor is a device for transforming electrical energy into mechanical energy; an electric generator does the reverse, using mechanical energy to generate electricity. At the heart of both motors and generators is a wire coil in a magnetic field. In fact, the same device can be used as a motor or a generator.

When the device is used as a motor, a current is passed through the coil. The interaction of the magnetic field with the current causes the coil to spin. To use the device as a generator, the coil is spun, inducing a current in the coil.

Let's say we spin a coil of N turns and area A at a constant rate in a uniform magnetic field B. By Faraday's law, the induced emf is given by:

e = -N d(BA cos(q))/dt

B and A are constants, and if the angular speed w of the loop is constant the angle is:
q = wt

The induced emf is then:

e = -NBA d(cos(wt))/dt = wNBA sin(wt) = eo sin(wt)

Spinning a loop in a magnetic field at a constant rate is an easy way to generate sinusoidally oscillating voltage...in other words, to generate AC electricity. The amplitude of the voltage is:
eo = wNBA

In North America, AC electricity from a wall socket has a frequency of 60 Hz. The angular frequency of coils or magnets where the electricity is generated is therefore 60 Hz.

To generate DC electricity, use the same kind of split-ring commutator used in a DC motor to ensure the polarity of the voltage is always the same. In a very simple DC generator with a single rotating loop, the voltage level would constantly fluctuate. The voltage from many loops (out of synch with each other) is usually added together to obtain a relatively steady voltage.

Rather than using a spinning coil in a constant magnetic field, another way to utilize electromagnetic induction is to keep the coil stationary and to spin permanent magnets (providing the magnetic field and flux) around the coil. A good example of this is the way power is generated, such as at a hydro-electric power plant. The energy of falling water is used to spin permanent magnets around a fixed loop, producing AC power.