Elektroda.com
Elektroda.com
X

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

weld 76881 34
This content has been translated flag-pl » flag-en View the original version here.
  • #1
    weld
    Level 10  
    Hi
    I am a beginner so please be understanding :)
    Well, I have such a system: an inductive sensor controlled 24V DC, NO, after detecting a metal element (4mm operating zone), to control the relay, which will switch something further, turn it off.
    Simple layout, no PLC etc.
    Now my question is, is the sensor type important in such a solution, is it NPN or PNP?
  • #2
    CervantesJ.
    Level 17  
    It does not matter whether it is NPN or PNP. The difference is best shown in the figure below:
    If it is a NO sensor (Normalinie Open), then in the case of NPN, after approaching the metal (active state), the output is shorted to ground. In the case of PNP NO in the active state, the output is shorted to the power supply - in this case + 24V.

    For NC (Normal Closed) sensors the output is simply inverted.
    I would like to add that you should pay attention to the load capacity of the sensor output.
  • #4
    mrrudzin
    Level 39  
    => CervantesJ.

    In your drawing, captions (PNP and NPN) should not be the other way around?
  • #6
    elkard
    Level 36  
    I believe that it is ok.
  • #7
    mrrudzin
    Level 39  
    Sure - sorry - my mistake :)
  • #8
    Mellon31
    Level 13  
    The connections are correct. The situation becomes important when connecting to inputs, eg PLC.
  • #9
    prawy
    Level 14  
    It is also important that the sensors have the same polarity as far as possible, because when you have a fault, you will look for + or _ in relation to the mass, and order is important here.
  • #10
    Mellon31
    Level 13  
    I usually use PNP NO sensors. If this is the case in the entire system, there will actually be no service problems. Besides, PNPs are more accessible
  • #11
    Artik_b
    Level 15  
    Hello,

    Probably everyone uses (prefers to use) NO sensors, but it is not appropriate in every place, e.g. as an end switch, or even a position sensor is better to do on the NC, because if the detector or cable is damaged, you have no signal and, for example, a trolley it will not go to the fender or somewhere outside the machine ... That's what NC and ON are for to use ...

    Generally, PNP is used, because we control the voltage (24V), although "old" (experienced) electronics prefer ground control ... faster? easier?

    Regards
  • #12
    robnar
    Level 14  
    controllers in the European version have PNP or NPN inputs or only PNP inputs, while Asian versions, i.e. Japan China, etc., use only NPN
  • #13
    wd40
    Level 21  
    I use PNP because it's easier to connect directly to the microcontroller.
    Consider whether a magnetic sensor doesn't do the same job - it's almost 10x cheaper.
  • #14
    wd40
    Level 21  
    Artik_b wrote:
    Hello,

    Probably everyone uses (prefers to use) NO sensors, but it is not appropriate in every place, e.g. as an end switch, or even a position sensor is better to do on the NC, because if the detector or cable is damaged, you have no signal and, for example, a trolley it will not run over the fender or somewhere outside the machine


    The detector can fail in two ways: permanent disconnection or permanent short-circuit - please remember that. And the NC does not cover all situations, therefore complementary detectors are used in critical points.
  • #15
    Mellon31
    Level 13  
    wd40 wrote:
    Artik_b wrote:
    Hello,

    Probably everyone uses (prefers to use) NO sensors, but it is not appropriate in every place, e.g. as an end switch, or even a position sensor is better to do on the NC, because if the detector or cable is damaged, you have no signal and, for example, a trolley it will not run over the fender or somewhere outside the machine


    The detector may fail in two ways: permanent disconnection or permanent short-circuit - please remember that. And the NC does not cover all situations, so complementary detectors are used in critical points.


    This is right, because the sensor is an electronic device and it is not known how the output transistor will be damaged. However, in the case of such probable and frequent and at the same time trivial damages as the wires falling out of the terminal, cable breakage, corrosion of the connection, the solution of my colleague Artik_b would be good, with no additional costs (I assume that the sensor has a similar price in both versions). However, the multiplication of the measurement is sufficiently certain. I do that. First, an inductive sensor, and if this did not work, I put a limit switch behind it at a distance of a few cm. That both would be damaged at the same time - unlikely. Moreover, I can use the fact that the limit switch has tripped for diagnostics of the type "Replace sensor no ...".
  • #16
    Artik_b
    Level 15  
    Hello,

    I will not quote, because the topic will grow ... but as for damage - "permanent disconnection", a PLC programmer should anticipate such a situation and, for example, some trolley cannot reach the end position (where the sensor is damaged) and at the same time in the working position ...

    Of course, to increase certainty - redundancy. As a colleague Mellon31 wrote, such solutions are often used in industry. For example, one sensor before the end of traction turns on the approach speed, and the other turns off traffic in that direction. At the same time, both act as protection (logic in PLC).

    Regards
  • #17
    kermit48
    Level 10  
    I do not understand everything until the end, because would not only sensors be enough, for example, pnp and nz ?? are complementary so why do we need npn ?? as it seems to me, the control signal is 0 and 24V here and here, am I wrong somewhere?
  • #18
    gigipawel
    Level 15  
    kermit48 wrote:
    I do not understand everything until the end, because would not only sensors be enough, for example, pnp and nz ?? are complementary so why do we need npn ?? as it seems to me, the control signal is 0 and 24V here and here, am I wrong somewhere?


    I recommend connecting some old and cheap sensors, e.g. NPN to PNP inputs (or vice versa), you will see and convince yourself what it ends with.
  • #19
    kermit48
    Level 10  
    gigipawel wrote:
    I recommend connecting some old and cheap sensors, e.g. NPN to PNP inputs (or vice versa), you will see and convince yourself what it ends with.


    well, I just want to know what it ends because I do not have the possibility of such a connection ??
  • #20
    pcichomski
    Level 16  
    kermit48 wrote:
    I do not understand everything until the end, because would not only sensors be enough, for example, pnp and nz ?? are complementary so why do we need npn ?? as it seems to me, the control signal is 0 and 24V here and here, am I wrong somewhere?


    It is about the adopted concept of signal levels. NPN sensors provide a signal to the controller by applying the 0V level to the input, ie it is "logical 1" ("there is a signal") it corresponds to the 0V level. No signal: e.g. 24V is applied to the input or the input is disconnected (and the LED on the PLC is off).

    Such a convention is common, for example, in machines from ASIA (Japan, China, etc.).
    Some time ago, a Japanese explained to me that it dates back to the times when the level of 120V mains voltage was commonly used in PLC systems - then the active signal was the short-circuit of the input to NEUTRAL - and such a solution meant that no dangerous voltage was applied to the sensor elements, which could penetrate the housing, e.g. in the case of cable damage, sensor damage, limit switches, etc.

    Regards
  • #21
    dziubek102
    Heating systems specialist
    And I remember the old lessons from automation to use zero control wherever I do not want to have interference, e.g. large and complicated systems with a large number of current paths.
    It doesn't matter with simple imo layouts. it is a matter of transparency in the overall layout and the application of logical choices within a given project.

    so regarding the subject, if it is to be a one-time use, take what you have on hand and try it in action. If these are moving parts, then don't forget about additional security and that's it.
  • #22
    kermit48
    Level 10  
    pcichomski wrote:
    It is about the adopted concept of signal levels. NPN sensors provide a signal to the controller by applying the 0V level to the input, ie it is "logical 1" ("there is a signal") it corresponds to the 0V level. No signal: e.g. 24V is applied to the input or the input is disconnected (and the LED on the PLC is off).


    Thanks a lot for the answer, I did not fully understand that if there is no signal it is then "1", and in other cases (as you write with 24V or disconnected signal) it is zero.
    Thanks again for the answer

    I still remembered what will happen if I connect the npn sensor to the pnp card in the PLC and in the reverse situation ??
  • #23
    pcichomski
    Level 16  
    kermit48 wrote:

    I still remembered what will happen if I connect the npn sensor to the pnp card in the PLC and in the opposite situation ??

    Rather, nothing will break, but it will not work, otherwise the entrances are built. The PNP input takes the current from the sensor (hence the alternative name of this SINK input), from the NPN input the current flows to the sensor (alternative name SOURCE). The design of the sensor output is different, as the PNP sensor must emit current, and the NPN sensor must take the current from the PLC input. Of course, when the "sensor" is an ordinary switch or button - there is no difference :D - in addition to the connection method.
    Regards
  • #24
    fLt
    Level 11  
    pcichomski wrote:

    ... when the "sensor" is an ordinary limit switch or a button - there is no difference :D - in addition to the connection method.
    Regards


    Summarizing the topic, I will ask a question.

    Is the Japanese Omron SYSMAC CQM1 CPU41-V1 controller suitable for low voltage control? So all sensors that we will use in it must be NPN type? And we wire the switch or the button via 0V? on the other side of the contact we have a 24 V signal from the controller input (NPN-Source)?

    A contact closure (potential difference) is logic "1" for the controller input.
    Contact opening (no potential difference) is logic "0" for the controller input?

    And what is the matter with the outputs, does the output control, for example, a coil via a 0V signal? on the other hand, the coil is powered "permanently" by 24V?

    Regards.
  • #25
    pcichomski
    Level 16  
    question 1
    The fact that the driver is Japanese does not mean that it is NPN type - it is often set with a switch or through appropriate jumpers or cabling (eg Mitsubishi FX - although I encountered an FX driver made only for NPN in a Chinese machine). The same is true for the "low voltage" feature. Drivers with 24VDC inputs can be PNP and NPN types. The way you connect the signals is important. In the CQM1, you have a wiring diagram under the covers above the terminals. If it is drawn that a button contact is connected between WE and VCC, it is a PNP input. The same applies to other "contact" sensors (limit switches, sensors with clean contact output, etc.). Sensors with electronic output must be PNP type to work well. You also have a COM terminal on the input terminal block - this is the input voltage reference terminal (against which Uwe is measured). For PNP they usually need to be connected to 0V, for NPN - to Vcc. In the case of modules for CQM1, e.g. ID212 - it is a universal module. The way of COM connection determines the type of input.

    question 2
    For NPN, shorting the input to 0V gives logic "1" in the program. The unconnected input will have a potential close to 24V. However, for the sake of accuracy - the short circuit gives equalization, not the potential difference, while when opening the contact, there will be a potential difference.
    :D

    question 3 outputs.
    If the output is a RELAY then there is no problem. The COM terminal decides about the signal given by the contacts. You can short COM with VCC and control objects, e.g. contactors connected to 0V (typical in Europe and USA) or COM connected to 0V and control objects connected to Vcc (this is what they usually do in Asia). In the case of electronic outputs (transistor, triac) it depends on the driver. OMRON OD212 outputs to CQM1 are connected from COM to 24V, the output voltage is + 24V, the object with the other terminal is connected to 0V.
    It is a SOURCE-type WY, because the current flows from it (and therefore the opposite nomenclature than at the inputs), but I do not know whether such an input is called NPN (for logic) or PNP - surely the SOURCE type. The output type defined as SINK (Asia) is then when the outputs give 0V to the objects with the second terminal connected to + 24V - the current flows from the object to the output.

    So to sum up:

    Europe:
    WE PNP - SINK - 24V signal fed to WE gives a logical 1, COM to 0V
    Asia:
    WE NPN - SOURCE - 0V signal fed to WE gives a logical 1, COM to 24V

    Europe
    WY (NPN?) - SOURCE - logic 1 sets the output to + 24V, COM to 24V, the object is controlled to 0V
    Asia:
    WY (PNP?) - SINK - logic 1 sets the output to + 0V, COM to 0V, the object controlled to 24V.

    Regards
  • #26
    fLt
    Level 11  
    Thank you very much for the comprehensive answer, my friend is a specialist in the subject.

    pcichomski wrote:
    question 1
    ... You also have a COM terminal on the input terminal block - this is the input reference voltage terminal (against which Uwe is measured). For PNP they usually need to be connected to 0V, for NPN - to Vcc. In the case of modules for CQM1, e.g. ID212 - it is a universal module. The way of COM connection determines the type of input.


    So it is possible to wire several WE ID 212 modules within one CPU in such a way that one module will be PNP and the other NPN? and thus some sensors in the machine are PNP and others are NPN?

    pcichomski wrote:
    question 2
    For NPN, shorting the input to 0V gives logic "1" in the program. The unconnected input will have a potential close to 24V.


    And for PNP, shorting the input to 24V gives a logic "1" in the program. An unconnected input will have a potential close to 0V. According to this:

    pcichomski wrote:

    Europe:
    WE PNP - SINK - 24V signal fed to WE gives a logical 1, COM to 0V
    Asia:
    WE NPN - SOURCE - 0V signal fed to WE gives a logical 1, COM to 24V


    It seems that the machine I am talking about (produced around 1983) was modernized by two programmers / assemblers - one from Europe and the other from Asia. They both wanted to use the OMRON but they argued when connecting the signals and I have a nice mix of PNP and NPN.

    But it was more about the cost of upgrading: some sensors remained old - NPN, and new ones were added to PNP. Hence the difference in the method of wiring EC modules.

    From myself I will add that diagnosing a fault in such a control is a pure torment, especially since most sensors have unreadable markings (PNP NPN).
  • #27
    pcichomski
    Level 16  
    fLt wrote:
    Thank you very much for the comprehensive answer, my friend is a specialist in the subject.

    1.
    So it is possible to wire several WE ID 212 modules within one CPU in such a way that one module will be PNP and the other NPN? and thus some sensors in the machine are PNP and others are NPN?

    2.
    And for PNP, shorting the input to 24V gives a logic "1" in the program. The unconnected input will have a potential close to 0V. According to this:

    3.
    It seems that the machine I am talking about (produced around 1983) was modernized by two programmers / assemblers - one from Europe and the other from Asia. They both wanted to use the OMRON but they argued when connecting the signals and I have a nice mix of PNP and NPN.

    But it was more about the cost of upgrading: some sensors remained old-NPN, and new ones were added to PNP. Hence the difference in the method of wiring EC modules.

    From myself I will add that diagnosing a fault in such a control is a pure torment, especially since most sensors have unreadable markings (PNP NPN).


    add.1
    In this case it is possible, i.e. each module works in a different electrical logic (if you have universal modules, of course).

    add.2 Probably yes, but it actually doesn't matter, because what is the significance of the voltage level on the unconnected input of some transistor amplifier. The voltage level on such an unconnected input depends on the design of the input circuit, the polarization circuits, the type of transistor etc. - it is important that the application of 24V or 0V to WE causes the activation of this input.

    add.3 I also "like" such machines :D

    Regards
  • #28
    dj-brylant
    Level 12  
    Hello I have a question.
    I have a NO PNP sensor and I want to connect it in the car so that it turns on the car relay. Could something happen to him? I know its load current is 200mA
  • #29
    Andy74
    Level 25  
    Measure (or calculate from the measured resistance) the current drawn by the relay coil. If it does not exceed 200mA, feel free to connect it. From what I remember, typical 12V car relays do not consume more than 150mA, so there should be no problem as long as the sensor supply voltage is within the acceptable limits.
    Connect a coil between the sensor output (usually the black wire) and ground. Parallel to the coil you can put a reverse biased diode (it will protect the sensor from overvoltage).
    Remember that the sensor connected to the power supply, even when it is not activated, still consumes several mA of current.
    Regards
    Andy
  • #30
    amnon
    Level 10  
    Hello,

    I have two sensors, one PNP NO and the other NPN NO, I would like to use them for homing the engraving machine, is it possible to connect them in parallel so that after hitting one of the sensors, a signal is given that one of the axes has been locked?

    Regards
    Amnon