For 90% of hobbyist and industrial optical switching applications, the Vishay TEFT4300 (high sensitivity, 940nm IR) or the Everlight PT333-3C (general purpose, 10mA max collector current) are the safe default 2 pin phototransistors. To bias one as a digital switch, wire the emitter to ground and place a 10kΩ pull-up resistor from the collector to your 3.3V or 5V logic rail. This simple configuration gives you a clean, active-LOW digital signal whenever the sensor detects light.

Unlike a standard bipolar junction transistor (BJT) where you inject current into a physical base pin, a 2 pin phototransistor uses photon absorption to generate base current. This makes it an excellent, isolated sensor for encoders, break-beam interrupts, and proximity detection. Below is the exact bench data, circuit math, and decision framework you need to design with them reliably.

Pinout, Symbol, and Physical Identification

On a schematic, the 2 pin phototransistor symbol looks like a standard NPN BJT, but the base connection is omitted and replaced by two inward-pointing arrows representing incoming light. Because there is no physical base pin, the device relies entirely on the dark current (leakage) and the photocurrent generated by the base-collector junction.

Most discrete phototransistors come in a 3mm (T-1) or 5mm (T-1¾) clear or black epoxy package. Identifying the pins on a 2 pin phototransistor follows standard LED conventions:

  • Collector (C): The longer lead. Inside the epoxy dome, this connects to the smaller internal die structure.
  • Emitter (E): The shorter lead. The plastic rim of the package will have a flat spot adjacent to this pin.
Bench Tip: If you are working with surface-mount (SMD) variants like the Vishay TEMT6000, the pinout is printed on the silkscreen footprint. Always verify with a datasheet, as SMD optical sensors sometimes integrate ambient light rejection filters that alter the spectral response compared to through-hole parts.

Operation Regions and Biasing the Load Resistor

To use a phototransistor effectively, you must understand its three operating regions. Unlike a MOSFET, a phototransistor's 'on' state is not a fixed resistance; it acts as a current source whose output is proportional to light intensity (measured in mW/cm² or lux).

Phototransistor Operation Regions (Typical 5mm IR Sensor)
Region State V_CE (Collector-Emitter Voltage) I_C (Collector Current) Circuit Behavior
Cutoff Dark (No Light) ≈ V_CC (Supply Voltage) I_CEO (Dark current, typically 1nA - 100nA) Acts as an open switch. Pull-up resistor holds logic HIGH.
Active Linear (Partial Light) 0.4V < V_CE < V_CC Proportional to light (e.g., 0.1mA to 2mA) Used for analog light metering. Voltage at collector varies smoothly.
Saturation Fully Lit (Max Light) V_CE(sat) (Typically 0.2V - 0.4V) Limited by external load resistor Acts as a closed switch. Pulls logic pin LOW.

Calculating the Load Resistor (R_L)

The most common mistake makers make is picking an arbitrary 10kΩ resistor without checking the microcontroller's input leakage or the phototransistor's saturation current. To guarantee the device pulls your logic pin fully LOW (into saturation), use this formula:

R_L = (V_CC - V_CE(sat)) / I_C(sat)

Worked Example: You are using a Vishay TEFT4300 with a 3.3V ESP32 GPIO. The datasheet specifies a typical saturation current of 5mA under high irradiance, and a V_CE(sat) of 0.2V.
R_L = (3.3V - 0.2V) / 0.005A = 620Ω
If you use a 620Ω resistor, the sensor will easily saturate. However, 620Ω draws over 5mA continuously when lit, which is wasteful for battery-powered IoT nodes. Because ESP32 GPIO pins have incredibly high input impedance (they only need microamps to read a state), you can safely increase R_L to 10kΩ or even 47kΩ. The phototransistor will easily sink the 0.3mA provided by a 10kΩ pull-up, pulling the pin well below the 0.8V logic-LOW threshold while saving power.

Complete Application Circuit: 3.3V Logic IR Break-Beam Sensor

This circuit creates a digital break-beam interrupter. When an object blocks the IR beam, the GPIO reads HIGH. When the beam is clear, the GPIO reads LOW. This is the exact topology used in 3D printer filament runout sensors and CNC limit switches.

Materials: Vishay TEFT4300 (Receiver), Vishay TSAL6200 (940nm IR Emitter), 10kΩ 1/4W resistor, 47Ω 1/4W resistor, 100nF ceramic capacitor, ESP32 DevKit.

  1. Emitter Grounding: Connect the short lead (Emitter) of the TEFT4300 directly to the system GND rail.
  2. Pull-Up Resistor: Insert the 10kΩ resistor between the 3.3V VCC rail and the long lead (Collector).
  3. Logic Connection: Wire the Collector node (the junction where the phototransistor and 10kΩ resistor meet) to GPIO 4 on your ESP32.
  4. EMI Filtering: Solder the 100nF (0.1µF) ceramic capacitor in parallel with the phototransistor (Collector to Emitter). This creates a low-pass filter that rejects 60Hz/120Hz flicker from fluorescent room lighting and high-frequency switching noise.
  5. IR Emitter Setup: Wire the TSAL6200 IR LED anode to 5V through the 47Ω current-limiting resistor. Connect the cathode to GND. This provides ~20mA of forward current, creating a strong, invisible beam that easily saturates the receiver across a 10cm gap.

For deeper theory on optical isolation and sensor topologies, the Electronics Tutorials guide on phototransistors provides excellent baseline physics and characteristic curves.

Decision Tree: Selecting the Right Part for Your Build

Not all phototransistors are created equal. A part optimized for high sensitivity will be too slow for data transmission, while a high-speed part might lack the gain to trigger through a dark plastic enclosure. Use this decision matrix to lock in your bill of materials.

Component Selection Matrix
Application Need Priority Spec Concrete Part Pick Key Ratings
General Object Detection / Limit Switches High Sensitivity, Wide Viewing Angle Vishay TEFT4300 V_CEO: 70V, I_C: 50mA, Peak: 940nm
High-Speed Data (IRDA) / Encoders Fast Rise/Fall Time (t_r / t_f) Osram SFH309FA t_r: 5µs, V_CEO: 32V, Peak: 900nm
Visible Light Sensing / Color Sorting Broad Spectrum (400nm - 700nm) Everlight PT333-3C V_CEO: 30V, I_C: 10mA, Clear Epoxy
High Ambient Light Rejection Daylight Blocking Filter (Black Epoxy) Vishay BPW85B V_CEO: 70V, 850nm-950nm passband only

The Verdict: If you are building a standard mechanical interrupter, encoder, or proximity sensor, buy a bulk pack of the Vishay TEFT4300. Its 70V V_CEO rating gives you massive headroom for inductive kickback if you accidentally wire it near a relay coil, and its 940nm peak perfectly matches standard IR remote LEDs.

Bench Testing: How to Verify a 2 Pin Phototransistor with a Multimeter

Phototransistors rarely fail in storage, but they can be destroyed by ESD or by exceeding the maximum Collector-Emitter voltage (V_CEO), which punches through the junction. Here is how to verify a 2 pin phototransistor on the bench using a standard digital multimeter (DMM) like a Fluke 87V or Klein MM400.

Step 1: The Dark Test (Checking for Shorts)
Set your DMM to the Resistance mode (20MΩ range) or Diode Test mode. Cup the phototransistor in your hand or cover it with electrical tape to block all ambient light. Measure across the pins in both directions. A healthy sensor will read OL (Out of Limits) or >10MΩ. If it reads near 0Ω in either direction, the junction is shorted and the part is dead.

Step 2: The Light Test (Checking for Gain)
Keep the DMM in Diode Test mode. Expose the sensor to a bright light source. A standard white LED flashlight works for clear epoxy parts; for black epoxy (IR-only) parts, point a TV remote control at it and hold down a button. Place the Red probe on the Collector (long lead) and the Black probe on the Emitter (short lead). Under bright light, the DMM should display a forward voltage drop between 0.350V and 0.600V. This indicates the photocurrent is forward-biasing the internal base-emitter junction. If the meter still reads OL under a bright flashlight, the internal bond wire is broken (open circuit).

Failure Mode Warning: If your phototransistor passes the multimeter test but your microcontroller circuit is behaving erratically (bouncing between HIGH and LOW), the sensor is likely suffering from slow response times due to operating in the active/linear region instead of saturation. Decrease your pull-up resistor value (e.g., drop from 47kΩ to 4.7kΩ) to force the transistor into hard saturation, which drastically reduces the fall-time of the output signal. For more on optical sensor drive circuits, refer to Texas Instruments Application Note SNOA586 on optical interface design.

By treating the 2 pin phototransistor as a light-activated current sink rather than a simple switch, and by sizing your load resistor to match your logic family's impedance, you eliminate the phantom triggers and slow rise-times that plague most beginner optical builds. Grab a TEFT4300, a 10kΩ resistor, and wire it up—your break-beam sensor will be rock solid on the first power-up.