# Semiconductor

{ For a physicist there's probably quite a lot of simplification, this is written from the limited point of view of a programmer. ~drummyfish }

Semiconductors are materials whose electrical conductivity varies greatly with conditions such as temperature, illumination or their purity, unlike insulators who generally don't conduct electricity very well (have a great [resistivity](resistivity.md)) and conductors who do. Semiconductors, especially [silicon](silicon.md) (Si), are the key component of [digital](digital.md) [electronic](electronic.md) [computers](computer.md) and integrated circuits. Other semiconductors include germanium, selenium or compound ones (composed of multiple elements).

Semiconductors are important for computers because they help implement the [binary](binary.md) logic circuits, they can behave like a switch that is either on (1) or off (0). Besides that they can serve e.g. for making measurements (a component whose resistivity depends on its illumination can be used to measure amount of light by measuring the resistivity). Especially important electronic components based on semiconductors are the **[diode](diode.md)** (lets current flow only one way)  and **[transistor](transistor.md)** (a purely electrical "switch" that can be made extremely tiny).

Normally semiconductors don't conduct so well at room temperature (they conduct better at higher temperatures, unlike metals), but their conductivity can be increased by so called **doping** -- introducing small impurities of other elements. By doing this we can get two types of semiconductors:

- **N type**: By adding e.g. an arsenic atom to a grid of silicon atoms we get an extra free electron because arsenic has 5 outer electrons while silicon has 4. Arsenic binds its 4 electrons with neighboring silicon atoms (with so called covalent bond, sharing pairs of electrons), but will have one unbound electron, which thanks to not being bound can move easily and help conduct electricity (note that when the electron does move away, arsenic will still want to get another electron because it will become positive charged, but the fifth electron is simply always more "loose" thanks to not being bound). In this type of semiconductor we have negative particles, the **electrons**, moving around.
- **P type**: By similarly adding e.g. an boron atom to a silicon grid, we get a similar situation; boron only has 3 outer electrons, so it will only bind to 3 silicon atoms, leaving one the bond with one silicon incomplete, forming a **hole**. This hole can be seen as a [virtual](virtual.md) positively charged particle, it is simply a lack of electron. An electron can temporarily jump in this hole but will want to move away as boron doesn't want it there. In this type of semiconductor we can imagine the holes moving around (even though physically only electrons are moving, of course).

If we connect a P and N type semiconductors, we get so called **PN junction** which only conducts current one way and is used in diodes and transistors. After putting P and N materials together, at the boundary some electrons from the N type material fill the holes in the P type material which creates a small *depletion region* of certain width. This region is an electric field that's negative on the P side and positive on the N side (because negative electrons have moved from N to P). If we connect the PN junction to a voltage source, with P side to the positive and N side to the negative terminal, we create an opposite electric field which will eliminate the depletion region and allow the flow of current. Connecting the sides the other way around will result in increasing the width of the depletion region and blocking the current flow.