Optical detectors convert optical signals to electrical signals. Semiconductor-based photodiodes and phototransistors are commonly used, with photodiodes being used almost exclusively in fiber optic systems. The two main types of photodiodes are PIN photodiodes and avalanche photodiodes (APDs). PIN photodiodes consist of a wide, intrinsic semiconductor region sandwiched between p-type and n-type semiconductor regions. In a PIN photodiode, incident light generates electron-hole pairs which are separated by the electric field, resulting in a photocurrent. APDs use the avalanche effect to multiply the photocurrent, providing higher gain but greater noise.