Solar panels and hydrogen fuel cells both generate electricity, but when speaking of generators, most people are referring to fuel-powered engines that convert mechanical energy to electrical energy. These generators can be compact enough to supply electricity for a single appliance or large enough to power an entire city. Mechanical generators, both large and small, rely on electromagnetic induction, a phenomenon associated with Michael Faraday, the English physicist who discovered it in 1831.
Faraday discovered that a changing magnetic field perpendicular to a conducting wire produced a voltage in the wire. If the wire forms a closed circuit, a current will flow through it. The corollary is that current flowing through a conductor produces a magnetic field, which is the principle behind electromagnets. When the wire is wrapped into a coil, Faraday was able to determine that the induced voltage -- and hence the amount of electrical current -- is proportional to the number of turns in the coil as well as the rate of change of the magnetic field.
Using Induction to Generate Electricity
Most generators consist of two components that, in combination, produce electricity. The current is generated in the stator, a solid iron core around which is wound a conducting metal coil that connects to the output terminals of the generator. A rotor, or armature, spins around the stator and produces the changing magnetic field. The rotor in smaller home generators usually has permanent magnets, but in larger generators, such as those in power stations, the magnetic field is produced by secondary induction coils. Each time the rotor completes a half-rotation, the polarity of the generated electricity changes, and the generator produces alternating, or AC, current.
Converting Mechanical Energy
In personal-use generators, which supply up to 5 kW of electricity, the power to spin the rotor usually comes from a small gasoline-powered engine; larger generators capable of producing 10 kW or more may have diesel- or propane-powered engines. Generators that supply power to entire cities often use steam to spin large turbines, which in turn spin the rotors that produce electricity. The heat to produce the steam often comes from the combustion of fossil fuels, such as coal, or from nuclear fission. Hydroelectric generators rely on the force of water falling over a natural waterfall or through the gates of a man-made dam to spin the turbines.
Generating Renewable Energy
Hydroelectric plants and wind turbines are two example of a renewable energy sources -- they don't rely on resource that can be depleted, such as fossil fuels. Geothermal generators use the earth's heat to create steam that spins turbines. Solar generators don't rely on electromagnetic induction; instead, they rely on the photovoltaic effect, whereby sunlight shining on a semi-conducting surface generates an electrical voltage. Unlike a spinning rotor or turbine, a solar panel produces direct current, or DC, electricity. Solar systems usually include an inverter to convert DC to AC current for use in conventional electrical systems.