In electricity generation, a generator is a device that converts mechanical energy to electrical energy for use in an external circuit. The source of mechanical energy may vary widely from a hand crank to an internal combustion engine.