Photoelectric Sensor Wiring Diagram: 3-Wire, 4-Wire and Through-Beam Sensors

Photoelectric Sensor Wiring Diagram: 3-Wire, 4-Wire and Through-Beam Types (Light-On vs Dark-On Explained)

If you’ve ever stood in front of a machine with a dead photoeye, holding a replacement that has more wires than the old one, this guide is for you. Photoelectric sensor wiring looks intimidating because the same three or four wire colors hide very different behaviors depending on the sensing structure. We’ll walk through the wiring diagram from the simplest three-wire hookup to the through-beam pairs that trip everyone up. Then there’s the light-on/dark-on logic: it decides whether your sensor works or works backwards.

Photoelectric Sensor Wiring Basics: Brown, Blue, Black

A photoelectric sensor (photoeye) detects an object without touching it: an emitter sends light, a receiver watches for it, and the difference tells the sensor whether something is there. In a control cabinet, that translates into a simple three-wire hookup on most DC units:

  • Brown (BN): positive supply, connected to +12–24 V DC
  • Blue (BU): negative supply, connected to 0 V (DC common)
  • Black (BK): switching output, connected to the PLC input or your load

The three wires at a glance

BNBrown — supply positive, +12–24 V DC
BUBlue — supply negative, 0 V common
BKBlack — switching output, to PLC input or load

This color convention follows IEC/EN 60947-5-2, the standard used across DC industrial sensors (Pepperl+Fuchs, EN 60947-5-2 connection knowledge base). The black wire is the business end: it’s a transistor output that either pushes +24 V out (PNP, “sourcing”) or pulls the input to 0 V (NPN, “sinking”). One-line memory: PNP sources the positive, NPN sinks to negative. Power the sensor, run the black wire to your PLC input or relay coil, and the circuit is complete.

One quick clarification before we go further, because it confuses almost everyone who lands on this page: the photocell on a dusk-to-dawn streetlight is a different animal. That device senses ambient light level to switch 120/240 V lighting on at night. It has no “object” concept, and its wiring is mains wiring. This article covers the low-voltage photoeye that detects parts, packages and pallets. Different job, different wires.

Three Sensing Structures: Read the Machine Before You Wire Anything

Before you touch a single wire, identify which of the three photoelectric structures you’re dealing with. They wire differently, and “they look similar” is how expensive mistakes happen.

StructureHow to recognize itWhat it detectsWhere it struggles
Through-beam (opposed)Two separate units facing each other, no reflectorObject breaks the light beam between themNeeds two aligned units, both powered; no single-head shortcut
RetroreflectiveOne head aimed at a reflector plateObject blocks the beam bouncing backShiny or mirror-like objects behind the target can fake a clear beam; polarized retro fixes most of this
Diffuse (proximity)One head, no reflector; detects objects in front of itObject reflects the light back to the same unitShort range; black or transparent objects reflect poorly

Less common variants exist, including polarized retroreflective, background-suppression diffuse, fiber-optic heads, laser and color-mark sensors. All of them descend from these three structures, and the wiring questions stay the same.

The fastest way to classify an unknown installation is three questions, answered at the machine:

  1. One head or two? Two units facing each other means through-beam. Note that the emitter and receiver are two separate part numbers. Write both down.
  2. Is there a reflector? Yes means retroreflective. No reflector and one head means diffuse.
  3. Where’s the part number? Usually stamped on the body. On a through-beam pair, both halves carry their own number, and they don’t always match.

Ask these three questions on the phone, at the panel, or at the spare-parts shelf, and you’ve already prevented the most common ordering error in this category: buying the wrong structure, for example a diffuse head to replace one half of a through-beam pair.

Watch: Photoelectric Sensor Wiring Demonstration

Watch a practical demonstration of photoelectric sensor wiring before matching the output to your PLC input.

Wiring by Structure: Which Unit Carries the Output?

Through-beam: the emitter is just a light source — the receiver does the switching

Here’s the fact that solves most through-beam wiring problems, and the one to remember from this entire article:

On a through-beam sensor, the output always lives on the receiver: the emitter is nothing but a light source, and the two halves carry different part numbers.

Two units. Only one does the switching.

Emitter

BN+12–24 V DC

BU0 V

Often two wires only

Receiver

BN+12–24 V DC

BU0 V

BKPLC input or loadOutput


The emitter and receiver are two separate part numbers — wire both units, and order them as a pair.

Wire the emitter first: brown to +V, blue to 0 V. That’s often all it has, since many emitters are two-wire devices. Then wire the receiver: brown to +V, blue to 0 V, and the black (output) wire to your PLC input or load (RealPars, photoelectric sensor wiring and setup). If you power the emitter and the receiver but get no signal, the usual suspects are: the black wire went to the emitter (nothing to switch there), the pair isn’t aligned, or the output type doesn’t match your input, which we’ll cover in a moment. Both units need power; only the receiver switches.

Single-head sensors and the fourth wire: what “white” does

Retroreflective and diffuse heads are single units, so they follow the plain three-wire grammar above. The complications start when there’s a fourth wire. Three ways manufacturers use it, and what each means for you:

SchemeWireBehavior
Selectable light-on/dark-onWhiteTie white to +V for light-on; tie to 0 V for dark-on
Complementary outputsWhite or a second blackTwo live outputs (one light-on, one dark-on); pick the one your machine needs
Teach or test inputWhite or grayPulse it to teach a threshold, or use it as a test input; leave floating in normal run

Two field warnings here. First: when a light-on/dark-on selector wire is left unterminated, the sensor still works, in the manufacturer’s default mode. Defaults differ, so never assume: check the datasheet line that says “connection diagram,” and if the diagram is unclear (it often is), ask the supplier before you commission the machine. Second: some sensors print NO/NC on the body while the datasheet talks in light-on/dark-on terms. The printed label refers to the unpowered state and misleads more people than it helps. Trust the datasheet connection diagram, not the silkscreen.

One more thing worth checking on replacement: quick-disconnect (M8/M12) sensors. The connector may look identical, but pin functions are assigned by the manufacturer. A “pin 4 = output” unit will not work on a cable wired for “pin 2 = output.” When you order a QD sensor, the pinout has to match the cable that’s already in the machine.

Light-On vs Dark-On: Which Output Logic Does Your Application Need?

You’ve wired every wire correctly, power is on, and the sensor still does the opposite of what the machine needs. Light-on/dark-on is the single most confusing subject in photoelectric wiring, and the one where even the experts contradict each other.

What light-on and dark-on actually mean (and why “NO/NC” trips people up)

The physical definitions are simple: a light-on output energizes when the receiver sees enough light; a dark-on output energizes when the beam is blocked or the receiver goes dark (control.com, what light-on and dark-on mean). The trouble starts when people translate this into the normally-open/normally-closed language of mechanical switches. One major manufacturer’s blog answers “is light-on the same as NO?” with “the short answer is yes,” then maps through-beam as normally-closed and diffuse as normally-open (Balluff, photoelectric basics: light-on or dark-on), while Omron’s own guide frames typical diffuse presence sensing as light-on (Omron, photoelectric sensor terms). Two respected sources, two different translations.

Here’s the resolution. NO/NC is defined from a resting state, but a photoeye’s resting state depends on its structure. A through-beam receiver sits in light when nothing is in the beam; a diffuse head sits in darkness. So forget the translation and ask one question instead: what must the output be when the object IS present? Then let the structure tell you which mode delivers it.

Choosing by structure: the flip table and fail-safe direction

StructureBeam at rest (nothing detected)Output ON when object present needsTypical logic
Through-beamLight present (receiver lit)Dark-on: the object blocks the beamDark-on for break detection
RetroreflectiveLight present (beam returns from the reflector)Dark-on: the object blocks the beamDark-on for break detection
DiffuseDark (no reflection at rest)Light-on: the object reflects light backLight-on for presence detection

Read that table twice, because it’s where the mistakes live: the same “turn on when the part arrives” requirement means dark-on on a through-beam pair and light-on on a diffuse head. Order the wrong logic and your “part present” signal becomes “part missing.” The machine will fault, over-feed, or worse, in ways that look like wiring faults.

If you’ve already bought a selectable or complementary-output sensor, this is fixable at the terminal: re-tie the white wire, or move the signal wire to the complementary output. No new purchase needed. And if you’re replacing an old sensor, watch the old one through one full cycle and note whether the output is on with the part present or absent. That observation beats any label.

A standard photoeye is not a safety-rated device. Never rely on one, in any wiring mode, where a stopped hand or body must be detected; that is the job of a certified safety light curtain. And when you choose light-on or dark-on, think about the failure direction: a dirty lens, a dying beam or a lost supply should drop the output into the stop/fault state, not the all-clear state.

Matching Your PLC Input — and Ordering a Replacement That Works the First Time

DC photoeyes are ordered as PNP or NPN, and in most cases that choice is locked at the factory. There’s no field switch, so confirm which output your input expects before you order. Here’s the field test that takes thirty seconds:

  1. Jumper the PLC input under test directly to +24 V. If the input turns on, the card is sourcing: it wants a PNP sensor.
  2. If it doesn’t, jumper the input to 0 V instead. If it turns on now, the card is sinking: it wants an NPN sensor.

Then keep this honesty in mind: an NPN sensor driving a sourcing input “can be made to work” with a pull-up resistor or an intermediate relay. Relays do work as adapters, but that’s a field bodge with a real cost: an extra component per channel, slower response, and a contact to maintain. It’s a get-the-line-running move, not a design. The clean fix is ordering the right polarity, which is why your order needs to be specific. When you replace a photoeye, hand the supplier this checklist. Every line maps to something you can read off the old unit:

Six fields to write down before you order a replacement photoeye

1 Sensing structure: through-beam (both part numbers: emitter and receiver), retroreflective, or diffuse

2 Output type: PNP or NPN (or relay / 2-wire AC, for older machines)

3 Output logic: light-on, dark-on, selectable, or complementary

4 Supply and wire count: 12–24 V DC; 3-wire or 4-wire; lead length or M8/M12 pinout

5 Detection range and mounting: check the old bracket and the old datasheet

6 Environment: washdown, dust, or outdoor; match or exceed the old IP rating

If the old unit’s label is worn off, work the checklist backwards with a supplier who can match by machine context (mounting, range, and behavior) rather than guessing from a photo.

Wiring Looks Right but the Sensor Still Doesn’t Work? A Field Diagnosis Order

When a freshly wired photoeye misbehaves, diagnose in this order. It saves hours of chasing ghosts:

Three-layer diagnosis: check in this order

1 Wiring layer: polarity reversed (brown/blue swapped), black wire on the emitter, white selector left unterminated, wrong QD pinout, or load current beyond the output rating; check with the datasheet diagram in front of you

2 Logic layer: light-on/dark-on chosen backwards for the structure (see the flip table above), or the PLC program simply reads the signal inverted; watch the sensor’s own LED while a part passes to separate sensor logic from program logic

3 Physical layer: beam alignment drifted, lens coated with dust, oil mist, condensation or soap film (the number-one cause of degraded optical sensing), sunlight or strong ambient light hitting a long-range receiver, or a shiny background reflecting around a diffuse target; clean the lens, re-aim the pair, and test in both light conditions

Still dead after all three? Meter the output wire against 0 V while you interrupt the beam: if the voltage never changes, the problem is in the sensor or its supply; if it changes but the PLC never sees it, the problem is between the output and the input. That split tells you which side of the wire to blame.

What Replacement Demand Means for Distributors and Stockists

Everything above, the structure identification, the receiver rule, the flip table, is what separates a distributor who gets phone calls from one who gets orders. Your customers describe photoeyes the way they see them: “the one with two heads,” “the one with the reflector,” “the single-head one that sees the bottles.” Those descriptions map one-to-one onto the three structures in this guide. That is why the three identification questions double as a customer-service script, and why a stockist who can answer them in one call wins the repeat business.

The same structure lens sharpens stocking and quoting. Stock through-beam pairs as pairs, because emitters and receivers fail and sell together. Prefer selectable or complementary-logic units where they fit: one SKU then covers both light-on and dark-on demand. Quote every order with the six-field checklist: structure, polarity, logic, supply/wiring, range, environment. On photoeyes, a wrong polarity or a flipped logic is a “received but won’t work” return, and returns are where margin goes to die. None of this is exotic: it’s the wiring diagram you already know, read back as inventory policy.

If you’re replacing photoeyes and want the spec checked before you commit, whether it’s structure, output type, light-on/dark-on or pinout, send the old unit’s details to OMCH’s selection team. We match against drawings and datasheets across our 30+ category automation catalog, and we’ll confirm samples on your machine before you order in quantity.

Turn Replacement Call-Ins into Confirmed Orders

Send the structure, output type and light-on/dark-on logic you read off the machine — or photos and markings of the old unit — and our selection engineers spec-check the match before you order.

Get a Spec-Checked Quote

References

  1. Pepperl+Fuchs. “Inductive Sensors – Electrical Connections: Wire Colors and Plug Assignment According to EN 60947-5-2.”
  2. Omron Industrial Automation. “Photoelectric Sensors – Explanation of Terms (Light-ON / Dark-ON).”
  3. Balluff. “Photoelectric Basics – Light-On or Dark-On.” June 2024.
  4. RealPars. “Photoelectric Sensor Wiring, Setup, and Troubleshooting.”
  5. control.com. “What Do Light-On and Dark-On Mean for Photoelectric Sensors?” January 2025.
  6. OMCH Sensor Switches – Photoelectric and Proximity Product Range
  7. OMCH Product Selection – Spec and Drawing Based Matching
  8. OMCH Contact
  9. OMCH – Industrial Automation Components

Table of Contents

Contact Us

Please enable JavaScript in your browser to complete this form.

Reliable Industrial Automation, We Keep You Running!

Contact Us

Please enable JavaScript in your browser to complete this form.