What is a photoelectric sensor?
A photoelectric sensor is a device that uses light (usually infrared) to detect the presence or distance of an object.
Photoelectric sensor structure
The basic components of a photoelectric sensor are the emitter, the receiver and a detection circuit. Some models might also have a transmitting plate and optical fibers.
Emitter (also called transmitter): the parts that emit a light beam. The light source is typically an LED, laser diode, or infrared emitting diode (IED) that can emit a continuous light or pulses.
Receiver: the parts receiving the light and converting the light to an electrical signal. It is made up of a photodiode, phototransistor, or photovoltaic cell. There is a lens and an aperture in front of it which focus the light.
Detection circuit: Circuit that handles the electrical signal that is generated by the receiver. It removes the correct signal and applies it to a control output, effectively converting the electrical signal to a control output.
How does a photoelectric sensor work?
The photoelectric effect is the working principle of photoelectric sensors. We know that light travels in straight lines and when it encounters an object it changes into three forms, reflection, scattering, or absorption. These changes are associated with the material, surface, thickness or color of the object. A photoelectric sensor uses light emissions and receptions to capture data like presence or location.
Photoelectric sensor explained—video from @realpars
Photoelectric sensor features
1. Long detection distance
Unlike magnetic or ultrasonic sensors, a through-beam photoelectric sensor has the ability to detect more than 10 meters away. The distance of diffuse reflection sensor is 0.1-3 m, the distance of retro-reflection sensor is about 0.5-10 m, which can satisfy different needs from short distance to long distance.
2. Versatile object detection
Unlike proximity sensors, which can only recognize metals, these sensors detect light blocking and light reflecting objects. They are able to sense nearly everything from glass, plastic, wood and liquids.
3. Short response time
Light moves at a high speed of 3 × 108 m/s, it path of 10 m is only about 33 nanoseconds, and has almost no delay. Moreover, all the sensor’s circuits are made up of electronic components only, avoiding any moving mechanical parts, which makes the overall response time very short.
4. High resolution
By adopting advanced technology, the projected light beam can be focused into a tiny spot, and thus the tiny objects (high-end models can achieve Φ0.7mm level of resolution) are detected. It is also possible to achieve high-precision position detection.
5. Non-contact detection
Detection is done while not in contact with the object, so there is no damage to the object being detected or the sensor. The sensor is long-lived and can be used for long-term and frequent detection.
6. Color detection capability
Objects of different colors have different reflectivities and absorptivities for different wavelengths of light. The photoelectric sensors are designed to send out light at specific wavelengths and measure the object’s colour by measuring the intensity of light that reflects off of the object (or the amount of light absorbed).
7. Easy adjustment
A number of photoelectric sensors emit visible light that can be seen by the human eye (red visible light). The emitted light spot or path can be directly observed during installation or debugging, which makes it easier to align the receiver, adjust the angle of the sensor or make sure the object being measured has been placed appropriately.
Types of photoelectric sensors
There are three types of photoelectric sensor by detecting method: Through-beam, Retro-reflective, and Diffuse-reflective.
1. Through-beam type
The through-beam photoelectric sensor is made up of two independent components: an emitter and a receiver, positioned opposite one another on either side of the detection area. The light beam is continuously emitted from the emitter and in real time received by the receiver; however, when an object passes through the light beam it prevents the light from reaching the receiver. The detection circuit is capable of accurately determining the presence of an object and providing an output of a switching signal. It judges by whether or not light is blocked, not depending on the colour, material or reflection of the object.
This detection method is the most stable, interference-resistant, and unaffected by the color or reflectivity of the object being measured. It has the longest detection range, reaching tens of meters. However, for a through-beam sensor to function properly, the emitter and receiver must be aligned and precisely, and it cannot detect thin, transparent objects. Currently, this type of sensor is most commonly used in automatic doors, production line product counting, and elevator door anti-pinch systems.
2. Retro-reflective type
Retro-reflective photoelectric sensor is having an emitter and a receiver in the same casing. Then during use a reflector (mirror/prism reflector) is installed on the other side such that the emitted light is reflected back to the receiver. As objects pass by they obstruct the light, much like through-beam sensors, the detection is based on the object blocking the light.
This type of sensor has a detection range between that of through-beam and diffuse reflection sensors. The transparent objects (e.g., glass bottles and films) may be detected by the mirror-reflective photoelectric sensor in this type. It is worth noting that the reflector must be installed in the correct location and cleaned regularly. They are frequently employed in the detection of items on conveyors, warehousing logistics and packaging inspection systems.
3. Diffuse-reflective type
Diffuse reflection photoelectric sensor combines its emitter and receiver in the same casing. It works by using an object to be measured to scatter and reflect light back to the receiver. It is judged by the intensity of reflected light received, and is influenced by the colour, surface roughness and reflectivity of the object. For example:
- Light reflects off of white and rough surfaces well.
- Light is reflected poorly or not at all by black, smooth, transparent surfaces.
The simplest and easiest-to-install of the three types of sensors is diffuse reflection sensors. But their range of detection is the lowest. Diffuse reflection photoelectric sensors are very useful when detecting irregular objects, soft materials and where installation locations are limited. This can be seen in various applications, including automatic sensor faucets, hand dryers, filler detection and vending machines.
How to wire a photoelectric sensor?
A 3-wire system is the most common type for most industrial DC photoelectric sensors. The wiring colour code is: brown to the power supply (+V, e.g., 12-24V DC), blue to the negative power supply (0V/GND), black to signal output wire. The distinction in wiring depends on the type of sensor output (either NPN or PNP) and if the sensor is a through-beam design, the emitter and receiver need to be powered independently.
Distinguishing between NPN and PNP
The black wire on a three-wire sensor is not the “positive” or “negative” terminal that directly controls the load, but rather it is the output terminal of the signals. Where the other end of the load is connected depends on whether it’s an NPN or PNP sensor.
NPN Output (also called "Sinking Output")
The load is in the power supply positive line (+V) and between the black signal line (OUT). With the sensor operating, the black output line is pulled low to near 0V. The current flows from the +V through the load to the black output line and then back to 0V and energizes the load.
PNP Output (also called "Sourcing Output")
The load is connected between black signal line (OUT) and negative terminal of the power supply (0V). The black output line is pulled high to near +V when the sensor is working, and the current flows from +V to the internal PNP transistor and then to the black output line, thence to the load, and finally back to 0V, thus energizing the load.
Through-beam photoelectric sensor wiring
The most important feature of the through-beam photoelectric sensors is that the emitter and receiver are physically distinct, and that both must be powered separately. The emitter is normally a 2-wire system and the receiver a 3-wire system. In the following example an NPN output receiver is employed:
| Components | Line color | Function |
|---|---|---|
| Emitter | Brown | +V |
| Emitter | Blue | 0V |
| Receiver | Brown | +V |
| Receiver | Blue | 0V |
| Receiver | Black | Output signal |
If it is a PNP type receiver, connect the black wire to one end of the load, and connect the other end of the load to 0V.
What is the photoelectric effect?
When light strikes a material, the energy of the photons absorbed by electrons changes the state of its energy, causing electrons to leave the material surface, or electrical properties of the material (such as conductivity) change, resulting in photoelectric effects. The photon energy must reach a certain threshold, and the energy of one photon is usually absorbed by one electron at a time.
What are the light sources used in photoelectric sensors?
LEDs and laser diodes are the mainstream light sources on the market:
- LEDs (Light emitting diodes): Highly efficient, long lasting, small, have large beam size and easy beam divergence.
- Laser diodes: Laser diodes have the advantages of small beam size and small beam divergence angle.
How to distinguish between NPN and PNP?
You can use a multimeter to verify. Connect the red probe to the switch output pin and the black probe to the negative power supply terminal:
- An NPN type will display a voltage close to the power supply voltage; when triggered by blocking, the displayed voltage will approach 0.
- A PNP type will display a voltage close to 0; when triggered by blocking, the displayed voltage will approach the power supply voltage.
How to choose the best photoelectric sensor?
1. Identify the object to be detected
When dealing with a transparent object (ie glass bottles and PET bottles), a mirror-reflective sensor should be used and, for a highly reflective metal or a polished surface, a through-beam sensor is preferred.
2. Identify the detection type
Through-beam sensors are commonly used for long-distance detection and handling of dust and moisture; retro-reflective sensors are used for medium-distance detection to save wiring; diffuse reflection sensors are used for short-distance detection for easy installation; slotted sensors are used for counting small parts. NPN/PNP sensors must be compatible with the PLC.
3. Identify the object’s movement speed
Required response time ≈ object size / movement speed; calculate based on minimum interval / linear velocity, leaving at least twice the margin to avoid missed detections.
4. Identify the operating environment
In dusty environments, diffuse and retro-reflective light can be scattered by particles, leading to misinterpretations; through-beam sensors offer the most reliable penetration.
What are photoelectric sensors used for?
Product inspection and counting on assembly lines
Mechanical component position detection and positioning
Item size measurement
Color recognition and sorting
Paper presence detection in printers/copiers
Automatic page turning scanners
Automatic door switches and elevator door anti-pinch systems
Automatic hand dryers/faucets
Barcode/QR code scanners
Vehicle counting and classification
ETC automatic toll collection systems
Reversing radar or automatic parking systems

This article is written by the Renke Technical Team, whose expertise spans industrial sensing technologies, electronic measurement, and automation monitoring. The team has a strong understanding of photoelectric detection principles, optical sensing configurations, and signal output technologies, including NPN and PNP switching. Renke aims to help readers better understand sensor operation and make informed decisions in industrial detection applications.









