Sensors
An automated machine needs to know what’s happening: whether the workpiece is present, whether the door is closed, where the axis is located, and how hot the spindle cartridge is. This information is provided by sensors—the “sense organs” of mechatronics. In this chapter, we’ll look at how the most commonly used sensors in the workshop work, how they connect to a PLC or a CNC controller, how they measure position, speed, force, pressure, and temperature, and how to identify a faulty sensor using a tester.
47.1 Sensors and Transducers
A sensor is a device that detects a physical quantity (a position, a force, a temperature, the presence of an object) and converts it into an electrical signal. The signal is sent to a PLC (Chapter 49) or a numerical control system (Chapter 50), which reads it and decides what to do: start a cycle, stop an axis, or trigger an alarm.
In everyday language, “sensor” and “transducer” are used interchangeably. Strictly speaking, a transducer consists of the sensing element—the part that responds to the physical quantity (such as a coil, a photodiode, or a wire whose resistance changes)—and the signal conditioning circuit, which amplifies, filters, and converts the signal into a standard form: a closing contact, a voltage from 0 to 10 V, a current from 4 to 20 mA, or a series of pulses. The entire sequence, from the physical quantity to the control signal, is called the measurement chain.
Digital and Analog Sensors
Sensors are divided into two main categories, based on the signal they produce.
- Digital (also known as on/off, binary, or threshold): The output has only two states, on or off. They answer a question with yes or no: Are the workpieces there? Is the cylinder fully extended? Is the door closed? These make up the vast majority of sensors in a machine: limit switches, proximity sensors, photoelectric sensors, pressure switches, and thermostats.
- Analog: The output varies continuously with the measured quantity, within a measurement range. They answer the question “how much?”: how many bar are in the circuit, what is the oil temperature in degrees, how many kilograms does the container weigh? The standard signals are 0–10 V and 4–20 mA; Chapter 46 explains their electrical characteristics.
There is a third category: pulse sensors, such as encoders. Each pulse represents a small position step, and by counting them, a displacement is measured. The signal is digital, but the information is a continuous quantity.
47.2 Sensor Characteristics
Each sensor has a technical data sheet. To read it, you need to understand the meaning of a few terms that apply to all types.
- Measuring range (or operating range): the range of values within which the sensor operates. A pressure transducer rated from 0 to 10 bar, an inductive sensor that detects metal up to 8 mm.
- Resolution: the smallest change that the sensor can detect. An encoder with 10,000 steps per revolution has a resolution of 0.036°.
- Repeatability: the degree to which the sensor provides the same response when the measurement is repeated under the same conditions. For a zero sensor, this is the most important quality: it is not necessary to know exactly at what distance it triggers; what matters is that it always triggers at the same point. For proximity sensors, it is usually a few percent of the trigger distance.
- Precision (or accuracy): how closely the measured value approximates the true value. A sensor can be highly repeatable but not very precise: it makes errors, but always by the same amount, and the error can be corrected through calibration (Chapter 31).
- Hysteresis: In digital sensors, this is the difference between the point at which the output turns on and the point at which it turns off. It is intentional: without hysteresis, an object resting exactly on the threshold, even with slight vibration, would cause the output to turn on and off continuously (“flickering”).
- Response time: the time between a change in the measured quantity and a change in the output. For proximity sensors, it is on the order of a millisecond or less; for a temperature probe inside a well, it can be as long as tens of seconds.
- Switching frequency: For digital sensors, the maximum number of on/off cycles per second, measured in hertz. It counts when the sensor is counting teeth, cams, or fast-moving workpieces.
An inductive sensor activates when a cam reaches 5.0 mm; the specified hysteresis is 10%. The workpiece stops 5.2 mm from the face and vibrates by ±0.2 mm. Does the output fluctuate?
An inductive sensor counts the teeth on a 12-tooth wheel to monitor the revolutions of a shaft. The sensor's data sheet specifies a maximum of 500 Hz. Is that sufficient for up to 1,500 rpm? What about 3,000?
47.3 Mechanical Limit Switches
The limit switch (or position microswitch) is the simplest sensor: a switch that opens or closes when a part of the machine presses against it. A cam mounted on the slide pushes a roller or a plunger, and the plunger moves the contacts. It does not require a power supply, is not dependent on the material of the cam, and can handle relatively high currents; however, it has parts that wear out and must make physical contact, so it is slower and less precise than an electronic sensor.
NA and NC Contacts
The contacts of a limit switch (and of any switch or relay) are described in their resting state—that is, when nothing is pressing them.
- NA, normally open (NO): open when not actuated; closes when pressed. The terminals are numbered 13-14 (or 23-24, 33-34).
- NC, normally closed (NC): closed when at rest; opens when pressed. The terminals are numbered 11-12 (or 21-22).
Why does the safety device use an NC contact?
For a safety function (open door, shaft out of travel, emergency stop button), the NC contact is always used; current flows when everything is in order and is interrupted to trigger a stop. This is the principle of the standby current: a broken wire, a disconnected connector, an oxidized terminal, or a power outage all have the same effect as an open contact, causing the machine to stop. With an NO contact, however, the same fault would make it impossible to transmit the stop signal, and no one would notice until the day it was actually needed.
There is a second risk: a contact that has carried too much current may stick (micro-weld) and remain closed even when the cam presses it. For this reason, safety limit switches have positive-break contacts (symbol: an arrow inside a circle): the plunger is connected to the NC contact bridge by a rigid element, with no springs in between, and when the cam pushes it, it forces the contacts apart even if they are stuck together. These topics are covered in full in Chapter 51, on machine safety.
An axis moves at a rapid feed rate of 24 m/min and brakes with a deceleration of 3 m/s². The control system responds to the limit switch in 10 ms. What is the minimum distance from the mechanical stop at which the overtravel limit switch should be installed?
47.4 Inductive and Capacitive Proximity Sensors
Proximity sensors detect an object without touching it. They have no moving parts, are wear-resistant, switch in less than a millisecond, and are enclosed in a sealed housing: they are the most widely used sensors in machine tools.
The Inductive Sensor
Inside the inductive sensor is a coil wound around a ferrite core, powered by an oscillator that creates an alternating magnetic field in front of the sensing surface. When a metallic object enters the field, eddy currents (or Foucault currents; see Chapter 44) are induced in the metal, which draw energy from the oscillator: the runout amplitude decreases, a detection circuit detects this, and the output stage switches. An LED on the housing lights up when the output is active.
The inductive sensor detects only metals and ignores plastic, wood, water, oil, and non-metallic chips. It is ideal for monitoring the position of cams, slides, pistons, tools, and spindles.
The intervention distance
The distance at which the sensor switches depends on the size of the coil—that is, the diameter of the body—and on the material of the target. The data sheet specifies the nominal switching distance Sn, measured using a standardized target: a 1-mm-thick square of mild steel with a side equal to the diameter of the sensing face (or three times Sn, if it is larger). Two other parameters defined by the standard for proximity sensors (EN 60947-5-2) are important for the project:
- the actual distance Sr, that of a single specimen, which can range from 0.9 to 1.1 times Sn;
- The safe operating distance Sa, between 0 and 0.81 · Sn: within this distance, the sensor operates reliably, regardless of which model is installed and within all permitted voltage and temperature ranges. The target must always be positioned within Sa.
| Body | Shielded Sn (mm) | Unshielded SN (mm) | Switching frequency (Hz) |
|---|---|---|---|
| M8 | 1,5 | 2,5 | from 1,000 to 3,000 |
| M12 | 2 | 4 | from 800 to 2,000 |
| M18 | 5 | 8 | from 300 to 1,000 |
| M30 | 10 | 15 | from 100 to 500 |
These are approximate values for standard sensors; models with extended range (up to two or three times these values) are available. Refer to the manufacturer's data sheet for details.
With metals other than steel, the distance decreases because the metal absorbs less energy from the field. Sn is multiplied by a reduction factor:
| Target Material | Reduction factor (approximate) |
|---|---|
| Mild steel (S235) | 1,00 |
| Austenitic stainless steel | 0,70 |
| Brass | 0,45 |
| Aluminum | 0,40 |
| Copper | 0,30 |
Rounded average values: These vary from one manufacturer to another and depending on the thickness of the target. There are sensors known as “factor 1” sensors that detect all metals at the same distance.
A screened M18 sensor (Sn = 5 mm) must be aligned with a brass bushing. At what distance should it be mounted?
An aluminum bracket passes within 4 mm of the sensor's surface. Which sensor in the table can reliably detect it?
The Capacitive Sensor
The capacitive sensor has an electrode as its sensing element, which forms a small capacitor with the surrounding environment (Chapter 44). Any material that enters the field changes the capacitance, with the effect increasing as the material’s dielectric constant rises: water affects it significantly, oil and plastic less so, and air almost not at all. The internal circuit detects this change and switches.
That’s why the capacitive sensor can detect non-metallic materials as well: plastic, wood, glass, cardboard, granules, powders, and especially liquids. It can even detect liquid through the plastic or glass wall of a tank, which has a lower dielectric constant than its contents. A trimmer screw on the back adjusts the sensitivity to ignore the wall and detect only the liquid. However, it is more sensitive to humidity, dirt, and droplets on the surface, and the detection range depends heavily on the material: it must always be adjusted on-site using the actual material.
47.5 Photoelectric Sensors
Photoelectric sensors (photocells) use a beam of light—almost always infrared or red—that is pulse-modulated to prevent interference from ambient light. An emitter (an LED or a small laser) emits the light, and a receiver (a photodiode or a phototransistor) detects it. They detect any object that blocks or reflects the light, at distances much greater than those of proximity sensors. There are three main types.
Barrier
The transmitter and receiver are two separate devices, positioned opposite each other. The object triggers the output when it interrupts the radius. This is the most reliable type with the longest range (up to several tens of meters); it can also detect shiny or thick transparent objects, but requires two units to be mounted, aligned, and wired.
A reflective strip
The transmitter and receiver are housed in the same unit; a reflector (like those on bicycles) is mounted in front of it, which reflects the light back exactly where it came from. The object switches off the output when it blocks the returning light. Only one unit needs to be wired, and the range extends to a few meters. Shiny objects could reflect the light and “fool” the sensor; for this reason, the best models have a polarizing filter, which recognizes light rotated by the reflector and filters out light reflected by a mirror or a sheet of metal.
Direct reflection on the object
Here, too, the transmitter and receiver are housed in the same device, but without a reflector: the object itself scatters a small amount of light toward the receiver. The output switches when the object is present. It’s the easiest to install, but the range is short (from a few centimeters to about one meter) and depends on the color and finishing: a white object can be detected from much farther away than a matte black one. Models with background suppression measure the angle of the returning light and ignore anything beyond a preset distance, even if it is bright.
Photocells often have a light-on/dark-on selector (output active when light is received or when light is absent), which acts as a choice between NO and NC. The main enemies of photoelectric sensors are emulsion mist, dust on the lenses, and vibrations that misalign the beam; they should be cleaned and checked regularly.
Workpieces 15 mm long, spaced 10 mm apart, pass along a conveyor belt moving at 1.2 m/s. A photoelectric sensor with a response time of 0.5 ms counts them. The PLC has a cycle time of 10 ms. Will this work?
47.6 Magnetic and Reed Sensors on Cylinders
Magnetic sensors switch when a magnetic field is present, usually that of a permanent magnet. They are most commonly used on pneumatic cylinders (Chapter 42): the piston has a magnetic ring, and the sensors are mounted on the outside of the cylinder barrel, in the designated grooves, without drilling into the cylinder. The cylinder barrel is made of aluminum or stainless steel, which do not shield the magnetic field. A sensor near the bottom indicates “cylinder retracted,” while one near the head indicates “cylinder extended”; in pneumatic notation, they are often designated a0 and a1 for cylinder A.
There are two types.
- Reed switch: two strips of ferromagnetic material enclosed in a glass tube filled with an inert gas. The magnetic field magnetizes them and causes them to touch: this is true contact, which requires no power supply and works even with alternating current. It is inexpensive, but it has moving parts, bounces when closing, and is susceptible to strong currents and vibrations.
- Electronic (Hall-effect or magnetoresistive): They have no moving parts, switch faster, and last longer. They are connected using three wires, just like proximity sensors (paragraph 47.8).
The sensor switches over a zone of a few millimeters (from 5 to 15 mm, depending on the magnet and the sensor), not at a specific point. For a limit switch, this isn’t a problem: the piston reaches the end of its travel and stops there. For a sensor positioned midway through the travel—which the piston passes through without stopping—the signal is brief, and the PLC might not detect it.
A mid-stroke magnetic sensor has a sensing range of 10 mm. The PLC has a cycle time of 10 ms. How long does the signal last if the piston travels at 0.5 m/s? And at 1.5 m/s?
47.7 Ultrasonic Sensors
The sensor at ultrasound It works like an echo in the mountains, or like a bat's sonar. A piezoelectric transducer sends out a short sound pulse at a frequency too high for the human ear (from about 40 to 400 kHz), then listens for theecho that is reflected back from the object. The time between the pulse and the echo, known as flight time, is proportional to the distance. The sound travels back and forth, so the distance is half the total distance traveled.
The ultrasonic sensor can detect almost anything: liquids, granules, clear glass, and objects of any color. It is widely used to measure liquid levels in tanks and hoppers and to measure distances of up to a few meters. However, it has a blind spot in front of its sensor face (a few centimeters), where it cannot detect anything because it is still emitting sound; it struggles with very steep surfaces, which reflect the echo elsewhere, and soft materials like foam, which absorb it. And since the speed of sound depends on temperature, high-quality models have a sensor that compensates for this.
An ultrasonic sensor is mounted 1.50 m above the bottom of an emulsion tank and measures a time-of-flight of 4.2 ms at 20 °C. How much emulsion is there?
The same sensor, without compensation, always calculates a value of 343 m/s. In the summer, the air in the tank is 35 °C, and the flight time is still 4.2 ms. How much of an error is there?
47.8 The Connection: PNP, NPN, and Two-Wire
Electronic sensors (inductive, capacitive, photoelectric, and electromagnetic) require a power supply, almost always 24 V DC (Chapter 46). The most common type has three wires, with colors specified by the standard:
| Color | Acronym | Function |
|---|---|---|
| Brown | BN | positive power supply, +24 V |
| Blue | BU | negative power supply, 0 V |
| Black | BK | output (usually NA) |
| White | WH | second output, if any (usually NC or complementary) |
In M12 and M8 screw-type connectors—the most commonly used types—the contacts are numbered as follows: 1 brown, 2 white, 3 blue, 4 black.
PNP Output and NPN Output
The sensor's output is a transistor that functions as an electronic switch (Chapter 46). The difference between the two types lies in which side this switch is on.
- PNP: The transistor connects the black wire to the +24 V. The load (the PLC input, a relay) is connected between the black wire and 0 V. When the sensor is active, there is 24 V on the black wire: this is referred to as positive logic, and the sensor “supplies” current to the load (in English source).
- NPN: The transistor connects the black wire to the 0 V. The voltage ranges from +24 V to ground. When the sensor is active, ground drops to 0 V: this is referred to as negation, and the sensor “absorbs” the load current (sink).
A PNP sensor must be connected to a PLC input designed to receive 24 V (known as a sink input, or “PNP”); an NPN sensor must be connected to an input that is activated when brought to 0 V. Mixing them up won’t cause any damage, but the signal won’t be transmitted. In Europe, PNP is almost always used: with positive logic, an output wire touching the machine’s ground (which is connected to 0 V and earth) sets the input to zero—that is, to “inactive”—which is the safest state; and “24 V = 1” is more intuitive to check with a multimeter. NPN remains common on machines and controls of Asian and American origins: always check the part number before replacing a sensor.
I want to directly control a 24 V, 1.2 W relay using a PNP sensor. The sensor's output can handle a maximum of 200 mA. Is that okay?
Two-wire sensors
The two-wire sensor is connected in series with the load, just like a switch: one wire goes to +24 V, and the other to the PLC input. It’s quick to wire and makes it easy to replace an old limit switch, but there’s a catch. The sensor must be powered by the load itself, so:
- When it is turned off, it allows a small residual current to flow (approximately 0.5 to 1.5 mA), which it needs to stay lit inside;
- When it is turned on, there is a voltage drop of a few volts (3 to 6 V), and the load receives less than 24 V.
According to the relevant standard (EN 61131-2), the 24 V inputs of PLCs reliably read “1” above 15 V and “0” below 5 V; in between, the value is uncertain. The standards specify different types of inputs: Type 2 and Type 3 inputs are designed to accept the residual current from two-wire sensors.
A two-wire sensor has a quiescent current of 1.0 mA and a voltage drop of 5 V. It is connected to two different PLCs: one with 3.3 kΩ inputs, the other with 7 kΩ inputs. What reading does each one get?
NA and NC Outputs
Electronic sensors also have NO (normally open—active when an object is present) or NC (normally closed—active when an object is not present) outputs. Some have both, on the black and white terminals (complementary outputs), while others are programmable. For a check such as “workpiece present,” NO is usually chosen; for a check such as “no obstacle” or “level not too low,” where a broken wire must trigger an alarm, the NC output is chosen, following the same reasoning as in paragraph 47.3. Today, many sensors also have an IO-Link interface: over the same three-wire cable, in addition to the on/off signal, they send the measured distance, internal temperature, and diagnostic data to the PLC, and they can be configured remotely.
47.9 The Incremental Encoder and Speed Measurement
To measure a position continuously, as a numerical control system does with its axes, on/off sensors are not enough: encoders are needed. A rotary encoder is mounted on the shaft of a motor or a lead screw and measures the angle of rotation; from this, the control system determines the position of the slide.
How It's Made
The optical incremental encoder has a disc made of glass or metal with a ring of slits (or opaque and transparent lines) spaced at regular intervals. On one side, an LED illuminates the disc; on the other, some photodetectors receive light through a mask fixed at the same pitch. As the disc rotates, the light passes through and is interrupted: each slit produces a pulse. The number of slits, that is, the number of pulses per revolution (PPR, pulses per revolution), you can choose from a few hundred to a few thousand: typical values are 1000, 1024, 2048, 2500, and 5000.
Channels A, B, and Z
- A and B: two readings on the same crown, offset by a quarter of a step. They produce two identical square waves, out of phase by 90° (they are said to be in quadrature). The order in which they change indicates the direction of rotation: if A rises when B is low, the shaft rotates in one direction; if A rises when B is high, it rotates in the other.
- Z (or zero channel, or reference mark): a single slot on an internal ring that produces one pulse per revolution. It is used for zero search (paragraph 47.13) and to synchronize the spindle during threading.
In machine tools, signals are transmitted in differential form: for each channel, there is also a negated signal (A and /A, B and /B, Z and /Z) on a twisted-pair cable. The receiver monitors the difference between the two wires, and any noise that is present on both wires equally cancels itself out.
Resolution and Multiplication by Four
The control counter doesn't just count the pulses from A: it counts on all fronts, up and down, A and B. At any given time, there are four edges, so an encoder with 2,500 pulses per revolution produces 10,000 counts per revolution. It is the multiplying by four (×4). If the encoder is mounted on the motor of a recirculating ball screw (Chapter 40), the linear resolution of the axis is the screw pitch divided by the number of counts per revolution.
A motor with an encoder that produces 2,500 pulses per revolution directly drives a ball screw with a 10-mm pitch. What is the resolution of the axis? And what about a motor with a 1,024-pulse encoder and a ball screw with a 5-mm pitch?
Using the axis from the previous example (10,000 counts per revolution, 10 mm pitch), after resetting to zero, the counter has counted 186,000 counts forward and 6,000 counts backward. Where is the slide?
Measuring Speed
Rotational speed is measured in two ways.
- Tachometer generator: a small permanent-magnet DC generator mounted on the shaft. It produces a voltage proportional to the speed—for example, 20 V per 1,000 rpm—and the polarity of the voltage indicates the direction of rotation. It was the speed sensor used in older DC drives; today it is found only on older machines.
- From the encoder: the controller counts how many pulses arrive within a certain time, that is, it measures their frequency. A single encoder is thus used for both position and speed, and this is the solution used in all modern servo drives (Chapter 48).
On channel A of a 2,500-pulse-per-revolution encoder mounted on a 10-mm-pitch screw, a frequency of 62.5 kHz is measured. What is the motor’s speed, and what is the speed of the slide? On another machine, a tachometer generator that produces 20 V per 1,000 rpm outputs 31 V: what is its speed?
47.10 Absolute Encoders, Optical Encoders, and Resolvers
The Absolute Encoder
The incremental encoder only knows how far it has moved since the last time. The absolute encoder, on the other hand, knows its exact position at any given moment, even right after it is turned on. The disk does not have a single ring of slits, but rather many concentric tracks, one for each bit: a file of photodetectors reads them all at once, and each angular position has a different code. With n tracks, 2n positions can be distinguished per revolution.
The tracks do not follow standard binary code but rather Gray code, in which only one bit changes between one position and the next (Chapter 46): if the bit readings are not perfectly simultaneous, the error remains within one step at most, rather than jumping to a distant value.
- A single-turn encoder knows its position within a single turn, but it does not know how many turns it has made.
- The multiturn encoder also counts revolutions: either using a series of discs connected by reduction gears, or with an electronic counter powered by a battery. On an axis with a lead screw, it knows the slide’s position throughout its entire travel: when powered on, the machine is immediately ready, with no need for zeroing.
Modern absolute encoders do not transmit bits over multiple files, but rather via a digital serial connection (using protocols such as EnDat, BiSS, SSI, or those specific to control manufacturers): two or four files carry position, revolutions, and diagnostic data.
An encoder has 13 bits per revolution and a 12-bit revolution count. How many positions does it distinguish in one revolution, what is its angular resolution, and what travel distance does it cover on a screw with a 10-mm pitch?
The optical ruler: direct measurement of the slide
The encoder on the motor measures the position by indirect: Count the number of turns of the screw and multiply it by the pitch, assuming that the screw is perfect and that the slide follows the lead screw without any clearances. But the screw has errors of step (a few micrometers on each segment), a little clearance or elastic deformation in the spiral and the supports, and above all, it It stretches as it heats up, because the rolling balls generate heat. The encoder doesn't detect any of this.
The optical line (or linear scale) is a glass or steel ruler with an engraved grid, secured to the base along its entire travel; a sensor mounted on the slide reads it using the same principle as an encoder (quadrature signals, paragraph 37.1). It measures the position really the sled, in such a way that direct: Errors in the lead screw are not included in the measurement, because the control system adjusts the motor until the line indicates that the slide has reached its destination. It is said that the axis operates at closed loop on the line. Scales are incremental (with reference marks, often spaced at a standardized distance to locate the zero point within a few millimeters) and absolute types.
During a day of heavy use, the 800-mm section of lead screw used by an axis heats up from 20 °C to 32 °C. By how much will the end-of-travel dimension be off if the axis is measured only using the encoder on the motor?
Without a ruler, modern controls mitigate the problem through pitch error compensation (a correction table measured with an interferometer; see Chapter 37) and through preloaded or internally cooled screws; but only the scale bar detects effects that change from hour to hour.
The Resolver
The resolver is an angle transducer with no onboard electronics: it is a small rotating transformer. The rotor is powered by an alternating voltage, and two fixed windings, spaced 90° apart, pick up two voltages that vary like the sine and cosine of the angle; based on their ratio, the drive calculates the position within the revolution. It is less precise than a good optical encoder, but extremely robust against temperature, vibrations, shocks, and dirt; for this reason, it is found on many brushless servomotors and in harsh environments.
47.11 Force, Weight, and Pressure
The strain gauge
L'strain gauge (strain gauge) is a grid of very thin metal wire or foil, bonded to an insulating substrate, which is in turn bonded to the workpiece being measured. When the workpiece deforms, the grid stretches or shortens along with it, and its resistance changes in proportion to the deformation ε (Chapter 10). The ratio of the relative change in resistance to the deformation is called calibration factor k, which is approximately 2 for metal strain gauges.
The variations are extremely small—fractions of an ohm—and a Wheatstone bridge is used to measure them: four resistors arranged in a diamond pattern, powered between two opposite vertices, with the output taken between the other two. At rest, the bridge is balanced and the output is zero; as soon as one resistor changes, a voltage of a few millivolts appears. By using four active strain gauges—two that stretch and two that contract—the signal is amplified, and the effects of temperature cancel each other out.
The load cell
A load cell is a steel or aluminum block, shaped to deform in a precise and repeatable manner, with four strain gauges already bonded and calibrated in a bridge configuration. It is used for weighing (scales, dispensers, hoppers) and for measuring compression, tensile, and clamping forces. The data sheet specifies its sensitivity in mV/V: a typical value is 2 mV/V, meaning 2 mV of full-scale output for every volt of supply voltage.
A 350 Ω strain gauge with k = 2 undergoes a strain of 500 µm/m: by how much does its resistance change? A 500 kg load cell, with a sensitivity of 2 mV/V and powered by 10 V, reads 7.4 mV: how much does the load weigh?
Pressure: Pressure Switches and Transducers
The pressure switch is a digital pressure sensor: a diaphragm or piston, pushed by pressure against an adjustable spring, triggers a contact when the set threshold is exceeded. It has a hysteresis (the “differential”) between the activation point and the return point. On machine tools, it monitors the compressed air supply, the hydraulic oil in the chuck, and the centralized lubrication system.
The pressure transducer, on the other hand, outputs an analog signal proportional to the pressure. Inside, it contains a diaphragm with strain gauges or a piezoresistive element, along with electronics that convert the signal to 0–10 V or, more commonly, to 4–20 mA. The current is not affected by the resistance of long cables, and the “live” zero at 4 mA makes it possible to distinguish a broken wire (0 mA) from zero pressure (4 mA), as explained in Chapter 46. The relationship between current and pressure is a straight line through two points (Chapter 7).
A transducer rated from 0 to 10 bar outputs 13.6 mA. What is the pressure? What current will it output at 2.5 bar? What does a reading of 0.2 mA mean?
47.12 Temperature and Other Quantities
Thermocouples
A thermocouple consists of two wires made of different metals that are soldered together at one end (the hot junction). If the tip is hotter than the other end (the cold junction, at the instrument’s terminals), a small voltage is generated between the two wires, amounting to a few tens of microvolts per degree (Seebeck effect). The thermocouple therefore measures a temperature difference: the instrument also measures the temperature of the cold junction and adds it (cold junction compensation). It is connected using compensation cables of the same type, never with ordinary copper wires.
| Type | Metals | Scope of Use (for reference only) | Average sensitivity (approximate) |
|---|---|---|---|
| K | nickel-chromium / nickel-aluminum | from −200 to 1200 °C | about 41 µV/°C |
| J | iron / copper-nickel (constantan) | from −40 to 750 °C | about 52 µV/°C |
Thermocouples are rugged, inexpensive, fast, and can reach extremely high temperatures (heat treatment furnaces, molds, injection molding machine nozzles), but they are not very accurate: a couple of degrees at best. The voltage does not increase in a perfectly linear manner, and instruments use standard tables; for a manual calculation, you can use the average sensitivity.
A reading of 15.6 mV is measured at the terminals of a K-type thermocouple; the cold junction is at 20 °C. What is the temperature inside the oven, assuming average sensitivity?
PT100 Resistance Temperature Detectors
The heat resistance takes advantage of the increase in a metal's resistance as the temperature rises. The most commonly used is the PT100: a platinum wire or film that has a resistance of exactly 100 Ω at 0 °C and increases by approximately 0.385% per degree. Within the range of 0 to 100 °C, the relationship is practically a straight line. It is much more accurate and stable than a thermocouple (Class A has an error of less than 0.15 °C at 0 °C), but it is slower and has a maximum operating range of a few hundred degrees. There is also the PT1000, which has a resistance of 1000 Ω at 0 °C.
When connected with only two wires, the PT100 also measures the resistance of the cables, which leads to errors; for this reason, it is connected using three wires (the instrument measures and compensates for the cable resistance) or four wires for laboratory measurements. Often, a small converter at the tip of the probe converts the signal to 4–20 mA.
What is the resistance of a PT100 at 60 °C? If the instrument reads 119.25 Ω, what is the temperature? And by how much would a two-wire PT100 with a total cable resistance of 1 Ω be off?
NTC Thermistors
The NTC thermistor (negative temperature coefficient) is a semiconductor whose resistance cala significantly, and in a highly nonlinear manner, as the temperature rises. It is small, inexpensive, and extremely sensitive, but has a limited range: it is used to protect motor windings, electronic components, and batteries, and as a thermostat. Motors also contain PTCs (whose resistance rises abruptly at a certain threshold, making them ideal for on/off protection) and KTY-type silicon sensors.
Level, Flow Rate, and Vibrations
- Level: In addition to the capacitive and ultrasonic sensors already discussed, float switches with reed contacts (the most common type used in oil and coolant tanks of machine tools) and hydrostatic pressure transducers at the bottom are used: pressure is given by p = ρ · g · h, so 78 cm of water corresponds to approximately 7,650 Pa.
- Flow rate: Turbine flow meters have a propeller that rotates with the fluid and sends a pulse each time a blade passes; electromagnetic and ultrasonic flow meters have no moving parts. A flow switch is the on/off version: it simply indicates whether the fluid is flowing, and it is the sensor that controls the cooling water for the spindles and lasers.
- Vibrations: Piezoelectric accelerometers measure acceleration (in m/s² or in multiples of g). Mounted on the spindle head, they allow for monitoring the bearings (a failing bearing vibrates more at characteristic frequencies), detecting cutting vibrations, and detecting a collision in just a few milliseconds.
The flow meter in a spindle's cooling circuit registers 450 pulses per liter; the PLC measures 150 Hz. What is the flow rate?
47.13 Sensors in CNC Machine Tools
A CNC lathe or machining center has dozens of sensors. Here are the most important ones and what they do.
- Encoders and optical scales for the axes and spindle (sections 47.9 and 47.10): They provide the controller with position and speed information and are the heart of the control loop (chapter 48).
- Over-travel limit switches: At each end of every axis, beyond the usable travel range, an NC-contact limit switch (or a safety sensor) that cuts power to the drives if the axis moves beyond that point. After zero search, the controller also uses software limits, which stop the axis before it reaches the limit switch; the limit switch remains the last line of defense before mechanical stop (example 47.3).
- Machine zero sensor: a limit switch or an inductive sensor, with its cam, used to find the zero point (below).
- Workpiece and tool measurement probes (section 37.9): The workpiece probe is mounted in the spindle like a tool and transmits contact information to the control via infrared or radio; the control system, using a probing movement (on Fanuc G31 machines, the “jump” command), records the position of the axes at the moment of contact. The tool measuring device, whether contact-type or laser-based, measures the length and radius of the tools and detects tool breakage.
- Door sensors: safety switches, often with a locking mechanism (electric lock), that keep the door closed as long as the spindle is rotating and prevent it from starting when the door is open.
- Pressure switches: compressed air supply (if the pressure drops below 5–6 bar, the machine triggers an alarm); hydraulic oil for the chuck and tailstock (if the clamping pressure drops, the spindle stops before the workpiece flies off); centralized lubrication of the guides (if the pressure does not rise within the expected time during each pump cycle, the control system signals a broken hose or an empty reservoir).
- Temperature Sensors: thermostats, PT100, PTC, or KTY sensors in the spindle motor and axis windings, in the cartridge bearings, in the hydraulic unit oil, and in the electrical cabinet. Some control systems use these temperatures to compensate for thermal expansion of the car.
- Level and flow switches: lubricating oil, hydraulic oil, coolant, water from the spindle cooling unit.
- Tool and spindle change: inductive sensors that indicate whether the tool is clamped or released in the spindle, the location of the tool magazine, and whether the exchange arm is in position; on the lathe, whether the turret is locked and what position it is in.
The Quest for Zero
With incremental encoders, when the system powers on, the controller does not know the position of the axes: a zero search must be performed (known in technical jargon as “zeroing” or “homing”; on Fanuc systems, this is done by returning to the reference point with G28 or the ZRN key). The most common method combines a zero sensor with the encoder’s Z channel:
- The axis moves quickly in the specified direction until the cam presses against the zero sensor;
- slow down and continue at a low speed until the cam releases the sensor;
- It stops at the first Z pulse from the encoder (or the line) that arrives after the button is released: that is the machine zero position.
The cam alone would not be enough: the sensor has a repeatability of a few hundredths, which also varies with temperature and speed. The Z pulse, on the other hand, always occurs at the same point in the rotation, with the precision of the encoder. The cam is only used to select which Z pulse to use from among the many—one per revolution. For this reason, the cam must be adjusted so that the release does not occur too close to a Z pulse: if it happened right there, a small variation would cause the system to select one pulse one time and the next pulse the next time, and the zero point would shift by an entire lead screw pitch. With absolute encoders, this search is unnecessary: the zero is set only once, during installation.
One axis has a 10-mm-pitch lead screw with an encoder mounted directly on the motor. After the cam is released, the axis moves toward the Z pulse at 100 mm/min. What is the maximum duration of this final phase?
47.14 Selection, Installation, and Troubleshooting
Choose the sensor
| What Should I See? | Suitable sensor |
|---|---|
| A metal cam or slide, just a few millimeters long | inductive |
| Piston Position in a Pneumatic Cylinder | magnetic (reed or electronic) |
| Plastic, wood, cardboard, liquid through a wall | capacitive |
| Any objects, even those far away | photoelectric (the safest barrier) |
| Levels of liquids and granules, transparent objects | ultrasound |
| High-force position, safety, no power supply | mechanical limit switch |
| Continuous Position and Velocity of an Axis | encoder, optical scale |
| Pressure: threshold or value | pressure switch or 4–20 mA transducer |
| Temperature: high or precise | thermocouple or PT100 |
Shielded and Unshielded
Inductive and capacitive sensors are classified into shielded (or “built-in,” in English flush) e unshielded (non-flush). On the screen, a metal ring around the coil concentrates the field in front of the face: the sensor can be mounted flush of a steel plate without the plate triggering it, but the operating distance is shorter. The unscreened version has a wider range and a greater distance (see the table in paragraph 47.4), but the head must protrude and a free zone made of metal.
Two sensors that are too close together interfere with each other: the fields of the two oscillators add up, causing the sensors to trigger randomly. As a general rule, leave at least twice the diameter between the axes of two adjacent sensors for screened sensors and three times the diameter for unscreened ones; two sensors facing each other must be kept even farther apart. If space is limited, there are models with different runout frequencies that can be mounted alternately. These are approximate values: refer to the manufacturer’s catalog for specifications.
Protection, Wiring, and Interference
- IP Protection Rating: The first digit indicates protection against solids (6 = dust-tight), and the second indicates protection against water (7 = temporary immersion, 8 = continuous immersion, 9K = high-pressure, high-temperature jets). Inside a machine tool covered in emulsion, a rating of at least IP67 is required; near the coolant jet, IP68 or IP69K is required, with a stainless steel housing.
- Installation: Secure the sensor with the two nuts without tightening them too much (the plastic housing will break). Protect it from impacts with chips and from direct contact with the target, which must pass in front of the sensor face and never hit it. A sensor that also acts as a stop will not last long.
- Cables: With an M12 or M8 connector, the sensor can be replaced in one minute; the cable must be secured without sharp bends, and if it moves along the axis, it must be suitable for cable chains (PUR cable for flexible installation).
- Interference: Sensor cables—especially those for encoders and analog signals—must be kept away from the power cables of motors and inverters (Chapter 45), which generate significant interference. Separate cable trays should be used, along with shielded cables with the braid grounded (usually on the control panel side, all the way around using a cable gland or a metal clamp) and differential connections for the encoders.
Troubleshooting
When a machine stops with an alarm such as “cylinder not in position” or “workpiece missing,” in most cases the problem is caused by a sensor, a cable, or a connector. Let’s proceed step by step.
- Check the LEDs: Many sensors have a green LED (power on) and a yellow LED (output active). A flashing LED often indicates a short circuit at the output or a target at the distance limit. The PLC inputs also have an LED for each channel, and the status of the inputs can be viewed on the control’s diagnostics page.
- Test the sensor: Hold a metal object close to it (for an inductive sensor) or your hand (for a capacitive sensor or a photoelectric sensor) and see if the yellow LED changes.
- Using a multimeter set to DC voltage, with the machine turned on and in a safe condition: there should be approximately 24 V between brown and blue (if there isn’t, the fault is in the power supply or the cable); between black and blue, for a PNP sensor, approximately 24 V when the object is present and approximately 0 V when it is not. For an NPN sensor, measure between black and brown. Then repeat the measurement at the PLC’s input terminal: if there is a signal at the sensor but not at the input, the fault is in the cable or the connector.
- Check the mechanical components: a sensor displaced by an impact, a loose cam, a layer of chips on the surface, or a cylinder that does not reach the bottom due to low pressure can all produce the same symptoms as a faulty sensor.
The control system indicates “chuck not closed,” but the operator sees the jaws closed around the workpiece. The sensor is a PNP inductive sensor. The sensor’s yellow LED is on, and the PLC input LED is off. With the multimeter: 23.8 V between brown and blue, 23.2 V between black and blue on the sensor, 0 V between the input terminal and the 0 V reference in the control panel.
47.15 The Formulas in This Chapter
| What | Formula | Units |
|---|---|---|
| Shut-off point with hysteresis | soff = son · (1 + H) | mm |
| Frequency of objects in front of the sensor | f = z · n / 60 | Hz |
| Braking distance (where to place the limit switch) | s = v² / (2 · a) | m |
| Safe working distance (inductive) | Sa ≤ 0,81 · Sn · km | mm |
| Distance Based on Flight Time (Ultrasound) | d = v · t / 2 | m |
| Speed of sound in air | v ≈ 331,3 + 0,606 · T | m/s |
| Two-wire sensor off | UOFF = Ir · Ri | V |
| Encoder resolution (×4) | rang = 360° / (4 · N) · rlin = P / (4 · N) | ° · mm |
| Revolutions per Pulse Frequency | n = 60 · f / N | revolutions per minute |
| Positions of an absolute encoder | 2n (n bits) | - |
| Thermal expansion of the screw | ΔL = α · L · ΔT | mm |
| Strain gauge | ΔR / R = k · ε | - |
| Load cell | Ufs = S · Ua · m = mfs · U / Ufs | mV · kg |
| 4–20 mA Signal | x = xmin + (xmax − xmin) · (I − 4) / 16 | - |
| PT100 | R ≈ 100 · (1 + 0,00385 · T) | Ω |
| Thermocouple (medium sensitivity) | T ≈ U / s + Tgf | °C |
47.16 Exercises
Try to solve them on your own, using a calculator, before looking at the solution.
Solution
soff = 3.2 × 1.12 = 3.58 mm.
Solution
f = 24 × 1200 / 60 = 480 Hz, less than 1000 Hz: yes, by a wide margin.
Solution
Aluminum: 4 × 0.40 = 1.6 mm; Sa = 0.81 × 1.6 = 1.30 mm. Stainless steel: 5 × 0.70 = 3.5 mm; Sa = 0.81 × 3.5 = 2.84 mm.
Solution
v = 0.5 m/s. Reaction: 0.5 × 0.008 = 4 mm. Braking distance: 0.5² / (2 × 4) = 0.03125 m = 31.25 mm. Total: 35.25 mm, so practically 45–50 mm with the margin.
Solution
d = 343 · 0,007 / 2 = 1,20 m.
Solution
With the NC, current flows when everything is in order: a broken wire, a disconnected connector, or a loss of power interrupts the current just as opening the contact does, and the machine stops. With an NA, the same fault would prevent the stop signal from being sent without anyone noticing. Positive opening: the plunger opens the NC contacts via a rigid connection, without springs, even if the contacts have become stuck together.
Solution
When the output is active, the black wire goes to 0 V: it is an NPN sensor, and it works. With an input that requires 24 V (an input for PNP sensors), the signal does not get through: you need to replace it with a PNP sensor (or use an input suitable for NPN).
Solution
4 · 5,000 = 20,000 counts per revolution; rlin = 16 / 20,000 = 0.0008 mm = 0.8 µm.
Solution
n = 60 × 40,000 / 1,024 = 2,343.75 rpm, approximately 2,344 rpm.
Solution
217 = 131,072 positions; 360 / 131,072 = 0.00275°; in seconds: 0.00275 × 3,600 = 9.9″.
Solution
ΔL = 11.5 × 10−6 · 1200 · 6 = 0.083 mm. The encoder on the motor counts the revolutions but doesn't detect it; the optical scale measures the slide and does detect it, so the controller corrects for it.
Solution
p = 16 · (9.0 − 4) / 16 = 5 bar. At 12 bar: I = 4 + 16 · 12 / 16 = 16 mA.
Solution
R = 100 · (1 + 0.00385 · 150) = 157.75 Ω (the complete formula in the standard would yield 157.33 Ω: at 150 °C, the linear law begins to deviate). T = (115.4 / 100 − 1) / 0.00385 = 0.154 / 0.00385 = 40 °C.
Solution
Ufs = 2 × 5 = 10 mV; m = 1000 × 3.6 / 10 = 360 kg.
