Thermoelectrics is the direct conversion of heat into electricity and vice versa. This phenomenon was first observed in 1821 by Thomas Seebeck, who found that when a circuit was made from two dissimilar metals, a voltage developed across the junction of the two metals. The current produced by this voltage is known as the Seebeck effect. In 1834, Jean Peltier discovered that when a current was passed through certain junctions, heat was either absorbed or released. The direction of heat flow depended on the direction of current flow and the type of junction. These effects are now known as the Peltier effect.
The figure below shows a schematic representation of a thermoelectric device. It consists of two dissimilar conductors (A and B) separated by an insulator (I). When a temperature difference exists between the two conductors, electrons will flow from the hot conductor to the cold conductor, producing an electric current. If we reverse the direction of temperature gradient, then electron flow and hence current will also be reversed.
When placed in contact with each other, two dissimilar materials form what is called a heterojunction. At this junction there is always an energy barrier for electrons to overcome before they can cross from one material to another. This energy barrier results in what is called an electrochemical potential difference between the two materials. When there is a temperature difference between the hot side and cold side of a thermoelectric device, there will also be an electrochemical potential difference created across that device due to differences in their thermal energies (i.e., their temperatures). Consequently, there will be an electrical potential gradient established along the length of the device from hot end to cold end which drives electrons from hotter regions to colder regions just like any other electric field does; this establishes an electric current flowing through such devices which can be harnessed for various purposes including power generation or refrigeration/cooling applications depending on how they are configured/designed