Here on the blog, we spend a lot of time working with 5 VDC sensors and controllers (Arduino, for example). And, a lot of that knowledge is a great primer for getting into Industrial Controllers like PLC’s (Programmable Logic Controllers).
However, when you start working with PLC’s and 24 VDC sensors you have to follow a slightly different wiring technique. Two very common, yet confusing terms in this space are “PNP” and “NPN”. This article aims explain these terms and provide real examples of how to wire PNP and NPN sensors to a PLC.
How to Remember PNP and NPN (which is which)?
Before we dive into the wiring, let’s talk about what PNP and NPN are and some methods for remembering the two. You can think of the “N” as “Negative” and “P” as “Positive.” The middle letter is the letter connected to the common terminal. For PNP sensors, the Negative side is connected to common. For NPN sensors, the Positive side is connected to common.
To Sink or Source?
PNP is also known as “Sourcing.” PNP devices switch the positive side of the circuit.
A PNP device “sources” or provides +24 V to the input card when active.
NPN devices are known as “Sinking” and can switch the negative side. An NPN device “sinks” or provides -24 V to the input card when active.
Also, the terms Sourcing and Sinking alone are not enough to describe the configuration because SINKING provides a path to ground and SOURCING provides a path to V+. Standard convention has NPN = SINKING and PNP = SOURCING.
How to choose a PNP or NPN sensor?
PNP vs. NPN sensors are determined by the type of circuit used in the system. In most PLC’s it’s possible to configure cards as PNP or NPN. Another thing to note, is that NPN and PNP sensors should never be mixed on a PLC input card.
Furthermore, if you have a specific type of PLC input card that’s NPN or PNP, It’s important to make sure that you choose sensors that match. For example, you can use NPN sensors with an NPN Input card or “sourcing type” Input card. However, you can’t use PNP sensors with an NPN input card.
Steps to Wire an Industrial sensor to a PLC
1. First, select a Sensor that matches your PLC Input Card (discrete DC INPUT) and has the same Circuit Wiring type (PNP or NPN). For this example, we’ll wire a 3-wire proximity sensor to a Discrete DC Input Card and walk through both PNP and NPN wiring types.
2. Next, check the data sheet for your sensor. Wire 3 is typically connected to the load (or the terminal input on the PLC input card).
3. Then, follow one of the two wiring guides for PNP or NPN below.
How to Wire PNP (Sourcing) Sensors to a PLC Input Card
To wire our PNP proximity sensor, you can use this methodology. It’s a good idea to check the sensor’s data sheet because wire colors and configurations may differ.
First, connect the Brown Wire, or Wire 1, to +24 V. Then attach Wire 2 (blue wire), to the common terminal on the power supply. Finally, connect the black wire, or Wire 3, to the load or pin on the PLC input card.
How to Wire NPN Sensors to a PLC Input Card
NPN sensors are wired the same, except, you’ll connect +24 V to common
Test out and Program Your PLC
Once you have your power supply, PLC, input card, and sensor wired up, the next step is to verify it works. Most modern PLC’s have indicator lights for both the Input and Output pins. Trigger the proximity sensor and verify that the Indicator light turns on.
Finally, you can go into your PLC programming environment (Studio5000 for Allen-Bradley controllers or TIA Portal for Siemens controllers) and create some Ladder Logic.
If you’re new to PLC programming, I recommend checking out this PLC programming course from Udemy. I’ve taken the S7-1200 course and it provides very thorough content to get you started with Ladder Logic and Function Block diagrams.
You don’t want to miss it!