If you need a fast, linear light sensor for a DIY project, use a reverse-biased photoelectric diode (industry standard term: photodiode) like the Vishay BPW34. For 90% of maker applications requiring light measurement or pulse detection, wire it in photoconductive (reverse-bias) mode with a 5V supply and a 100kΩ load resistor. This configuration gives you microsecond response times and a clean voltage swing that can be fed directly into a comparator or microcontroller ADC.

While photoresistors (LDRs) are fine for slow dusk-to-dawn lighting, they are far too slow for tachometers, optical encoders, or IR data links. This guide cuts through the semiconductor physics and gives you the exact biasing rules, decision trees, and bench-testing procedures you need to put a photoelectric diode to work on your workbench.

Symbol, Pinout, and the Biasing Question

On a schematic, the photoelectric diode symbol is a standard diode (a triangle pointing at a line) with two inward-pointing arrows indicating incoming photons. Unlike a standard rectifier diode where current flows from Anode to Cathode under forward bias, a photodiode generates current in the reverse direction when struck by light.

Pinout Identification: For standard through-hole packages (like the BPW34 or SFH203), the Cathode is indicated by the shorter leg and a flat spot on the plastic housing. The Anode is the longer leg. Always verify with a multimeter before soldering, as some SMD packages reverse this convention.

How to Bias It for the Job

You have two choices when wiring this component, and your choice dictates the circuit's speed and noise profile:

  1. Photovoltaic Mode (Zero Bias): The anode and cathode are connected directly to the load with no external voltage. This is how a solar cell works. It generates its own tiny voltage. Pros: Zero dark current, lowest noise. Cons: Very slow due to high junction capacitance.
  2. Photoconductive Mode (Reverse Bias): You apply a positive voltage to the Cathode and ground the Anode (usually through a load resistor). This widens the semiconductor's depletion region. Pros: Drastically reduces junction capacitance, enabling high-speed operation (nanosecond to microsecond response). Cons: Introduces a tiny 'dark current' (leakage) when no light is present.

The Verdict: Unless you are building a precision scientific instrument measuring femtoamps of light, always use reverse bias (photoconductive mode). The speed and linearity benefits far outweigh the negligible dark current in hobby and industrial-maker applications.

Operation Regions and Spec-Sheet Parameters

When reading a datasheet from Vishay or OSRAM, you will see parameters that dictate how the part behaves in circuit. Here is how those parameters translate to real-world bench expectations.

Parameter Photovoltaic (0V Bias) Photoconductive (5V Reverse Bias) Why It Matters on the Bench
Bias Voltage (V_R) 0V 1.5V to 5V (up to 60V max) Higher reverse voltage widens the depletion zone, speeding up response but increasing dark current slightly.
Dark Current (I_D) 0 nA 1 nA to 5 nA This is your 'zero' baseline. At 5V, 2nA across a 100kΩ resistor creates only 0.2mV of error—easily ignored by an ESP32 ADC.
Junction Capacitance (C_j) 50 pF to 100 pF 5 pF to 15 pF Lower capacitance means higher bandwidth. Crucial for reading >10kHz PWM signals or IR remote pulses.
Response Time (t_r / t_f) 10 µs to 50 µs 10 ns to 100 ns Determines if you can read a spinning encoder disk or just a slow-moving shadow.
Responsivity (R_λ) ~0.5 A/W ~0.6 A/W How many amps of current you get per watt of optical power. Peaks at specific wavelengths (e.g., 900nm for IR).

The Decision Tree: Selecting Your Photoelectric Diode

Don't just grab any light-sensitive component from your bin. Use this decision path to select the exact part number for your application constraints.

If your project requires... And your light source is... Then choose this Part Number Key Spec Advantage
Broadband sensing, laser tripwires, general ambient light Visible to Near-IR (400nm - 1000nm) Vishay BPW34 Large active area (7.5mm²), high sensitivity, ~$0.50.
High-speed IR pulse detection, tachometers, encoders Infrared (850nm - 950nm) OSRAM SFH203 Extremely low capacitance (5pF), sub-microsecond rise time, ~$0.80.
Display backlighting control, matching human eye perception Visible Light (peaks at 555nm green/yellow) OSRAM BPW21R Built-in IR blocking filter, spectral response matches V(λ), ~$1.20.

Default Pick: If you are unsure, buy a 10-pack of BPW34 diodes. They are the '2N2222' of the photoelectric diode world—cheap, forgiving, and sensitive enough to work with standard room lighting and cheap IR LEDs.

Application Circuit: 5V IR Pulse Detector for ESP32

A common mistake is wiring a photoelectric diode directly to a microcontroller's analog pin and expecting a clean 0-3.3V swing. Because the diode generates current, not voltage, you need a load resistor to convert that current to voltage. However, for fast digital pulses (like reading a slotted optical encoder), the analog voltage swing can be noisy and slow to cross the ESP32's logic thresholds.

Here is a complete, robust circuit that converts the diode's current into a clean 3.3V digital square wave using an LM393 dual comparator.

Bill of Materials & Component Values

  • D1: SFH203 (IR Photoelectric Diode)
  • U1: LM393 Dual Comparator
  • R1: 100 kΩ (Load/Bias resistor)
  • R2: 10 kΩ (Voltage divider top)
  • R3: 10 kΩ (Voltage divider bottom)
  • R4: 4.7 kΩ (Pull-up resistor for LM393 open-collector output)
  • C1: 100 nF (Decoupling capacitor for LM393 VCC)

Wiring Procedure

  1. Bias the Diode: Connect the Cathode (short leg) of D1 to the 5V rail. Connect the Anode (long leg) to GND through the 100 kΩ load resistor (R1).
  2. Set the Threshold: Wire R2 (10k) from 5V to the LM393's IN+ pin, and R3 (10k) from IN+ to GND. This creates a 2.5V reference threshold.
  3. Route the Signal: Connect the junction of D1's Anode and R1 to the LM393's IN- pin. When IR light hits the diode, current flows through R1, pulling the IN- voltage below 2.5V.
  4. Pull-up the Output: The LM393 has an open-collector output. You must wire the 4.7 kΩ pull-up resistor (R4) from the OUT pin to the ESP32's 3.3V rail.
  5. Decouple: Place C1 (100nF) physically as close as possible to the LM393 VCC and GND pins to prevent high-frequency oscillation.
ESP32 GPIO Warning: Connect the LM393 OUT pin to an ESP32 GPIO that supports interrupts and ADC (e.g., GPIO 34, 35, or 36 if you want to read it analogly, but GPIO 4 or 5 is better for digital interrupts). Never feed 5V directly into an ESP32 pin; the LM393 pull-up to 3.3V ensures safe logic levels.

Bench Testing: How to Verify and Troubleshoot with a Multimeter

Photoelectric diodes rarely fail unless subjected to electrostatic discharge (ESD) or excessive reverse voltage that punches through the junction. When they do fail, they typically fail shorted (reading 0Ω in both directions) or open (reading OL in both directions). Here is how to test them at the bench using a standard digital multimeter (DMM).

Step 1: The Forward Bias Check (Diode Mode)

  1. Set your DMM to the Diode Test mode (the symbol with an arrow and a line).
  2. Place the red probe on the Anode (long leg) and the black probe on the Cathode (short leg).
  3. Expected Reading: You should see a forward voltage drop between 0.400V and 0.600V. (Silicon PN junctions typically drop ~0.5V). If it reads 'OL', the diode is internally open. If it reads 0.000V, it is shorted.
  4. Reverse the probes. The meter should read 'OL' (infinite resistance).

Step 2: The Reverse Leakage Check (Resistance Mode)

This test proves the photoelectric effect is actually working.

  1. Set your DMM to the Ohms (Ω) mode, selecting the highest range (usually 20MΩ).
  2. Place the red probe on the Cathode and the black probe on the Anode (Reverse Bias).
  3. Cover the diode completely with your hand or a dark cloth. Expected Reading: 'OL' (or >20MΩ). This is the dark resistance.
  4. Shine a bright flashlight or your phone's IR remote directly at the diode. Expected Reading: The resistance should immediately drop, typically into the 10 kΩ to 500 kΩ range depending on light intensity. If the resistance does not change when illuminated, the semiconductor junction is dead.

Safe Default Part Numbers for Your Bin

Stop second-guessing your component selection. Based on current 2026 market availability, pricing, and hobbyist accessibility, here are the definitive defaults to keep stocked in your workshop. These are available from major distributors like Digi-Key, Mouser, and Adafruit.

  • Vishay BPW34 (Through-Hole / SMD): The ultimate general-purpose part. Peak sensitivity at 900nm, but highly responsive to visible light. Cost: ~$0.45 each.
  • OSRAM SFH203 (Through-Hole): The speed demon. Use this for any application involving motors, encoders, or 38kHz IR remote decoding. Cost: ~$0.75 each.
  • Adafruit 4196 (Breakout Board): If you hate soldering tiny SMD components and want a plug-and-play module for a breadboard, Adafruit sells an Adafruit Analog Light Sensor breakout that pairs an ALS-PT19 (which operates on similar photoelectric principles) with onboard biasing. Cost: ~$1.95.

By standardizing on the BPW34 for ambient tasks and the SFH203 for high-speed digital tasks, you eliminate 99% of the optical sensing headaches in DIY electronics. Wire them in reverse bias, use a load resistor to set your gain, and buffer the output with a comparator for bulletproof logic signals.