Most aircraft require some form of electrical power to operate navigation-, taxi-, landing-, strobe lights, one or more COM and NAV radio's, transponder, intercom and other advanced electronic system of your choice. The electrical system consist of a battery and an alternator or generator on older aircraft. All of this is connected through several meters (kilometers in large aircraft) of wire.
All matter on Earth is made up from molecules and they basically consist of atoms. These atoms are made of electrons, protons and neutrons. And electricity is about the flow of free electrons attracted to protons and repelled by other electrons.
Aircraft used to use generators to generate electrical energy but modern designs use an alternator which is lighter and has more capacity and can generate more power at lower RPMs than the good old generator could.
This page will be a bit technical but for a good understanding of electricity generation it will be necessary that you work your way through.
When a current flows through a wire, a small, but weak detectable magnetic field exists around that wire. If that wire is then formed into a coil, the resultant magnetic field is concentrated. And the lines of magnetic force of the separate wires will then all line up together creating a magnetic field or flux.
The same principle works in reverse too: when a wire passes through a magnetic field a voltage is generated. Form that wire into a coil and rotate a magnet through it and an even higher alternating voltage is generated.
Other forms of generating electricity are: friction (static electricity), heat (thermocouple with two dissimilar metals), pressure (piezoelectric crystals), light (photo/light sensitive voltaic cells) and chemical (battery). They are listing in order of amount of usable power obtainable from these sources from lowest to the highest.
In a generator the magnetic field is generated by a stationary permanent magnet and a coil is rotated within the field (the other way around works too, see Rotax engines). Two slip rings are used to pickup the AC voltage. If a DC voltage is required the slip rings are replaced by a commutator. A commutator makes sure that the same polarity voltage is pickup by the brushes at the same angular position. This will rectify the alternating voltage for use in the aircraft DC system.
In the real world the permanent magnet is assisted by a field coil and this strengthens the field of the permanent magnet, the generator is then said to be self exciting. A drawback with this generator type system is that the aircraft engine RPM must be above 1200 for the generator to start charging the battery with a sufficient amount. During taxi and other low RPM activity the battery will be the main power source, keeping a watchful eye on the ammeter and or voltmeter will therefore be important.
In contrary to the generator, an alternator uses a rotating magnetic field in a stationary coil to generate electricity. This rotating magnetic field can be supplied by a magnet but normally a coil with an iron core is used and it is therefore called an electromagnet.
The ALT part of the main switch energizes the field coil of the alternator with power from the battery until the alternator comes online. The generated voltage is alternating and rectified by internal diodes to an usable DC voltage. This illustrates that if the battery fails while in flight, the pilot switches the ALT switch off and back on to attempt to 'reset' the system. The magnetic field can not be rebuild by the field coil (dead battery) and as a result the alternator will not produce any power, leaving the aircraft without long term electricity.
One of the advantages of the alternator is that it generates more power, even when the engine is idling and it even weighs less than the generator! The lower weight can be explained because there is no heavy magnet inside the alternator. Both types will need a voltage regulator to keep their output constant at 13,8 volt (or 28 volt in those systems), current regulation is by design in the alternator but the generator needs an external one combined with reverse current flow protection (diodes).
There are two types of batteries: primary and secondary cell. The primary can not be recharged where as the secondary can be. Primary cells are: zinc-carbon and alkaline type batteries. Some examples of secondary cells are: lead acid, nickel cadmium, nickel metal-hydride, silver-zinc, lithium-ion (Li-Ion), lithium-polymer (LiPo) and lithium-iron-phosphate (LiFePo4). These are all rechargeable, but each chemistry demands its own charge characteristic and if you do not follow that strictly, the results are more than interesting!
The principle of a lead acid battery is as follows: two dissimilar electrodes are placed in an electrolyte, they are all conductors. The chemicals react with the electrodes and electrons attract to the negative electrode and a shortage of electrons exists at the positive terminal and a voltage of 2.1 volt is build up at each cell. Batteries are made up from 6 cells for a 12 volt model.
Each cell in a NiCad battery has a voltage of 1.2 volt, so you will need 10 cells for a 12 volt model battery. NiCads are based on a strong alkaline for their electrolyte.
The cells in a Lithium battery are between 1,5 and 4 volts depending on the chemistry and charge level of the cell. They have a long life, higher charge density but cost more than ordinary lead-acid batteries and need a special charger. The other advantage is that they weigh much less!
Also known as solar cells, these devices convert photons from any light source hitting the semi-conductor material in the cell and generate electricity. The most commonly known cell is made from silicon in layers (p-n junction) where one is doped in boron and the other with phosphorus. The efficiency of practical solar cells is around 20 - 25%, the physical limit for a single p-n junction cell is know as the Shockley-Queisser limit at 33,7%. This means the power in sunlight (1000 w/m2) can generate a maximum of 337 watt ideally when the sun is at a 90° angle with the cell.
Gliders sometimes use solar panels to recharge their batteries during flight (one example is the Pipistrel Taurus, see image). Large scale solar application for electric aircraft (solar on wings) is not feasible due to the previous mentioned limitations.