The photodiode is a p-n junction diode that converts light energy into electrical energy.

A photodiode always works in reverse biased condition. That is the n region of the semiconductor is connected to the positive terminal of the battery and the p region of the semiconductor is connected to the negative terminal of the battery.

When the photodiode is exposed to light, the electrons from n region moves towards the positive terminal and holes from p region move towards the negative terminal. Thus a photocurrent is produced which is proportional to the intensity of light. It is called the photoelectric effect.