In industrial automation, magnetic cylinder switches are often used to detect the position of a pneumatic cylinder’s piston. When the piston reaches a set position, the switch sends an electrical signal to a programmable logic controller (PLC), allowing the machine to continue with the next step.
However, choosing a switch is not just about its size or mounting style. PNP and NPN switches may look similar, but their output circuits work differently. If the sensor output is not compatible with the PLC input, the controller may not recognize the signal correctly. Understanding PNP vs. NPN helps buyers select the right magnetic cylinder switch and avoid wiring or replacement problems.
What Do PNP and NPN Actually Mean?
How Do PNP and NPN Sensors Work?
PNP and NPN refer to two common types of transistor output used in electronic sensors. PNP transistors have a P-N-P semiconductor structure, while NPN transistors have an N-P-N structure. The key difference is how the output circuit switches the electrical signal.
In a magnetic cylinder switch, the sensor detects the magnet inside the cylinder’s piston. When the magnet reaches the sensing position, the internal electronics activate the output transistor.
A PNP sensor switches its output toward the positive supply, providing a positive voltage signal to a compatible PLC input.

An NPN sensor switches its output toward 0 V, providing a path for current to return through the circuit.

PNP = the switch is on the Positive side; NPN = the switch is on the Negative side.
In simple terms, PNP switches the positive side of the circuit, while NPN switches the ground side. Both can detect the same piston position, but their output circuits work differently.
How Are 2-Wire, 3-Wire, 4-Wire, and 5-Wire Sensors Connected?
The number of wires indicates how a sensor connects to a power supply, control system, and output circuit. However, wire count alone does not determine whether a sensor is PNP or NPN. The actual wiring depends on the sensor design and its datasheet.
2-Wire Sensors

3-Wire Sensors
Three-wire DC sensors typically use brown for positive supply (+V), blue for 0 V, and black for the output signal. A PNP sensor switches its output toward the positive supply when activated, while an NPN sensor switches its output toward 0 V. The output must connect to a compatible PLC input.

4-Wire Sensors
A common four-wire configuration adds a second output to the three-wire arrangement. Brown and blue provide power, while black and white may provide normally open (NO) and normally closed (NC) outputs, respectively. Both outputs generally belong to the sensor’s specified output type, such as PNP or NPN. Check the datasheet to confirm their functions.

5-Wire Sensors
Five-wire sensors can have different wiring arrangements depending on their design. Some provide additional outputs, control functions, or relay contacts. For example, an AC-powered five-wire sensor may use two wires for power and the remaining wires for relay switching functions. This is a specific configuration, not a universal PNP/NPN wiring standard.
Before connecting any sensor, check its supply voltage, wire functions, output type, and PLC compatibility. Never determine the wiring solely from the number or color of the wires.

PNP vs NPN Sensors: Key Differences
The main difference between PNP and NPN sensors is how their output circuits switch the electrical signal. Both types can be used in industrial automation, but they must be compatible with the connected PLC input.
| Comparison | PNP Sensor | NPN Sensor |
| Output type | Sourcing | Sinking |
| Output when ON | Switches toward the positive supply | Switches toward 0 V |
| Typical PLC input pairing | Sinking input | Sourcing input |
| Common wire colors in a 3-wire DC sensor | Brown: +V; Blue: 0 V; Black: output | Brown: +V; Blue: 0 V; Black: output |
| Key selection factor | PLC input compatibility | PLC input compatibility |
Matching the PNP and NPN Magnetic Cylinder Switches to Your PLC Input
The rule is simple once you see it: current has to flow in one continuous direction.
- A PNP (sourcing) switch pushes current into the PLC input, so it needs an input module that receives that current and passes it on to ground. That is a sinking input.
- An NPN (sinking) switch pulls current down to ground, so it needs an input module that supplies the positive voltage. That is a sourcing input.
Pair them the wrong way round and nothing happens. These are the symptoms we see most often:
| Symptom | Likely cause |
| Input never turns on | PNP switch on a sourcing input, or the reverse |
| Input is permanently on | Wrong logic — NO ordered where NC was needed |
| Input flickers | Output current too low for the load, or a long cable run picking up noise |
| Input point damaged | Output current exceeded the module rating |
Two practical notes. First, check the common (COM) terminal of your input module: it is wired to 0 V for a sinking input and to +24 V for a sourcing input, and getting this wrong is the single most common mistake on site. Second, many modern PLC and remote I/O modules accept either type — if yours does, you are free to standardise on whichever your team prefers.
Explore Renhotec Magnetic Cylinder Switches
Renhotec provides magnetic cylinder switches for piston position detection in pneumatic automation systems. When the piston magnet reaches the sensing position, the switch sends an electrical signal to a PLC or controller, helping equipment monitor cylinder movement and coordinate automated operations.
To meet different installation and control requirements, our product range includes several options:
- Output types: Normally open (NO), PNP, and NPN models, depending on the product.
- Wiring options: 2-wire and 3-wire configurations for different electrical systems.
- Connection styles: Flying leads, M8/M12 connector cables, and integrated connector designs.
- Mounting compatibility: Selected models are compatible with SMC and Festo T-slot/C-slot cylinders. Check the specific product dimensions before ordering.
Compare PNP and NPN Magnetic Switches
For applications using three-wire DC sensors, choosing the correct output type is essential. Renhotec offers both PNP and NPN magnetic switches, allowing buyers to select a suitable option based on their PLC input requirements.
For example, the following models share several key specifications:
- 3-Wire Normally Open PNP Magnetic Switch with M12 Connector
- 3-Wire Normally Open NPN Magnetic Switch with M12 Connector
Both models specify a 5–30 V DC operating range, a maximum switching current of 200 mA, IP67 protection, and an M12 3-pin male connector with PUR cable. Their main difference is the output type: PNP or NPN.
Before selecting a model, confirm your PLC input type, required switching function, mounting dimensions, and wiring requirements.
Looking for the right magnetic cylinder switch for your equipment? Visit our Magnetic Cylinder Switches category to explore available configurations. You can also contact Renhotec with your PLC specifications, cylinder model, output requirements, and connector preferences to help identify a suitable solution.
Explore Renhotec Magnetic Cylinder Switches
Renhotec provides magnetic cylinder switches for piston position detection in pneumatic automation systems. When the piston magnet reaches the sensing position, the switch sends an electrical signal to a PLC or controller, helping equipment monitor cylinder movement and coordinate automated operations.
Find the Right Configuration for Your Application
Choose from different wiring, output, and connection options to suit your installation and control requirements.
01 Output Types
Choose PNP, NPN, or normally open (NO) configurations according to the specific model and your control system requirements.
03 Connection Styles
Choose flying leads, M8/M12 connector cables, or integrated connector designs.
04 Mounting Compatibility
Selected models are compatible with SMC and Festo T-slot/C-slot cylinders. Check the specific product dimensions before ordering.
Compare PNP and NPN Magnetic Switches
For three-wire DC sensors, the output type must match your PLC input. Renhotec offers both PNP and NPN magnetic switches to meet different control system requirements.
3-Wire Normally Open PNP Magnetic Switch with M12 Connector
A normally open PNP model for applications using compatible PLC inputs.
View PNP Model →3-Wire Normally Open NPN Magnetic Switch with M12 Connector
A normally open NPN model for applications using compatible PLC inputs.
View NPN Model →Both models specify the following key features:
Need Help Choosing the Right Magnetic Switch?
Explore the full Renhotec range or contact our team with your PLC specifications, cylinder model, output requirements, and connector preferences. We’ll help you identify a suitable configuration for your application.

As a Product Manager at Renhotec Group (est. 2008), I specialize in providing deep technical insights into connectors, cables, and custom electronic components. Renhotec is a global leader in interconnect solutions, dedicated to manufacturing high-standard products for diverse industries as your trusted technical partner.

