What is the difference between PNP and NPN?

Disclosure: Some of the links in this post are affiliate links. This means that, at zero cost to you, Learn Robotics will earn an affiliate commission if you click through the link and finalize a purchase. Learn Robotics is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a way for websites to earn advertising revenues by advertising and linking to Amazon.com.

Table of Contents

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.

PNP and NPN Standard Diagram

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

Now let’s take a look at a case study using a 3-wire Proximity Sensor and a discrete DC Input card on our PLC.how to wire a prox sensor to a PLC diagram

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.PNP wiring diagram

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 commonNPN sensor to PLC wiring diagram

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.

Test PLC inputs discrete DC input card S7-1200

Graphic Courtesy of S7-1200 Course on Udemy

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!

Related Articles

2 Responses

  1. I am interested to learn more about your free robotics training and programs you have in robotics.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Learn Robotics Online
— Get 2 months free!

Exclusive Limited Offer for Serious Beginners Ready to take their Hobby to Engineering Internships, $100k+ Careers, and Beyond!

Enroll now, and earn your first robotics certificate in the next 7 days.

👇 Click below to claim this deal.