Comparison · Intermediate · 3 min read
Photoelectric Sensors
Through-Beam, Retro-Reflective, Diffuse and Background Suppression
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
Photoelectric sensors detect objects with a light beam. Through-beam sensors have the longest range and most reliable detection, retro-reflective sensors use a reflector, and diffuse sensors detect light bounced back from the object. Pick the type for your range, check the NPN or PNP output and supply voltage, and use a level shifter or optocoupler when connecting to a microcontroller.
Key specs at a glance
- Through-beam
- Separate emitter and receiver, longest range, most robust
- Retro-reflective
- Emitter and receiver together, with a reflector
- Diffuse
- Detects light reflected from the target; short range
- Background suppression
- Ignores objects beyond a set distance
- Supply
- 10 to 30 V DC typical
- Output
- NPN or PNP transistor, light-on or dark-on
Sensor types
Choose by range and mounting.
| Type | Range | Strengths | Limits |
|---|---|---|---|
| Through-beam | Metres to tens of metres | Reliable; detects any opaque object | Needs wiring on both sides |
| Retro-reflective | A few metres | One-side wiring | Shiny objects may fool it; use polarised types |
| Diffuse | Centimetres to a metre | Single unit, no reflector | Colour and surface affect range |
| Background suppression | Fixed cut-off distance | Ignores the background | Setting needs care |
- Through-beam
- Range:
- Metres to tens of metres
- Strengths:
- Reliable; detects any opaque object
- Limits:
- Needs wiring on both sides
- Retro-reflective
- Range:
- A few metres
- Strengths:
- One-side wiring
- Limits:
- Shiny objects may fool it; use polarised types
- Diffuse
- Range:
- Centimetres to a metre
- Strengths:
- Single unit, no reflector
- Limits:
- Colour and surface affect range
- Background suppression
- Range:
- Fixed cut-off distance
- Strengths:
- Ignores the background
- Limits:
- Setting needs care
NPN, PNP and light-on/dark-on
A PNP output switches the positive supply to the load; an NPN output switches the load to ground. Use the type your controller expects (PLCs in Europe usually use PNP). Light-on means the output turns on when the receiver sees light; dark-on when the beam is blocked. Many sensors can be set either way.
Connecting to Arduino or ESP32
Industrial sensors run from 10 to 30 V, so their output may exceed a microcontroller's input limit. Use an optocoupler or a voltage divider so the pin sees 3.3 or 5 V. A PNP sensor with a divider to ground works with a normal input. An NPN sensor needs a pull-up. See optocouplers and level shifting. Use a separate supply for the sensor and connect the grounds.
Installation tips
- Align through-beam pairs carefully and use the indicator LED to confirm.
- Keep lenses clean; dust reduces range.
- Use polarised retro-reflective sensors for shiny targets.
- Shield from ambient light and strong sun.
- Respect the IP rating in wet or dusty places.
Try it: Voltage divider calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Feeding a 24 V output straight into a microcontroller pin.
- Mixing NPN and PNP inputs.
- Using a diffuse sensor on dark or shiny parts without testing.
- Misaligning a through-beam pair.
- Forgetting a common ground between supplies.
Frequently asked questions
Which type is the most reliable?
Through-beam, because the target must block the beam.
How do I tell NPN from PNP?
Check the data sheet. A PNP output is high when active; NPN is low.
Can I run it from 5 V?
Most industrial types need 10 to 30 V. Use a 12 or 24 V supply.
What is background suppression?
A diffuse sensor that ignores anything behind a set distance.
Is a photoelectric sensor the same as a photointerrupter?
Similar idea at a different scale; see photointerrupters.
Parts for this guide
Calculators
Terms in this guide
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.




