Hub · Interactive
How Industrial Sensors Detect a Part
Before a machine clamps or presses a part, it has to know the part is there. Sensors tell it. This page covers the common types, how far each one can see, what each one misses, and how they wire to a PLC. There is a test bench and a wiring checker to try.
Start here
1What a sensor tells the PLC
Most sensors on a machine answer one yes-or-no question. Is the part in the nest? Has the cylinder come back? Each sensor is wired to one PLC input, and the program won’t take the next step until the right inputs are on. For what happens on the PLC side, see How a PLC Runs a Machine.
Part arrives → sensor switches → PLC input turns on → program moves to the next step
Contact
Limit switches. The part or a cam pushes a lever and the contacts change over. Simple, but the part has to touch it.
Proximity
Inductive and capacitive sensors. They sense through a field in front of the face, a few millimeters out, with no contact.
Light
Photoelectric sensors. A beam of light, working from a few millimeters out to many meters depending on the type.
Types
2Limit switches and proximity sensors
These are the sensors you find closest to the part: on the fixture, in the nest, on the cylinder. Their ranges are short, measured in millimeters.
Limit switch
A mechanical switch with a roller lever or plunger. When the part pushes it far enough, the contacts change over. Easy to understand and easy to check with a meter, and it can switch AC or DC without any power of its own. The part has to touch it with enough force (typically a few newtons), the lever and contacts wear, and the cam or part has to be set so it actuates the switch without crushing it.
Inductive proximity sensor
A coil behind the face sets up a high-frequency magnetic field. Metal in the field draws energy from it through eddy currents, and the sensor switches. Metal only, short range, no contact. Oil, coolant and dust don’t bother it, which is why it is the usual choice for checking steel parts and machine positions.
How far an inductive sensor sees
The datasheet gives a rated sensing distance, Sn, measured on a square plate of mild steel 1 mm thick. Other metals absorb less energy from the field, so the sensor has to be closer to see them. Multiply Sn by the correction factor.
| Size | Shielded | Unshielded |
|---|---|---|
| M8 | 1.5 mm | 2.5 mm |
| M12 | 2 mm | 4 mm |
| M18 | 5 mm | 8 mm |
| M30 | 10 mm | 15 mm |
| Metal | Factor | M18 rated 8 mm |
|---|---|---|
| Mild steel | 1.0 | 8 mm |
| Stainless | 0.7–0.8 | 5.6–6.4 mm |
| Brass | 0.4–0.5 | 3.2–4 mm |
| Aluminum | 0.35–0.5 | 2.8–4 mm |
| Copper | 0.25–0.4 | 2–3.2 mm |
These are typical figures. Extended-range models reach about twice as far, and some sensors (sold as “factor 1” types) see all metals at the same distance. Always check the datasheet of the sensor you are buying.
Shielded or unshielded. A shielded (flush) sensor has a metal band around the coil, so its field points straight ahead. You can mount it flush in a steel bracket. An unshielded (non-flush) sensor lets the field spread to the sides as well, which gives more range, but it needs a metal-free zone around the head and more spacing from the next sensor. The datasheet shows the clearances.
Capacitive proximity sensor
The face is one plate of a capacitor. Anything that changes the capacitance in front of it switches the sensor: metal, plastic, wood, glass, liquid, powder. Water is a strong target, plastics are weak ones. It can see through a thin non-metal wall, so it is used to check the level in a plastic tank or a hopper. Most have a sensitivity screw, set so the sensor sees the contents and ignores the wall. Humidity, a wet film or product build-up on the face can look like a target too.
Magnetic cylinder switch
Most pneumatic cylinders on automated machines have a magnet ring on the piston. A small switch clamped in the slot along the body turns on when the piston is underneath, so the PLC knows the cylinder is extended or home with no external bracket or target. Reed types are 2-wire with a tiny contact in a glass tube. Electronic types are 3-wire, PNP or NPN, with nothing to wear. On a machine with several cylinders these make up a good share of the inputs. The cylinders themselves are covered in How Pneumatics Move a Machine.
Types
3Photoelectric sensors
A photoelectric sensor sends out light, usually red or infrared from an LED, and watches for it to come back. The three basic types differ in where the light ends up.
Through-beam
Emitter on one side, receiver on the other. The part breaks the beam. It has the longest range of the three and is the most reliable on opaque parts of any color or finish. The cost is two units to mount, wire and line up.
Retro-reflective
Emitter and receiver in one housing, aimed at a reflector. The part breaks the beam. One cable instead of two. A shiny part can bounce the light back like the reflector does and get missed. A polarized model fixes that by accepting only light that a corner-cube (prism) reflector has turned through 90°.
Diffuse
The part is the reflector. Light bounces off it and back to the sensor. Easiest to fit, with nothing on the far side. Range is rated on white paper and drops on dark or dull parts, and a bright surface behind the part can fool it.
Background suppression. A diffuse sensor with background suppression (often marked BGS) works out distance from the angle the light comes back at, instead of how much comes back. You set a distance and it ignores anything beyond it. Dark and light parts switch at nearly the same point, so it handles black parts much better than a plain diffuse sensor.
Light-on or dark-on. Most photoelectric sensors have a switch or wire to choose whether the output is on when the receiver sees light or when the beam is blocked.
Fiber optic
The amplifier sits on a DIN rail or bracket, and thin fibers carry the light to the sensing point. The heads are very small, so they fit inside nests and fixtures and can see small parts and edges. Glass-fiber heads also take heat that a normal sensor wouldn’t survive.
Laser
A laser gives a small, sharp spot that stays small over distance. Useful for tiny parts, narrow gaps and precise positions. Most are Class 1 or Class 2. Class 2 means don’t stare into the beam.
Try it · Interactive
4Sensor test bench
Pick a sensor and a part, then move the slider. The lamp shows what the sensor output would do and the text explains why. The numbers are typical values for standard sensors, not a datasheet. Real sensors of the same model can differ by about ±10%.
NOT DETECTED
The bench assumes the part is at least as wide as the sensor face and sits square to it. Smaller or angled parts give less range.
Wiring · Interactive
5PNP, NPN and the PLC input card
Most DC proximity and photoelectric sensors have three wires: brown to +24 V, blue to 0 V, and black for the output. The output is a transistor, and it comes in two types. The sensor and the input card have to suit each other or the input never turns on.
PNP (sourcing) sensor
When it detects, it connects the black wire to +24 V. Current flows out of the sensor, into the PLC input, and back to 0 V through the card’s common (COM).
NPN (sinking) sensor
When it detects, it connects the black wire to 0 V. Current flows from +24 V through the card’s COM, out of the PLC input, and into the sensor.
Why a PNP sensor needs a “sinking” input. The words describe which way current flows at each device. A PNP sensor pushes current out (it sources). The input it feeds has to take that current in and pass it to 0 V, so it is called a sinking input. It works the other way for NPN: the sensor pulls current in, so the card has to supply it, and that is a sourcing input. So the pairs are PNP with sinking and NPN with sourcing.
The quickest check is to ignore the words and look at where the card’s COM goes. COM to 0 V takes PNP sensors. COM to +24 V takes NPN sensors. Some PLC manuals, mostly Japanese ones, name the input after the sensor it accepts and use the words the opposite way, so go by the wiring diagram in the manual. Many small PLCs have inputs that work either way, set by where you connect COM, but every input sharing one COM has to be the same type.
Sensor LED ON
PLC input X0 ON
Normally open or normally closed
A normally open (NO) output turns on when the sensor detects. A normally closed (NC) output is on with nothing there and turns off when it detects. NC is used where a cut cable should look like a problem. A jam sensor wired NC, for example, reads a broken wire the same as a jam, and the machine stops. Four-wire sensors give both, usually NO on black and NC on white.
Two-wire sensors
A 2-wire sensor goes in series with the input like a switch. Its electronics still need a little current when it’s off, so a small leakage current flows all the time (often around 0.5 to 1.5 mA), and it drops several volts when on. If the leakage is more than the input card’s off-state current, the input can stay on or flicker. Check both datasheets before you mix them.
On the machine
6Getting a sensor to work every cycle
A sensor that works on the bench can still fail on the machine. Most problems come from a few things that are easy to plan for.
Target size
Sn is measured on a steel plate at least as wide as the sensor face (or three times Sn, whichever is bigger). A screw head or thin edge smaller than the face gives less range, so the sensor has to sit closer.
Leave margin
Set the sensor up at no more than about 80% of the range for that part. The IEC 60947-5-2 standard for proximity sensors only promises reliable switching out to 81% of Sn once temperature and supply voltage are allowed for.
Hysteresis
A sensor switches off a little farther out than it switches on. The gap, usually under 20% of the switching distance on inductive sensors, stops the output chattering when a part vibrates right at the edge of the range.
Mounting
Use a rigid bracket with slots for adjustment. Keep the sensor out of the part’s path so it can’t be used as a stop or hit. Don’t overtighten the nuts on plastic bodies. Run sensor cables away from motor cables and give them strain relief.
Keep it clean
Steel chips build up on inductive faces near machining and can hold the output on. Dust and oil mist on lenses cut a photoelectric sensor’s range. Plan for wiping, or pick a sensor and position that stay clear.
Line speed
A part moving past a sensor only gives a short pulse. If the pulse is shorter than the PLC’s input filter plus one scan, the PLC can miss it. See the example below.
Part length along travel: 10 mm Conveyor speed: 0.5 m/s = 0.5 mm per ms Time in front of sensor: 10 / 0.5 = 20 ms Sensor response: about 1 ms // fine PLC input filter + scan: 10 ms + 10 ms // borderline, can miss parts
Fixes, in rough order of cost: shorten the input filter (it is often several milliseconds by default and can be changed), use a sensor with an off-delay timer to stretch the pulse, wire it to a high-speed input, or give the sensor a longer flag to look at.
Choosing
7Which sensor for which job
A starting point. The part, the space and the environment decide the final pick.
| Job | Usually | Why |
|---|---|---|
| Confirm a steel part is seated in a jig | Inductive, shielded | Short range is fine, mounts flush, ignores oil and dust |
| Aluminum or brass part | Inductive mounted closer, a factor 1 type, or photoelectric | Standard inductive range drops to well under half |
| Plastic part, or a part in a plastic tray | Capacitive or diffuse photoelectric | Inductive sensors don’t see non-metals |
| Liquid or powder level through a plastic wall | Capacitive | Sees the contents through the wall |
| Boxes on a conveyor | Through-beam or retro-reflective | Long range, doesn’t care about box color |
| Dark parts at a fixed distance | Diffuse with background suppression | Switches on distance, not on how much light comes back |
| Clear bottles or film | Clear-object photoelectric sensor or ultrasonic | Ordinary beams pass straight through clear material |
| Very small parts or narrow gaps | Fiber optic or laser | Small heads, small spot |
| Cylinder extended or home | Magnetic switch in the cylinder slot | No bracket or target needed |
| Positive mechanical confirmation, dirty area | Limit switch | Works by contact, no field or beam to disturb |
| Orientation, print or color check | Vision sensor | An on/off sensor can’t tell |
Applications
8Where this shows up in our builds
The custom automation equipment we build runs on sensors and PLCs. Here is where sensors typically come in on the kinds of machines in our projects.
Custom Automation Equipment with PLC Control
Nearly every PLC input on a machine like this is a sensor or a switch: part present, cylinder extended or home, guard closed. Choosing the sensors and designing their brackets is part of the machine design.
Semi-Automated Production Jigs
On jigs for assembly pressing or grease application, the operator loads the part and a sensor in the nest confirms it is there before the press or dispenser runs. Cylinder switches tell the PLC when the press is back up.
Automated Drum Shaker
A machine like this has to know the drum is loaded and the guard is shut before it starts. Proximity sensors, limit switches and door switches are the usual ways to confirm those.
Large Profile Setting Jig
A large part has to sit against its locators before it is clamped. Where a jig needs proof of that, a sensor at each locator gives it.
Table-top machines
Small machines leave little room. Short shielded M8 and M12 inductive sensors, fiber optic heads and slot-mounted cylinder switches fit where a bigger sensor won’t.
Check yourself
9Quick quiz
1. You need to detect an ABS plastic part 3 mm from the sensor. Which one works?
2. An inductive sensor is rated Sn 8 mm. About how far will it see an aluminum part?
3. The input card’s COM is wired to 0 V, so it is a sinking input. Which sensor output does it need?
4. A retro-reflective sensor keeps missing shiny chrome parts. What usually fixes it?
Score: 0 / 4