Learn Automation with MINATA #16: Photoelectric Sensors — Through-Beam, Retroreflective and Diffuse
Photoelectric Sensors: Through-Beam, Retroreflective and Diffuse
A line counting bottles with a diffuse photoelectric sensor runs perfectly with clear plastic bottles. Switch to a batch of dark-coloured bottles and the count falls short across the board: the dark surface reflects little light, and the sensor cannot "see" the bottle. Nobody changed the program, nobody adjusted the machine — it was simply the wrong type of photoelectric sensor for the object to be detected. With a through-beam type, the bottle colour would never have mattered.
The photoelectric sensor is the most common "eye" in automation: detecting present/absent, counting, positioning, checking presence. But "photoelectric sensor" is not one thing — there are three types, with markedly different reliability, range and mounting. Choosing the right type for the object and the environment matters more than choosing the brand.
This article distinguishes the three types (through-beam, retroreflective, diffuse), explains how to choose by object and distance, then covers the electrical side: NPN/PNP output, light-on/dark-on modes, background suppression (BGS) and wiring to the PLC.
This article states principles of selection and use. The ratings (detection range, protection class, light type) must follow the real sensor catalogue and the mounting environment.
The common principle
Every photoelectric sensor has an emitter (an infrared, red or laser LED) and a receiver (a photodiode/phototransistor). The receiver measures how much light it receives and compares it against a threshold to decide "object present" or "object absent". The difference between the three types lies in the path of the light beam: straight from emitter to receiver, reflected off a mirror, or reflected off the object's own surface.
A concept worth remembering at mounting time is excess gain — the ratio of the light the sensor actually receives to the minimum threshold needed to operate. In a clean environment a few times' margin is enough; where there is dust, mist or a lens that easily fouls, choose a configuration with high excess gain (5–10× or more) so the sensor does not go "blind" as the lens dirties over time. This is why through-beam (high excess gain) is far more robust than diffuse in a dusty workshop. Pair it with the habit of cleaning the lens periodically — many a "sensor fault" is really just an oil-and-dust-fouled lens.

Type 1 — Through-beam
The emitter and receiver are two separate devices, placed facing each other. Normally the beam travels straight from emitter to receiver; when an object blocks the beam, the receiver loses light and operates.
- Strengths: the most reliable and the longest range. Since it only needs an object to break the beam, it does not depend on the object's colour or surface — a clear or a dark bottle breaks the beam equally. It handles dust and interference better thanks to its optical power surplus.
- Weaknesses: it needs two units and wiring on both sides, aligned in a straight line. It cannot detect a fully transparent object (the beam passes through).
Choose through-beam when you need high reliability, a long distance, or objects of varied colour/surface (exactly the bottle-counting case above).
Type 2 — Retroreflective
The emitter and receiver sit in one device; a reflector is placed opposite. The beam travels to the reflector and returns to the receiver. When an object blocks the beam's path (going or returning), the receiver loses light and operates.
- Strengths: it needs only one wired device plus a reflector that needs no power, so wiring is on one side, installation is quick, and it is more compact than through-beam.
- Weaknesses: shorter range than through-beam; and a shiny object (bright metal, film wrap) can reflect like a mirror and fool the sensor into "thinking there is no object". For shiny objects, use a polarized type to distinguish the reflection from the true reflector.
Choose retroreflective when you want tidy wiring and the object is not too shiny.
Type 3 — Diffuse
The emitter and receiver share one device, with no reflector needed. The beam shines out and reflects off the object's own surface back to the receiver; an object present means a reflection, which means operation.
- Strengths: just one device, mounted on one side, the simplest when there is no room for a reflector or an opposing receiver.
- Weaknesses: the shortest range and it depends on the object's colour, gloss and surface angle — a dark/light-absorbing object reflects weakly and is easily missed (exactly the opening case). A background close behind the object can also reflect and cause false triggers.
To overcome an interfering background, use a type with background suppression (BGS): the sensor only picks up objects within a preset distance and ignores objects/backgrounds farther away. This is a feature worth having when using diffuse near a conveyor or a machine wall.
Choosing the type by situation
| Requirement | Choose |
|---|
| High reliability, long range, varied object colour | Through-beam |
| Tidy wiring, object not too shiny | Retroreflective (polarized if the object is shiny) |
| Only one side available, short range | Diffuse (with BGS if there is a near background) |
| Transparent object (bottle, film) | A dedicated "clear object" type, or through-beam depending on the case |
The principle: prioritise reliability for important signals (safety, counting billed product). Saving wiring/money should come only after reliability.
The electrical side: NPN/PNP and light-on/dark-on
Choosing the right optical type is only half the job; the other half is the electrical fit with the PLC:
- NPN or PNP: a 3-wire sensor has a transistor output of the NPN (sinking) or PNP (sourcing) type. It must match the PLC's input type — in Vietnam and with many European PLCs, PNP is common. Wire an NPN into a PNP-expecting input and the sensor "does not operate" even though its LED still lights. (The sinking/sourcing concept was covered in #10.)
- Light-on / dark-on: choose a sensor that operates when receiving light (light-on) or when losing light (dark-on). Choose by the logic "object present = 1": for example, with through-beam, object present = light lost, so if you want "object → output 1", use dark-on. Many sensors let you pick the mode with a switch.
- Response time: for fast-moving objects (high-speed counting), make sure the sensor's response frequency is fast enough not to miss any.
- Protection class and light: for dusty/wet environments choose a high IP; under strong light interference choose a modulated laser/infrared type that rejects noise.
Light source: infrared, red and laser
The type of light also has a large effect on use:
- Infrared (IR): gives strong optical power, penetrates dust/haze well, and reaches far; but the beam is invisible to the naked eye, making alignment harder (some types have an auxiliary aiming spot).
- Visible red light: easy to align because you can see the spot on the object/reflector; common for retroreflective and diffuse.
- Laser: a very small, focused spot for detecting small objects or high positional precision; in exchange it costs more and needs laser-safety attention.
In addition, industrial sensors usually modulate the emitted light so the receiver only accepts the emitter's exact "frequency", making it immune to ambient light (workshop lamps, sunlight). Even so, when mounting under direct sunlight or near a high-power lamp, still avoid letting outside light shine straight into the receiver.
Transparent objects and difficult surfaces
Some objects challenge photoelectric sensors and need special handling:
- Transparent objects (glass bottles, PET film): they let most light through, so diffuse/retroreflective often struggle. Use a sensor specialised for transparent-object detection (high sensitivity, threshold compensation) or switch to another principle (ultrasonic — covered in another sensor series).
- Very dark/matt-black objects: weak reflection, favour through-beam.
- Mirror-shiny objects: as noted, use a polarized reflector or arrange the angle to avoid direct reflection.
- Small objects, thin edges: use a small-spot laser or a narrow-range through-beam.
When you meet a difficult object, do not try to force a cheap sensor to work by cranking the sensitivity to maximum — that is a recipe for an intermittent signal. Choosing the right type from the start is far cheaper than stopping the machine to hunt a fault.
A reference engineering scenario
The illustration below is a reference approach in the spirit of MINATA's design thinking; the final ratings and configuration must be confirmed against the actual documentation, standards and equipment.
On a MINATA feeding cell, the "workpiece present in the waiting tray" position uses a photoelectric sensor brought back to a Delta AX-308E input (PNP type matching the I/O module). For a bright, shiny metal workpiece, MINATA avoids the ordinary retroreflective type (easily fooled) and chooses through-beam for the important "workpiece present/absent" signal, while a secondary check position uses diffuse with BGS to ignore the machine wall behind.
The PLC reads the sensor signal as a condition permitting the next step; true to #09, the displayed status comes from a real sensor, not an assumption. When a sensor is fouled or misaligned, the PLC detects an abnormal condition (for example a workpiece reported present but not taken for too long) and warns instead of running blind.
Common mistakes
- Using diffuse for objects that change colour/gloss → missing objects when the batch changes.
- Using retroreflective for mirror-shiny objects without a polarized type.
- Mis-wiring NPN/PNP against the PLC input → the sensor "does nothing".
- Choosing the wrong light-on/dark-on → inverted logic.
- Placing diffuse near a background without BGS → constant false triggers.
- Skipping through-beam/reflector alignment, leading to intermittency with vibration.
Photoelectric sensor checklist
- [ ] Choose the type (through-beam/retroreflective/diffuse) by reliability, range and mounting.
- [ ] Shiny object: use a polarized reflector; colour-changing object: favour through-beam.
- [ ] Diffuse near a background: choose a type with background suppression (BGS).
- [ ] NPN/PNP output matches the PLC input.
- [ ] Choose light-on/dark-on correctly by the "object present = 1" logic.
- [ ] Response frequency fast enough for the object speed; IP suited to the environment.
- [ ] Firm alignment, resistant to drift under vibration.
- [ ] Choose high excess gain for dust/mist environments; schedule periodic lens cleaning so the sensor does not slowly go blind.
Choosing the right photoelectric type is a design-stage decision that governs the machine's stability for its whole life. The machine's eye is only trustworthy when it "sees" by the principle that suits the object it must see.
Read more automation knowledge at MINATA: https://minatavn.com/en/blog/industrial-automation
Previous — #15: 24VDC power supplies: sizing and calculation for control panels: https://minatavn.com/en/blog/automation-15-24vdc-power-supply
Next — #17: Proximity sensors: inductive and capacitive: https://minatavn.com/en/blog/automation-17-proximity-sensors
View all MINATA technical articles