Inductive and photoelectric sensors with transistor outputs into a PLC input: calculation, precautions and alternatives
Sometimes a single PLC input has to switch on when two sensors detect at the same time (part present and in position) or when any of them detects (part on conveyor 1 or on conveyor 2). With contacts you simply put them in series or in parallel, but an inductive sensor or a photoelectric sensor has a transistor at its output and its own supply, and joining them without thinking leads to inputs that do not switch on, overloaded sensors or sensors powered through their output, and faults nobody can find. The calculator checks a circuit with your data, and each point is explained below.
The PLC input is modelled as a resistor drawing the given current at 24 V; many modern inputs draw an almost constant current and give a little more margin. Silicon diodes of 0.7 V. The IEC 61131-2 thresholds are indicative: the datasheets of the PLC and of each sensor prevail.
The most common DC inductive and capacitive sensors and photoelectric sensors have a 3-wire transistor output: brown (BN) to +24 V, blue (BU) to 0 V and black (BK) as the output. In a PNP sensor the transistor connects the output to +24 V when it detects, and the load goes between the output and 0 V. In an NPN sensor it connects it to 0 V, and the load goes between +24 V and the output. In Europe almost everything is PNP; everything below applies to NPN by swapping +24 V and 0 V.
2-wire sensors are different: they have no supply of their own and are powered through the load, in series with it. To do so, when off they let a small residual current through and, when on, they drop a few volts and need a minimum current.
| Datasheet value | 3-wire | 2-wire |
|---|---|---|
| Voltage drop when on | 1 to 2.5 V | 3 to 8 V |
| Maximum output current | 100 to 250 mA | 50 to 200 mA |
| Residual current when off | less than 0.1 mA | 0.5 to 1.5 mA |
| No-load current consumption | 10 to 25 mA (photoelectric, up to 40 mA) | taken from the load |
| Minimum load current | none | 2 to 5 mA |
| Power-on delay | 10 to 300 ms | 10 to 300 ms |
Indicative values from catalogues. The ones that count are those in your sensor's datasheet.
For the input to switch on only when all of them detect, the output of each sensor powers the next one: the black wire of S1 goes to the brown wire of S2, the black of S2 to the brown of S3, and the black of the last one to the PLC input. All blue wires go to 0 V.
It works, but each sensor powers all the ones behind it, and that has consequences:
For all these reasons, in practice no more than three or four 3-wire sensors are put in series, and no more than two 2-wire sensors.
Three PNP sensors with a 2 V drop and 15 mA consumption, at 24 V, into a type 1 input of 5 mA (4.8 kΩ). The input gets 18 V and 3.75 mA: it switches on, with 3 V of margin over 15 V. The output of S1 carries 2 · 15 + 3.75 ≈ 34 mA, well below 200 mA. With 100 ms of delay per sensor, the input may take 0.2 s to switch on. If the supply drops to 20.4 V, the minimum allowed by IEC 61131-2, the input gets 14.4 V and is no longer guaranteed.
For the input to switch on when any of them detects, the outputs are joined at the PLC input and each sensor is powered directly from +24 V and 0 V. Drops and delays do not add up here, but other problems appear:
In series, each one drops 3 to 8 V: with two you may already lose half the voltage, and with three there is almost nothing left for the input. Also, they all share a single current, which must exceed the minimum load current of each one; if the input draws little, they do not stay switched on and the output oscillates.
In parallel, when one conducts, the voltage on the others drops to its 3 to 8 V drop, which is not enough for them to work: they reset, and when the first one stops detecting they need their power-on delay before they can detect again. There is a blind window. And residual currents add up: four sensors of 0.8 mA give 3.2 mA, more than a type 1 (0.5 mA) or type 3 (1.5 mA) input is guaranteed to read as 0.
Both issues are solved with a resistor in parallel with the input, between the input and 0 V: it absorbs the residual current without the voltage exceeding 5 V and makes up the minimum load current. The calculator proposes one when needed, with the power it dissipates.
| Option | Advantages | Drawbacks |
|---|---|---|
| Each sensor to its own input, with the AND or OR in the program | No added drops or delays; the PLC knows which sensor fails; the logic changes without touching wires | One input per sensor |
| Diodes in parallel (OR) | Cheap; no sensor receives voltage through its output | Only for OR; you still do not know which sensor detects |
| Interface relays, with the contacts in series or in parallel | Each sensor only powers one coil; contacts do not add drops; PNP, NPN and voltages can be mixed | Slower (5 to 15 ms), contacts wear, takes more space |
| Logic module or small programmable relay | Does the logic next to the machine and frees inputs on the main PLC | One more device to program and maintain |
| Remote I/O, IO-Link or AS-Interface | Many sensors with a single cable to the PLC, with diagnostics for each one | Cost of the module or master; IO-Link-compatible sensors |
| Input multiplexing | Many contacts with few inputs | Slower reading and more complex program; meant for contacts more than for electronic sensors |
On a new machine, the first option is almost always the best: an input costs little compared with an hour spent looking for a fault. Sensors in series or in parallel make sense in extensions with no free inputs, and always after checking the circuit with the calculator.
It depends on the drop of each one and on the input threshold. With 2 V 3-wire sensors at 24 V, a type 1 input (15 V) fits four in theory (16 V are left), but with a low supply or a long cable three is a reasonable limit. With 2-wire sensors, two at most.
Not in a direct chain: the PNP delivers +24 V and the NPN switches to 0 V, so the output of one cannot power the other. You need an interface relay or, better, to wire each one to its own input and do the AND in the program.
In a parallel circuit without diodes, the active output of another sensor can power it through its output. It can also be the residual current of 2-wire sensors. Fit a diode on each output or a resistor in parallel with the input.
Yes, with two differences: they draw more current, especially through-beam types, which have an emitter and a receiver, and their power-on delay is usually longer. In series, the delay is more noticeable.
Related: 24 V inputs and IEC 61131-2 types, multiplexing PLC inputs, transistor as a switch, optocoupler and ladder simulator.