I got a device which has a connection to a NPN proximity sensor, it'll do something when the sensor is being trigged.

Now I remove the sensor, using a PLC(24vdc) to do the job of sending the signal to the device, how do I do the wiring?

The sensor is a typical 3 wires NPN type, brown and blue receives power from the device (says 10-30vdc on the sensor), the black wire is "sinking".

I do know how to use this sensor as input to PLC. I'm quite a rookie for this, thanks so much for your help.

  • \$\begingroup\$ HI. I'm confused. At the moment I understand you have at four pieces of hardware involved: 1. Encoder. 2. NPN sensor. 3. Something you removed the sensor from. 4. The PLC.. What is item (1)? A link to the manufacturer datasheet would help. What is item (3)? \$\endgroup\$ Nov 6, 2023 at 3:56
  • \$\begingroup\$ What voltage does the coder make between the wires from the coder to the sensor \$\endgroup\$ Nov 6, 2023 at 4:15
  • \$\begingroup\$ the voltage of the PLC is 24vdc. \$\endgroup\$
    – castiel
    Nov 6, 2023 at 4:17
  • \$\begingroup\$ @FabioBarone only 3 things, let me edit the question. \$\endgroup\$
    – castiel
    Nov 6, 2023 at 4:18

3 Answers 3


An "NPN signal" is also known as an open collector signal.

High impedance in one state and grounded in the other.

You could do thin in a plc using a relay output or possibly using a digital output

  • \$\begingroup\$ yes, this is the first thought come to my mind, using a relay that controlled by the PLC. \$\endgroup\$
    – castiel
    Nov 6, 2023 at 4:25

I do know how to use this sensor as input to PLC.

The answer depends on the PLC you will connect the sensor to.

What type of input does your PLC have?
There are two types, these are called:

  1. PNP. Also called "sinking input", since the PLC "sinks" the current from the sensor.
  2. NPN. Also called "sourcing input", since the PLC "sources" current to the sensor.

In fact there are other types (for example "AC"), but these are very rare.

How are they different?

Assuming the PLC is powered up, then:

PNP: With nothing connected there will be 0V at the PLC input. The PLC registers this as "OFF". If you connect this input to +24V (say) through a resistor, say, a 1k-ohm, then the voltage at the input will change (go closer to +24V) and the PLC will register this as "ON".

NPN: With nothing connected there will be about +24V at the PLC input (it may be different to +24V, it will be whatever the PLC's internal power supply voltage is). The PLC registers this as "OFF". If you connect this input to 0V through a resistor (1k-ohm), then the voltage at the input will change (go closer to 0V) and the PLC will register this as "ON".

The image below explains this, it shows how each type of sensor is connected to the correct type of PLC input, this was sourced from:

enter image description here

How do I tell what type of input the PLC has?
I would use a DC volt meter to measure the voltage at the PLC input with nothing connected. The voltage you see there will tell you which type of input it is. I would then test it by connecting a resistor from the input to the opposite voltage.

Why use a 1k resistor, why not just use a wire?
I recommend using a resistor as a precaution just in case something is not as you expect. The idea is that the resistor will limit the current that will flow, so hopefully nothing gets damaged. For example, we have assumed that the PLC inputs are wired for 24V, but perhaps that is not correct - it could be expecting 5V, for example. Connecting 24V directly to a 5V DI is very likely to damage it. This can be a problem with PNP inputs because the default voltage with nothing connected is 0V, which does not tell you what voltage it is expecting. With NPN inputs, the voltage is already high, and you just connect it to 0V to register "ON".

If I had no datasheet about the PLC, then in fact I would probably start with a 10K resistor first, if that does not cause the PLC to register the input as being ON, I would reduce the resistor to 2k2, then 1k, then 470R, then 220R, and lastly 100ohm. If the PLC does not register ON with 100r then something is very likely wrong.

What happens if I connect the wrong type of sensor to the PLC input?
Usually nothing. The PLC will see the input as OFF regardless of whether the sensor output is ON or OFF.

If I have the wrong sensor type, what can be done?
You will need to change the output of the sensor to the correct type. You can use a relay for this, or transistors. Using a relay is OK for slow inputs; but if input is faster than, say, 5 pulses per second, then I would recommend transistors.

The product below can convert any type to the opposite type just by how you wire to it, it is a DIN-rail mounted device just 6.2mm wide, here is the link:

enter image description here


Here's the existing schematic.

enter image description here

This is the altered one.

enter image description here

The dry contact of a PLC relay output is used to pull-down the device input.

The contact of an external relay, driven by the PLC output, may also be used.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.