Sensors & Field Devices
Proximity, photoelectric, encoders, PNP vs NPN, and 4–20 mA loops.
- PNP versus NPN, and polarity
- Proximity and photoelectric types
- Encoders, and the honest instrument
- 4–20 mA and the live zero
- Fail-safe wiring
What it is
Sensors are how a machine perceives. Everything the PLC believes about the world arrives through one, and the PLC has no way to check.
That produces the diagnostic problem this chapter exists for: a sensor reporting an absence and a genuine absence look identical from inside the control system. A part-present input that is off might mean there is no part, or it might mean the sensor is dirty, misaligned, out of range, wrongly wired, or hanging off a broken cable. The machine will behave sensibly in every one of those cases, which is what makes it convincing.
Your job is the same one Conveyor 04 sets: decide whether the instrument is lying or telling the truth, before anybody replaces it.
The families
| Family | Answers | Typical devices | | --- | --- | --- | | Presence | Is something there? | Inductive and capacitive proximity, photoelectric | | Position | Where is it, or how far has it moved? | Limit switches, encoders, linear transducers | | Process | How much? | Pressure, temperature, flow, level transmitters |
The first two are usually discrete — the answer is yes or no, and the wire is either on or off. The third is usually analogue, and on a plant that nearly always means a 4–20 mA loop.
Normally open, normally closed, and which way a failure points
A normally-open contact makes when the sensor detects; a normally-closed one breaks. That sounds like a preference and it is not — it decides which way the device fails.
A broken wire, a lost supply or a dead sensor all produce the same thing: no signal. On a normally-open device that reads as not detected. On a normally-closed device it reads as detected, which for a guard, an E-stop or an interlock means the circuit opens and the machine stops.
That is why safety devices are normally closed. The failure and the alarm condition are the same electrical event, so the fault cannot hide.
How it works
PNP and NPN
Three-wire DC sensors have a supply pair — brown to +24 V, blue to 0 V by the usual convention — and a black output wire. What that output does is the distinction:
- PNP (sourcing) switches +24 V onto the output. Common in Europe and on most modern equipment.
- NPN (sinking) switches the output down to 0 V. Common on older and on much Japanese-designed equipment.
The input card must be built for whichever it is getting. Mixing them does not half-work or work intermittently — the input simply never changes state. That matters diagnostically, because "the new sensor does not work either" is exactly what a mismatch looks like, and it is how a machine ends up with three sensors fitted the same wrong way.
Two-wire sensors deserve a warning. They are powered through the load itself, which means a small leakage current flows even when they are off — typically a milliamp or two. Modern PLC inputs are high-impedance enough that this leakage can hold an input on permanently. If a two-wire sensor's input never goes off, measure the voltage at the terminal with the sensor unactuated; a bleed resistor is the usual remedy.
Proximity sensors
Inductive sensors detect metal only, by the effect of the target on an oscillating field. Two properties bite in practice. First, sensing range is specified for mild steel, and other metals reduce it — stainless, aluminium and brass can cut the range by a third or more, so a sensor that worked on a steel target may not on a stainless replacement part. Second, flush and non-flush versions are not interchangeable: a non-flush sensor mounted into metal will detect the mounting.
Capacitive sensors detect almost anything, including product, water and their own contamination. That sensitivity is the point and also the failure mode — build-up on the face, condensation or washdown residue will hold one on. Treat a capacitive sensor that has started behaving oddly as a cleaning job before an electrical one.
Photoelectric sensors
Three arrangements, in descending order of robustness:
- Through-beam — emitter and receiver facing each other. Longest range, most tolerant of dirt, and the most reliable. It needs two devices and two cable runs, which is the reason it is not always chosen.
- Retroreflective — emitter and receiver in one body, with a reflector opposite. One cable, decent range. Shiny targets can act as reflectors and fool it, which is why polarised versions exist.
- Diffuse — one body, no reflector, detecting light bounced off the target itself. Most convenient, least robust: range depends on the target's colour and finish, so a black matt product may not be seen at a distance a white one is. Background suppression versions fix the commonest version of this.
All three fail the same three ways: contamination on the lens, mechanical misalignment, and something in the beam that should not be. Almost every photoelectric fault is one of those, and almost all of them are visible.
Encoders
An incremental encoder produces two pulse trains, A and B, ninety degrees apart. Counting pulses gives distance; which channel leads gives direction. Most also produce a Z or index pulse once per revolution, used to establish a reference at power-up — which is why some machines need homing after a power cycle and others do not.
An absolute encoder reports its actual position as a value, so it knows where it is the moment it powers up, at more cost.
The failure worth knowing is not electrical. An encoder is usually coupled to a shaft, and the coupling can slip while the encoder itself remains perfect — clean quadrature, correct levels, accurate pulses, all reporting a shaft that is not doing what the machine thinks. This is precisely the trap Conveyor 04 sets, and the only thing that separates it from a genuine mechanical fault is physical evidence.
4–20 mA loops
Analogue process values travel as current rather than voltage for a good reason: current is the same everywhere in a series loop, so voltage drop along a long cable run does not corrupt the reading the way it would with a 0–10 V signal.
The live zero at 4 mA is the design detail worth understanding. A severed wire produces 0 mA, and because 0 mA is not a valid process value, the receiving end can tell the difference between "the tank is empty" and "I have lost the transmitter". A 0–10 V or 0–20 mA signal cannot make that distinction at all.
Scaling is linear: 4 mA is 0 %, 12 mA is 50 %, 20 mA is 100 %. So a loop reading 8 mA on a 0–10 bar transmitter is reporting 2.5 bar, and you can check the PLC's displayed value against your measured current in one step. When they disagree, the fault is in the scaling or the card, not in the field.
Two practical points. The loop needs a power supply somewhere, and on a two-wire transmitter that supply usually comes from the input card — so "no reading" can mean the card is not providing loop power. And the loop has a maximum total resistance, so adding another indicator in series can push it over and cause readings to droop at the top of the range.
Diode-protected coils
A DC coil is an inductance, and switching one off produces a large reverse voltage spike that will destroy transistor outputs and pit relay contacts. The remedy is a flyback diode across the coil, reverse-biased in normal operation so it does nothing until the field collapses.
Because it is a diode, polarity matters. Connected the right way round it is invisible; connected backwards it is a short circuit across the supply the moment the coil is energised. This is the second half of Chapter 3's promise about DC polarity, and it is why a coil that blows a fuse instantly after rewiring is nearly always a coil someone has fitted the wrong way round.
What normally fails
- Symptom
- A photoelectric sensor works intermittently, or stops working gradually over weeks
- Likely cause
- Lens contamination or slow mechanical misalignment
- How common
- Very common
Dust, product mist, condensation, a knock from a pallet, a bracket that has been vibrating loose for a month. The commonest sensor fault on any plant and almost always visible. Clean it and check alignment before reaching for a meter — the sensor's own LED tells you the answer for free.
- Symptom
- A sensor works when the machine is stationary and drops out while an axis moves
- Likely cause
- Cable fractured inside a drag chain or flexing loop
- How common
- Very common
Chapter 3's flexing-cable failure again, and it recurs across chapters because it recurs across plants. If the symptom correlates with position or movement rather than with time, suspect the moving cable before the device on the end of it.
- Symptom
- A replacement sensor does not work either, and neither does the one after that
- Likely cause
- PNP fitted where the card needs NPN, or the reverse
- How common
- Common
The mismatch produces an input that never changes state, which is indistinguishable from a dead sensor — so the natural response is to fit another one the same way. Check the card's type and the sensor's type before the third one goes on.
- Symptom
- A capacitive sensor stays on, or triggers with nothing in front of it
- Likely cause
- Product build-up, condensation or washdown residue on the sensing face
- How common
- Common
Capacitive sensors detect nearly anything, which includes their own contamination. Common on wet-side and powder applications. Clean first; adjust sensitivity only after, and treat a sensitivity adjustment that keeps needing to be repeated as evidence of a mounting or shielding problem.
- Symptom
- An analogue value reads zero or full scale and will not move
- Likely cause
- Loop broken, no loop power, or a scaling mismatch between transmitter and card
- How common
- Common
Measure the loop current and compare it against what the PLC displays. 0 mA means the loop is broken or unpowered — it is not a process value. A current that is correct while the displayed value is wrong puts the fault in scaling or in the card.
- Symptom
- A machine's position drifts over a shift, or a speed feedback is consistently low
- Likely cause
- Encoder coupling slipping on the shaft, while the encoder itself is perfect
- How common
- Occasional
Clean quadrature, correct levels, no missing pulses — and a reading that does not match reality, because the encoder is faithfully reporting a shaft it is no longer firmly attached to. Only physical evidence separates this from a genuine mechanical fault downstream.
- Symptom
- A two-wire sensor's input never turns off
- Likely cause
- Leakage current through the sensor holding a high-impedance PLC input on
- How common
- Occasional
Two-wire devices draw a milliamp or two even when off, and a modern input can read that as a signal. Measure the terminal voltage with the sensor unactuated; a bleed resistor across the input is the usual fix.
How to troubleshoot it
Compare what the PLC believes with what is physically true
Stand at the machine and look at the thing the sensor is supposed to be sensing, then look at the input state. Those two facts together are the whole diagnosis in miniature: agreement means the sensor is honest and the fault is elsewhere; disagreement tells you which direction to search.
Read the sensor's own LED before anything else
Nearly every sensor has one, and it is the cheapest information on the machine. An LED that follows the target correctly while the PLC input does not move puts the fault in the wiring, the card or the program. An LED that does not respond puts it at the sensor or its target.
Check the target, not just the device
Is the thing actually present, in range, the right material, the right colour, the right finish? A stainless replacement part on an inductive sensor, a black product on a diffuse photoelectric, or a target that has drifted 2 mm further away are all sensor faults with nothing wrong with the sensor.
Clean the face and check the alignment
Especially photoelectric and capacitive. This resolves a large share of sensor calls outright and takes under a minute. Look at the bracket too — a mounting that has slowly rotated is a fault that will come back after a clean.
Measure at the input terminal, not at the sensor
SafetyThe measurement that separates the field from the panel. A correct signal at the sensor and nothing at the card means the fault is in the cable or the terminations between them, which is where it usually is.
Actuate it by hand with a known-good target
Put metal in front of the inductive sensor, block the beam, press the limit switch. Watching the LED and the input change together under your own control removes every ambiguity about whether the machine is presenting the target correctly.
Confirm the sensor type matches the card
PNP against sourcing input, NPN against sinking. Do this before fitting a replacement rather than after — this is the check that stops the third sensor going on the same wrong way.
For an analogue loop, measure the current and compare it with the display
Measure in series or with a clamp designed for it, then scale it: 4 mA is 0 %, 20 mA is 100 %. Current correct and display wrong is scaling or the card. Current at 0 mA is a broken loop, not a process value. Current plausible but not matching the process is the transmitter or its installation.
Flex the cable, deliberately, if the fault is intermittent
With the input monitored, work along the cable by hand, particularly where it enters a drag chain or a gland. An intermittent that responds to your hand has just been located, and this is far faster than waiting for the machine to reproduce it.
Common technician mistakes
Believing the input state instead of walking to the machine
WhyThe PLC's view is on a screen in a comfortable place and the machine is not. But the screen only shows what the sensor said, and the entire question is whether the sensor was right. Thirty seconds of looking at the actual target resolves what an hour of program monitoring cannot.
Replacing a sensor that was telling the truth
WhyThe sensor is cheap, in stock, and easy to swap, which makes it the path of least resistance when a machine says a part is missing. But if the part really is missing, or the target has moved, or the cable is broken, the new sensor reports exactly the same thing — and now the fault has a red herring attached to it. Conveyor 04 is this mistake at mission length.
Fitting the third sensor the same wrong way
WhyA PNP/NPN mismatch presents as a completely dead input, which is what a dead sensor looks like, so the reasonable inference is a bad part. The evidence that should redirect you is that the replacement behaves identically — a fault that survives a component swap was never in the component.
Turning the sensitivity up to make it work
WhyNearly every proximity and photoelectric sensor has an adjustment, and turning it up makes the symptom stop. What it usually does is compensate for contamination, misalignment or a target that has drifted, all of which continue getting worse. A sensitivity adjustment that needs repeating is a mechanical fault with an electrical dressing.
Reading 0 mA as a process value of zero
WhyThe display says zero and the tank might genuinely be empty, so the reading is plausible. But 0 mA is below the live zero and is therefore not a measurement at all — it is the loop reporting that it is broken. Confusing the two sends you to inspect a vessel when the fault is a wire.
Assuming polarity does not matter because it is only 24 V
WhyChapter 3's point, met in the field. On a DC coil with a flyback diode, reversing the connections puts a forward-biased diode straight across the supply. On a three-wire sensor it means the output never functions. Low voltage is not the same as forgiving.
Hands-on challenge
Scenario
Case packer — 'the part-present sensor has failed again'
The case packer stops with PART NOT PRESENT. Two new proximity sensors have already been fitted this week, both from stores, and the fault is unchanged.
What you find at the machine:
- With a case in position, the sensor's LED lights cleanly and goes out when the case leaves. It follows the target exactly.
- The PLC input for that sensor never changes state. It reads off with the case present and off without it.
- The sensor body is marked PNP, NO.
- The input card is an older module and the machine is a Japanese-built line from the late 1990s.
- The target gap measures 4 mm; the sensor is rated for 8 mm on mild steel.
- The cable does not flex in service and shows no damage.
Write down: what the two failed replacements tell you, what the LED behaviour proves about the sensor, what you suspect and why, the one measurement that would confirm it, and what you would do about the 4 mm gap.
Show how to approach it
Two sensors have already been fitted. Before a third goes on, work out what the existing evidence actually rules out.
- A fault that survived two component swaps was never in the component. That is the single most important line of evidence, and it points at wiring, card type, target or program — not at the sensor.
- The LED following the target is decisive. The sensor is detecting correctly and outputting something. The failure is downstream of the sensing element.
- A dead input with a working LED is the PNP/NPN signature. The sensor senses, drives its output, and the card cannot see it because it is looking for current in the other direction.
- Check the card, not the catalogue. The original sensor may well have been NPN and the stores replacement PNP — a very common substitution when a part number is superseded.
- The measurement that confirms it is the voltage at the input terminal with the target present. A PNP output on a sinking card will sit at 24 V and the input will read it as nothing.
- The 4 mm gap is worth noting but is not the fault. It is within range for the sensor, and a range problem would have shown as an LED that flickers or does not light — not as an LED that follows the target perfectly.
Knowledge check
Five questions. Each is answerable by reasoning about what a device can and cannot report, rather than by recalling a specification.
Question 1 of 5