A photodiode is a semiconductor device that converts light (photons) into a precise, linear electrical current. Unlike a photoresistor (LDR) which merely changes resistance based on light intensity, a photodiode generates a measurable current proportional to the exact number of photons striking its active area. This linearity and high-speed response make it the mandatory choice for precision optical applications, from pulse oximeters to fiber optic receivers and laser rangefinders.

The Short Answer: Symbol, Pinout, and Core Function

On a schematic, the photodiode symbol looks like a standard PN junction diode (a triangle pointing to a vertical bar) but with two arrows pointing inward toward the junction, representing incoming light. This is the exact opposite of an LED, where the arrows point outward to represent emitted light.

Physically, a photodiode has two terminals:

  • Anode (A): The positive terminal (P-type material). In through-hole packages, this is typically the longer lead.
  • Cathode (K): The negative terminal (N-type material). In through-hole packages, this is the shorter lead. On SMD packages (like the Vishay BPW34), the cathode is marked with a dot, a bevel, or a thick line on the package edge.
Bench Tip: If you are salvaging photodiodes from old optical mice or smoke detectors and the leads are clipped, use the multimeter diode-test trick outlined in the testing section below to reliably identify the anode and cathode without guessing.

Photovoltaic vs. Photoconductive: Biasing and Operation Regions

To use a photodiode correctly, you must choose a biasing mode. The way you wire it dictates its speed, noise floor, and linearity. Here are the operation regions you need to know:

Operation Region Bias Voltage Dark Current Response Speed Best Use Case
Zero Bias (Photovoltaic) 0V (Unbiased) Zero (No noise) Slow (High junction capacitance) Precision low-light DC measurement, solar cells, energy harvesting
Reverse Bias (Photoconductive) -5V to -30V (Cathode positive) Low (nA to pA range) Fast (Depletion region widens, lowering capacitance) High-speed data links, LIDAR, pulse oximetry, AC light sensing
Forward Bias > 0.4V (Anode positive) High (mA range) N/A Never use. The diode conducts normally, drowning out any photocurrent.

Why Reverse Bias? Applying a reverse voltage widens the depletion region inside the silicon. This does two things: it reduces the junction capacitance (allowing the diode to react to nanosecond light pulses) and it sweeps electron-hole pairs across the junction faster, improving linearity at high light levels. According to the Vishay BPW34 datasheet, applying a 5V reverse bias drops the junction capacitance from roughly 70pF down to 45pF, significantly increasing bandwidth.

Selecting and Testing: Safe Defaults and Multimeter Diagnostics

Do not buy random 'light sensors' off Amazon if you need predictable data. Stick to these industry-standard, safe-default part numbers that have well-documented spectral responses and stable supply chains:

  • Vishay BPW34 (Broadband Visible/NIR): The undisputed hobbyist and prototyping champion. Large 7.5mm² active area, peak sensitivity at 850nm (but responds well to visible red/green). Costs ~$1.50. Max reverse voltage: 50V.
  • OSRAM SFH203 (Fast Visible/IR): Smaller active area but much faster rise/fall times (5ns). Ideal for IR remote decoding or high-speed encoders. Costs ~$2.00. Max reverse voltage: 50V.
  • Hamamatsu S1226-18BQ (Precision UV-Vis): When you need laboratory-grade linearity and UV sensitivity. Low dark current (10pA max). Costs ~$15.00. Max reverse voltage: 20V.

How Photodiodes Fail

Photodiodes rarely fail catastrophically unless you exceed their maximum reverse voltage (causing avalanche breakdown) or solder them with excessive heat. The most common failure modes are shunting (an internal short causing zero resistance in both directions) and dark current drift (where the diode leaks excessive current in the dark due to moisture ingress or lattice damage, ruining low-light sensitivity).

Testing a Photodiode with a Multimeter

Follow these numbered steps to verify a photodiode on your bench:

  1. Forward Bias Check (Diode Mode): Set your DMM to diode test. Place the red probe on the Anode and black on the Cathode. You should read a forward voltage drop between 0.3V and 0.6V (depending on the silicon/InGaAs material). Swap probes; it should read 'OL' (Open Loop).
  2. Photovoltaic Check (Voltage Mode): Set your DMM to DC Volts (mV range). Red probe on Anode, black on Cathode. Shine a bright flashlight or laser directly onto the die. The meter should read a positive voltage (typically 100mV to 350mV open-circuit). If it reads 0V under bright light, the junction is dead.
  3. Dark Current Check (Resistance Mode): Set DMM to the highest resistance range (MΩ). Cover the diode completely with your hand or black tape. Reverse the probes (Red on Cathode, Black on Anode). It should read 'OL' or >20MΩ. If it reads a low resistance in the dark, the diode is leaky and will introduce massive noise into a high-gain circuit.

Practical Application: Building a Transimpedance Amplifier Circuit

A photodiode outputs current, not voltage. If you connect it directly to an Arduino or ESP32 analog pin, you will get erratic, useless readings because the ADC measures voltage. To convert the photodiode's tiny current (nanoamps to microamps) into a readable voltage, you must build a Transimpedance Amplifier (TIA). The Texas Instruments TIA design guide outlines the exact compensation required to keep these circuits stable.

Component List and Values

  • Photodiode: Vishay BPW34
  • Op-Amp: Microchip MCP6001 (Rail-to-rail, 3.3V/5V compatible, low input bias current)
  • Feedback Resistor ($R_f$): 1 MΩ (Sets the gain: 1V output per 1µA of light current)
  • Feedback Capacitor ($C_f$): 15 pF (Crucial for preventing high-frequency oscillation)
  • Bias Voltage: 5V (from your microcontroller's 5V rail)

Wiring Steps

  1. Connect the MCP6001 VDD (Pin 7) to 5V and VSS (Pin 4) to GND.
  2. Connect the non-inverting input (Pin 3) directly to GND. This sets your 'dark' baseline at 0V.
  3. Connect the BPW34 Cathode to the 5V rail (this applies the 5V reverse bias).
  4. Connect the BPW34 Anode to the inverting input (Pin 2) of the op-amp. This node is a 'virtual ground' held at 0V by the op-amp.
  5. Connect the 1 MΩ feedback resistor between the inverting input (Pin 2) and the output (Pin 6).
  6. Connect the 15 pF capacitor in parallel with the 1 MΩ resistor (solder it directly across the resistor leads to minimize stray capacitance).
  7. Route the op-amp output (Pin 6) to your ESP32/Arduino ADC pin.
Debugging Note: If your TIA output is pegged at 5V even in the dark, your photodiode is likely installed backward (forward biased), or your breadboard has flux residue causing a leakage path across the 1 MΩ resistor. Clean the board with isopropyl alcohol.

Frequently Asked Questions

What is the difference between a photodiode and a photoresistor (LDR)?

A photoresistor (like the GL5528 LDR) changes its bulk resistance based on light, requiring an external voltage source and a voltage divider to read. It is slow (response times in tens of milliseconds) and highly non-linear. A photodiode generates its own current proportional to light, responds in nanoseconds, and maintains strict linearity across a massive dynamic range. Use LDRs for simple 'day/night' streetlight triggers; use photodiodes for data transmission, precision colorimetry, or pulse counting.

Can I use a photodiode to measure exact lux levels with an Arduino?

Yes, but it requires calibration. A photodiode's output is measured in Watts per square meter (irradiance) at specific wavelengths, not human-perceived Lux (illuminance). To measure Lux, you must either place a photopic correction filter (which mimics the human eye's sensitivity curve) over the diode, or use a dedicated integrated lux sensor like the Vishay VEML7700 or Adafruit TSL2591, which have the correction filters and ADCs built into the silicon.

Why does my photodiode circuit oscillate or output noisy readings?

Oscillation in a TIA circuit is almost always caused by missing or undersized feedback capacitance ($C_f$). The photodiode's internal junction capacitance interacts with the high-value feedback resistor, creating a pole in the feedback loop that causes phase shift and ringing. Adding a 10pF to 50pF capacitor in parallel with the feedback resistor rolls off the high-frequency gain and stabilizes the loop. Additionally, ensure your op-amp has a low input bias current (like the MCP6001 or OPA380); standard op-amps like the LM741 will inject more bias current than the photodiode generates in low light.

What is a PIN photodiode and when should I use it over a standard PN junction?

A PIN photodiode has an intrinsic (undoped) layer of silicon sandwiched between the P and N regions. This wider intrinsic layer increases the active volume where photons are absorbed, resulting in higher quantum efficiency (more current per photon) and lower junction capacitance (faster speed). The Vishay BPW34 mentioned in this guide is actually a PIN photodiode. For 95% of hobbyist and industrial light-sensing tasks, a PIN photodiode is the correct default choice over a basic PN photodiode.