A coil of wire is turned inside a magnetic field, which induces a magnetic field, and hence current, in the coil of wire. The coil is connected to a commutator which switches the connections every half-turn. This causes the induced current in the external circuit to be in one direction (d.c.).