logo elektroda
logo elektroda
X
logo elektroda

Choosing the Right Inductive Sensor: NPN vs PNP for 24V DC Metal Detection & Relay Control System

weld 81993 34
Best answers

Can I use either an NPN or PNP 24 V DC inductive NO sensor to directly drive a relay in a simple metal-detection circuit, or does the sensor type matter?

For a simple relay-driven circuit, the sensor type usually does not matter: an NPN NO sensor pulls the output to 0 V when active, while a PNP NO sensor applies +24 V when active [#5478297] What matters is that the relay coil current stays within the sensor’s output load rating [#5478297] If you connect the relay coil directly, wire it according to the sensor type and add a reverse-biased diode across the coil to protect the sensor from back-EMF [#6520930] The NPN/PNP choice becomes important when the sensor is connected to an input stage such as a PLC, because the input must match the sensor’s sourcing/sinking logic [#5736962][#6177252]
Generated by the language model.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #31 14262952
    mrrudzin
    Level 39  
    Posts: 5940
    Help: 516
    Rate: 580
    It is possible, it is probably worth using protection diodes and some current limiting resistors (in case they both work at the same time).

    I understand that after hovering over one axis, you want to have + on the output, and on the other -?
    But what would it do next? Usually logic inputs are two-state (0,1)
  • ADVERTISEMENT
  • #32 14265337
    amnon
    Level 10  
    Posts: 8
    Hello,

    1 sensor for homing 1 axis, so I have 3 axes and three sensors. It works in such a way that I place one sensor on the left or right side of each axis. The control program, in this case mach, after the command "home the machine" starts the cycle of sliding each axis to the place where I have sensors. First, the z axis, after the approach, the coordinate is read, then the Y axis and the X axis. The machine thus sets its machine zero. So the sensor is only supposed to turn off.

    Regards
    Amnon
  • ADVERTISEMENT
  • #33 14265352
    mrrudzin
    Level 39  
    Posts: 5940
    Help: 516
    Rate: 580
    Ok, so how would you like to base your axes now using these sensors?
    I understand that one homing sensor = one controller input
    The problem is that one is NPN and the other is PNP? The NPN sensor can control the relay / optocoupler, and the output signal from the optocoupler should only be fed to the controller input
  • ADVERTISEMENT
  • #34 14265640
    amnon
    Level 10  
    Posts: 8
    Hello,

    It is important that all sensors are connected once (probably in parallel) so that after hovering over any sensor, the circuit is disconnected, which will cause the program to stop temporarily, read the coordinate and continue to homing the other axes. Before that, I had limit switches connected in parallel, which worked in the same way, i.e. disconnected. The problem is whether PNP and NPN will work together.
  • #35 14269681
    mrrudzin
    Level 39  
    Posts: 5940
    Help: 516
    Rate: 580
    For me, it is not entirely logical all the time.

    Answering the question - if you want to know that any of the sensors has been triggered, you need to pass the NPN sensor output to the relay. Connect the NO contact of the relay under + and in parallel with the PNP sensor output.

Topic summary

✨ The discussion revolves around the selection of NPN vs PNP inductive sensors for a 24V DC metal detection and relay control system. Key points include that both sensor types can function in the described application, with NPN sensors shorting to ground and PNP sensors shorting to the power supply when activated. Users emphasize the importance of matching sensor polarity to avoid faults and suggest that PNP sensors are generally preferred for ease of connection and compatibility with microcontrollers. The conversation also touches on the implications of using normally open (NO) versus normally closed (NC) configurations, redundancy in sensor setups, and the potential for using both sensor types in a single system. Additionally, there are considerations regarding the wiring of sensors to PLCs and the impact of connecting different sensor types in parallel.
Generated by the language model.

FAQ

TL;DR: Most 12 V car relays draw under 150 mA [Elektroda, Andy74, post #6520930] “control the voltage (24 V)” [Elektroda, Artik_b, post #5806235] Pick PNP when your control side expects +24 V, NPN when it expects 0 V; both switch relays if the coil current is within the sensor’s rating.

Why it matters: Correct polarity avoids false triggers, blown inputs, and hours of troubleshooting in mixed-origin machines.

Quick Facts

• Rated sensing distance for M12 inductive switches: 4 mm on steel [Elektroda, weld, post #5478197] • Typical sensor load current: 100–200 mA; many car relays ≤ 150 mA [Elektroda, dj-brylant #6520385; Andy74 #6520930]. • EU PLC inputs are usually PNP (sourcing) while many Japanese PLCs are NPN (sinking) [Elektroda, pcichomski, post #6177252] • NO outputs give logic 1 only when the target is present; NC provides fail-safe detection of cable breaks [Elektroda, Artik_b, post #5806235] • Edge-case: sensors can fail open or short, so critical axes use redundant devices [Elektroda, wd40, post #5811642]

What’s the basic difference between NPN and PNP inductive sensors?

Both use a transistor switch. An NPN sensor sinks current to 0 V when active; a PNP sensor sources +24 V when active. The load must be wired to the opposite rail [Elektroda, CervantesJ., post #5478297]

Will the sensor type affect switching a 24 V DC relay?

No, provided the relay coil current is below the sensor’s output rating and you wire the polarity correctly [Elektroda, CervantesJ., post #5478297]

How do I wire a PNP NO sensor to a relay coil?

  1. Connect brown to +24 V.
  2. Place the relay coil between black (output) and 0 V.
  3. Add a reverse diode across the coil (band to +24 V) to suppress flyback [Elektroda, Andy74, post #6520930]

How do I wire an NPN NO sensor?

Swap the rails: brown to +24 V, coil between +24 V and black, diode reversed. The sensor shorts black to 0 V when metal is detected [Elektroda, CervantesJ., post #5478297]

Can I mix PNP and NPN sensors on the same PLC?

Yes if the PLC has separate COM terminals. Universal input cards like Omron ID212 let you set one module PNP and another NPN by tying COM to 0 V or +24 V [Elektroda, pcichomski, post #6179908]

What happens if I plug an NPN sensor into a PNP-only input?

Nothing dangerous—inputs are protected—but the signal will never reach the threshold, so the PLC stays off [Elektroda, pcichomski, post #6170917]

Why do European machines prefer PNP while Asian machines use NPN?

EU wiring standards treat 0 V as reference and switch the positive rail. Japanese practice evolved from 120 V systems where grounding the input felt safer [Elektroda, pcichomski, post #6165927]

Should I choose NO or NC contacts for limit switches?

NC is safer for end-stops because a broken wire looks like an active alarm; NO works for general presence detection [Elektroda, Artik_b, post #5806235]

What load current can typical inductive sensors handle?

Most 3-wire DC sensors supply 100–300 mA; one user cited a 200 mA model [Elektroda, dj-brylant, post #6520385] Always check the datasheet before wiring multiple coils.

How do I detect sensor failure during operation?

Add redundant devices or compare time-outs. A broken cable opens an NC loop; a short shows constant ON. "Complementary detectors are used in critical points" [Elektroda, wd40, post #5811642]

Can a 24 V sensor drive a 12 V car relay?

Yes if the coil draws ≤ 150 mA and the supply matches both devices; ensure the sensor’s minimum output voltage still energizes the 12 V coil [Elektroda, Andy74, post #6520930]

What’s an edge-case I should watch for?

If the sensor transistor shorts, an NO device may stay permanently ON, bypassing safety logic. Redundancy or a secondary mechanical switch catches this fault [Elektroda, Mellon31, post #5814814]
Generated by the language model.
ADVERTISEMENT