Three-wire DC sensors — including inductive proximity switches, photoelectric sensors, capacitive sensors, and ultrasonic sensors — are among the most common input devices in industrial automation. Connecting them correctly to a programmable logic controller (PLC) is fundamental knowledge for anyone working with industrial control systems. This guide covers the correct wiring procedure for both NPN and PNP output sensors, explains the underlying electrical principles, and addresses the most important considerations for ensuring a reliable and compatible installation.

Understanding Three-Wire DC Sensor Wiring

A three-wire DC sensor has three conductors, each serving a distinct function:

  • Power supply positive — typically a brown wire; connects to the positive terminal of the DC power supply
  • Power supply negative (common/ground) — typically a blue wire; connects to the negative terminal of the DC power supply
  • Signal output — typically a black wire; connects to the PLC input

The sensor draws operating power from the brown and blue wires and uses the black wire to communicate its detection state to the PLC input card.

Before You Begin: Verify Compatibility

Before making any connections, confirm that the sensor and PLC input card are electrically compatible. Three parameters must match:

1. Operating Voltage

Confirm the sensor's rated supply voltage against the available power supply. Most industrial three-wire DC sensors operate on 10-30 VDC, which is compatible with a standard 24 VDC control panel supply. Check the sensor's specification label or data sheet to confirm its voltage range.

2. Output Type: PNP vs. NPN

This is the most critical compatibility check. Three-wire DC sensors are available in two output types, and using the wrong type with a given PLC input card will prevent the system from working.

  • PNP (sourcing) — when activated, the sensor connects the signal output wire to the positive supply voltage. The output "sources" current from the supply to the connected load. PNP outputs are typically used with sinking PLC input cards.
  • NPN (sinking) — when activated, the sensor connects the signal output wire to the negative supply voltage (ground/common). The output "sinks" current from the load to ground. NPN outputs are typically used with sourcing PLC input cards.

Check the PLC input card documentation to determine whether it is a sinking input (accepts PNP sensor outputs) or a sourcing input (accepts NPN sensor outputs). Confirm the sensor output type matches.

3. Input Voltage Rating

The PLC input card has a rated input voltage — typically 24 VDC for most modern PLC families. The signal voltage presented by the sensor's output must fall within the PLC input card's rated operating range.

Wiring a PNP (Sourcing) Sensor to a Sinking PLC Input

A sinking PLC input card provides a path to ground. When the PNP sensor activates, it connects the signal wire to the positive supply voltage. The current flows from the supply, through the sensor's output, through the PLC's input circuit, and returns to the supply negative through the PLC's common terminal.

Step-by-Step Wiring

  1. Do not apply power yet. Complete all wiring before energizing the circuit.
  1. Connect the sensor's brown wire to the positive terminal of the 24 VDC power supply.
  1. Connect the sensor's blue wire to the negative terminal of the 24 VDC power supply.
  1. Connect the sensor's black wire (signal output) to the numbered input terminal on the PLC input card that corresponds to the desired PLC address (e.g., input I:0.0 or X1, depending on the PLC platform).
  1. Connect the PLC input card's common terminal (labeled COM or 0V) to the negative terminal of the 24 VDC power supply.
  1. Apply power. When the sensor detects its target, it connects the signal wire to +24V. The PLC input card sees +24V at its input terminal, interprets this as a logic HIGH ("true" condition), and responds as programmed.

Wiring an NPN (Sinking) Sensor to a Sourcing PLC Input

A sourcing PLC input card provides a path from the positive supply. When the NPN sensor activates, it connects the signal wire to the negative supply (ground). The current flows from the PLC's input terminal, through the sensor's output, and returns to ground through the sensor's blue wire.

Step-by-Step Wiring

  1. Do not apply power yet.
  1. Connect the sensor's brown wire to the positive terminal of the 24 VDC power supply.
  1. Connect the sensor's blue wire to the negative terminal of the 24 VDC power supply.
  1. Connect the sensor's black wire (signal output) to the numbered input terminal on the PLC input card.
  1. Connect the PLC input card's common terminal to the positive terminal of the 24 VDC power supply (note this is the opposite side compared to sinking inputs).
  1. Apply power. When the sensor detects its target, it connects the signal wire to 0V. The PLC input card sees 0V at its input terminal — pulled down from the positive supply reference — interprets this as a logic HIGH, and responds as programmed.

Close-up of industrial sensor signal wires connected to PLC terminal blocks in a neat control panel

Important Wiring Notes

Do Not Reverse Supply Polarity

Connecting the brown and blue wires in reverse (brown to negative, blue to positive) will likely damage the sensor. Most sensors have internal reverse polarity protection, but relying on it is poor practice. Always connect brown to positive and blue to negative.

Avoid Sharing Conduit with Power Wiring

Route sensor signal cables in separate conduit from AC power wiring, motor cables, and other power circuits. Capacitive coupling between power cables and signal cables can induce noise on the sensor signal, causing false outputs or erratic PLC inputs. This is particularly important with long cable runs and in environments with variable frequency drives or large motor starters.

Load Current Requirements

PLC input cards have a minimum load current requirement — a small amount of current that must flow through the input circuit for the PLC to register a logic HIGH. Three-wire DC sensors with transistor outputs are designed to provide sufficient current to meet typical PLC input requirements. However, in applications where the cable run is very long or where additional interface devices are interposed in the circuit, confirm that the total circuit current will meet the PLC input's minimum requirements.

Multiple Sensors on a Single Power Supply

If multiple sensors share a single power supply, verify that the power supply has adequate current capacity for all connected loads simultaneously. Add up the operating current for each sensor and any other devices on the supply, add a margin of at least 20%, and confirm the power supply rating is sufficient.

Testing the Completed Wiring

After completing the wiring and before programming the PLC, verify the sensor installation with a simple functional test:

  1. Apply power to the circuit.
  2. Observe the sensor's indicator LED to confirm it is receiving power (most sensors have a power indicator).
  3. Activate the sensor by presenting its target (metal for inductive sensors, blocking the beam for photoelectric sensors, proximity for capacitive sensors).
  4. Observe the sensor's output indicator LED — it should change state when the target is detected.
  5. Monitor the corresponding PLC input in the PLC's I/O status display or diagnostic software. The input should change state in synchronization with the sensor's output LED.

If the PLC input does not change state when the sensor activates, verify the output type compatibility (PNP vs. NPN), confirm the common terminal wiring on the PLC input card, and check the signal wire connection at both the sensor and PLC ends.

A properly wired three-wire DC sensor will provide years of reliable input to the PLC control system, forming the foundation of accurate and responsive automated machine control.