Applications of Type PNP and NPN Sensors

What assumption can we make about the PLC’s digital inputs?

This post presents the “how to” and the “why” for connecting type PNP and NPN industrial sensors to a typical Programmable Logic Controller (PLC). We will concentrate on PLCs with 24 VDC digital inputs. We will also assume that the PLC features digital positive-logic thresholds defined as:

  • voltages less than 5 VDC are considered logic-zero
  • voltages greater than 15 VDC are considered logic-one

Finally, we will assume each of the PLC’s I/O pins has a static 10 kΩ input resistance.

Be sure to verify these specifications against your PLC’s data sheet as there are PLCs outside of this typical range. Also, recognize that some PLCs have negative logic inputs. This will not be addressed in this post, other than to say that the core message is flipped.

What are PNP and NPN industrial sensors?

The term PNP and NPN refer to the sensor’s output configuration. Three-wire industrial sensors are typically sold as type NPN or PNP with sinking and sourcing outputs respectively. Many sensors are available in both configurations.

NPN and PNP sensors look identical, and the part numbers are often closely related. This can lead to purchasing errors and delays. This is especially true in PLC applications where there is a natural preference for the sourcing PNP type.

The NPN and PNP designation refer to the internal construction of the sensor, specifically the type of transistor used in the output stage. Recall that there are two types of transistors including the NPN and the PNP. Perhaps you once used an NPN transistor in a project such as the venerable 2N3904. The classic configuration is to ground the NPN transistor’s emitter, place the load between the positive power supply and the collector, and then drive the base through a current limiting resistor. In this configuration, the transistor pulls the load down to ground (sinking current).

The configuration using a PNP transistor is a bit different. Now, the PNP transistor’s emitter is tied to the positive power supply. The load is connected between the collector and ground. When the base is activated, the transistor pulls the load up to the positive voltage rail (sourcing current).

We can summarize this by simply stating:

  • PNP pulls up
  • NPN pulls down

In the language of PLC and industrial controls:

  • PNP sources current
  • NPN sinks current

Why is the PNP sensor to PLC interface preferred?

The PNP type sensor to PLC configuration is presented as Figure 1. The three-wire sensor is presented as a block containing a generic sensor module and a PNP output transistor. This is a relatively simple configuration especially when we consider the constraints identified in the opening section.

When activated, the PNP transistor pulls up against the PLC’s input resistance. In an ideal situation, the PNP transistor will be fully turned on and the voltage on the black wire will be 24 VDC. The PLC will identify this as a logic-one as it is considerably higher than the previously identified 15 VDC threshold.
When deactivated, the PNP transistor does not pull. Consequently, the voltage on the black wire will be zero and the PLC will register a logic-zero.


This article is part of the DigiKey Field Guide for Industrial Automation

Location: Understand It → Sensors
Difficulty: :seedling: Student — difficulty levels explained
Author: Aaron Dahlen | MSEE | Senior Applications Engineer, DigiKey
Last update: 13 Mar 2026


Figure 1: Schematic showing the typical PNP sensor to PLC interface

Tech Tip: The three-wire open collector configuration allows sensors to be connected in parallel using a wired OR configuration. You can find additional information about this type of configuration in this related post. While this is a valid configuration, the system will be easier to troubleshoot if each sensor is connected to an independent PLC channel.

NPN sensor to PLC interface

Figure 2 presents the NPN sensor to PLC interface. The added complexity is immediately apparent. You can now understand why the PNP sensor if the preferred solution given the constraint we identified earlier. The PNP sensor circuit is simplified because the sensor’s output pulls up against the PLC’s input resistance.

Necessity of an external pull up resistor

Recall that the NPN transistor pulls the load down. The external 1 kΩ resistor is an essential component as it provides the critical load for the NPN transistor to pull against. Without this external resistor, the sensor’s output (black) wire will always be zero. Many technicians and engineers have fallen into this trap wondering why the sensor is “defective” when it is incorrectly configured.

We need to step back at this point and apply Ohm’s law to ensure the external resistor is sufficient. For a moment, let’s ignore the sensor. What remains is a voltage divider between the external 1 kΩ and the PLC’s internal 10 kΩ resistor. Using the voltage divider rule we can calculate the PLC input voltage as:

V_{PLC} = 24 * \dfrac{10 }{1 + 10} \approx 22\ VDC

This voltage will be safely interpreted as a logic-one by the PLC.

We can now activate the sensor. It will pull at the center of this 22 VDC voltage divider to ground. In an ideal situation, the PLC’s input voltage will now be zero.

Figure 2: Schematic showing the typical NPN sensor to PLC interface featuring an external pull up resistor

How to correct the PNP vs NPN logic inversion

At this point, you may be tempted with the belief that NPN and PNP sensors are interchangeable. This is almost true. Looking back, we interpret an active PNP sensor as a logic-one. Contrasted with an active NPN sensor interpreted as a logic-zero.

Changing sensor types will require a modification to the PLC program to account for the inversion. Hopefully, the programmer used input mapping and the associated I/O pin appears in one and only one location. With I/O mapping this will be an easy change that you can make with confidence. Without a map – well maybe just wait for the correct sensor to arrive, but that is another story.

Best Wishes,

APDahlen

P.S. Sensor selection between a PNP and NPN should be guided by failsafe considerations. Always ask what will happen if there was a broken wire or a sensor failure. This is related to the concept of an emergency stop. As a rule, things that stop a machine should be wired using normally closed contacts so that a broken wire will turn off the machine.

:books: Continue Exploring Industrial Control Systems

If this discussion was helpful, you may also want to explore:

:world_map: DigiKey Navigation

About This Author

Aaron Dahlen, LCDR USCG (Ret.), is a Senior Applications Engineer at DigiKey in Thief River Falls. His background in electronics and industrial automation was shaped by a 27-year military career as both technician and engineer, followed by over a decade of teaching.

Dahlen holds an MSEE from Minnesota State University, Mankato. He has taught in an ABET-accredited electrical engineering program, served as coordinator of an electronic engineering technology program, and instructed military technicians in component-level repair.

Today, he has returned to his home in northern Minnesota, completing a decades-long journey that began with a search for capacitors. Read his story here.

PLCの接続:PNPセンサと使いにくいNPNセンサの比較
Industrial Control and Automation Index
Practical Example of Sourcing and Sinking Configurations in Industrial Control Circuits
初心者のためのArduino Opta PLCデジタル入力接続ガイド
Beginner's Guide to Connecting Digital Inputs to the Arduino Opta PLC
NPNとPNP-どちらが好きですか?
Programming the Banner K50 Pro Series Multicolor Touch Button
Adapting PNP Sensor for NPN PLC Configuration
電感式接近感測器簡介
Introduction to the Inductive Proximity Sensor
Emulating Enumerated States in Siemens PLCs for Module-to-Module State Transfer
Schneider Electric 無線和 Zelio 演示以及 Banner Engineering K100 Pro 日光信標
Electronic Circuit Breaker Protector for Industrial Control
Can You Swap PNP and NPN Transistors?
Regarding Bubble sensor
Building a PLC Trainer for Industrial Education
DIY PLC Trainer Using 19-inch Rack Mount Components
An Improved Trainer for Relays and Small PLCs
DIY Programmable Logic Controller Trainer
유도형 근접 센서 개론
Integrating the Banner K50 Pro Optical Series Touch Button with a Schneider Modicon PLC
Getting started with DigiKey's Arduino Opta Kit
OSSD Safety Signals: What the Waveform Tells a Safety Relay
PNPトランジスタとNPNトランジスタを交換できますか?
Modeling PLC Digital Inputs: Transitioning from the Microcontroller to the PLC World
How to Configure the Modicon PLC for a Quadrature Encoder
Which do you love more—NPN or PNP?
Schneider Electric Wireless and Zelio Demo with a Banner Engineering K100 Pro Daylight Beacon
如何配置正交編碼器 Modicon PLC
Introduction to the Selec MIBRX Family of Low-Cost PLCs

Thank you. Do you have any content in your website that can help newbies to learn about PLC?

Thank you, bidrohini.

At this point there is limited PLC data on this forum. Perhaps we can change that in the future. For now I will refer you to:

Please let us know if these links are useful. Also, if you are reading this, please add additional links or comments below.

Best Wishes,

APDahlen

1 Like

Thanks a lot. I will check these out soon.

1 Like