Technical Article

Feedback for Fluid Cylinders: Bang Bang Control

October 17, 2022 by David Peterson

Tracking the position of a hydraulic or pneumatic cylinder is often accomplished at a basic precision level, detecting only end stop limits with discrete digital values… But what methods accomplish this?

There are two distinct categories of feedback control for motion systems involving linear systems. 


Linear Position Sensors

For pneumatic and hydraulic systems (as well as commonly for electric actuators), the feedback may come in the form of linear encoders or position sensors, providing a high degree of precision and accuracy to inform the motion controller of the exact position of the load at any moment. 

Although these devices provide the ability to develop advanced systems, they are more costly to construct, more complex to tune and configure, and often more prone to failure, considering the complexity of the controllers.


Pneumatic cylinders fitted with external position sensors. Hydraulic cylinders can also be fitted with similar sensors.

Figure 1. Pneumatic cylinders fitted with external position sensors. Image used courtesy of Canva


Instead, many systems that do not require these advantages of precision can make use of simple sensors or techniques to provide discrete on/off output values.


Discrete Position Sensors

Why Do You Need to Detect a Cylinder End Stop?

The first important question to ask is reasonable. If we are only detecting when the cylinder hits the end of the stroke–extended or retracted–why should we bother with the extra control step of measuring when this happens? 

Certainly, the strain of colliding with the hard end stops of the cylinder will eventually cause fatigue and failure, but wouldn’t this happen regardless of the presence of a sensor? 

There are two great answers to this question.


1. Stop the Cylinder Before it Reaches the End of the Stroke

When a cylinder is in motion, the speed is quite high for open-loop on/off systems. If the end position can be detected even a fraction of a second before the plunger reaches the end of the stroke, the control valves can be changed to reduce the driving force, ‘softening’ the impact. 


2. Position the Sensors at Intermediate Stop Positions

A unique advantage of external position sensors is that they can be installed at any point along the cylinder, allowing the position to be monitored and controlled well before reaching the ‘hard stop’ location at the extreme ends.


Pressure Sensor on Supply Line

This first method is actually measuring the end positions of the cylinder indirectly. While the plunger is in motion, the expanding volume of the cylinder and the motion of the fluid result in a temporary decrease in pressure. As the cylinder reaches the final end of the stroke, the pressure will rise suddenly.


pressure sensor with configurable limits and discrete output

Figure 2. A pressure sensor with configurable limits and discrete output. Author’s image


In a sytem equipped with such sensors, this rise in pressure can trigger the discrete output limit of a pressure sensor installed on the supply line. The PLC or other controller can detect the rise in pressure and close the supply as the plunger approaches the end. 

This sensor setup can be configured in several different ways. The sensor can be placed on only the extend or retract supply lines, or on both. If a sensor is placed on both inlets, they can be programmed for different sensitivity pressures. It is recommended to place the sensor as close to the inlet connection as reasonably possible to avoid extra pressure losses which will decrease the effectiveness of the system.

This method is quite effective and flexible, but pressure sensors with programmable outputs can be more expensive than other solutions presented, and the rise in pressure will only happen when the cylinder reaches the end of the stroke, or when the piston meets considerable load resistance. Either way, it cannot sense when the cylinder is at any intermediate position. 


Limit Switch on the Load Device

This method also detects the final position of the actuator indirectly, yet it does involve a mechanical coupling. This method is commonly seen in CNC axis motion and in many 3D printer arrangements where the carriage must move along a linear path. 


limit switch on a fixed point to detect motion in a single axis

Figure 3. Limit switch on a fixed point to detect motion in a single axis. Author’s image

A limit switch is placed on a fixed anchor location while the moving component approaches the activation lever or button. The end location is reached, and the contact in the limit switch sends a signal to the controller. 

It should be noted that mechanical limit switches must make contact with the motion device, which can cause the switch to be slowly nudged out of position or worn out over time and will require calibration. Some designers use alternative inductive or optical sensors to detect the approach of the load. The strategy is the same but without physical contact. All of these sensors are fairly low-cost and simple to maintain but provide less flexibility than other methods.


External Position Sensor

Most sensors that detect the location of the piston inside the cylinder operate in the presence of a magnetic field. This means that they may not work on all cylinders; the installed linear actuator must have a magnet embedded into the movable piston inside.

These sensors can be purchased in a variety of form factors, able to be attached to the outside of a round cylinder or often embedded in t-slots extruded into the side of the cylinder housing. Regardless of shape, they perform a similar task.


Reed Switch Position Sensor

A reed switch, or reed sensor, is a 2-wire device, usually with a glass enclosure, containing two small flaps that are attracted to each other in the presence of a magnetic field. When the piston magnet approaches the ‘field of view’ of the switch, the contact set will energize. The concept is extremely simple and reliable and is wired in exactly the same manner as any pushbutton or relay contact set.


small pneumatic cylinder with the position sensor shown removed

Figure 4. A small pneumatic cylinder with the position sensor shown removed (this one fitting into the extruded slot on the side). Author’s image


Hall Effect Solid-State Sensor Switch

The solid-state complement of the reed switch uses the ‘Hall Effect’. This semiconductor device drives current into an output circuit in the presence of a magnetic field. Since it is an integrated circuit, the device is usually listed as a 3-wire NPN or PNP compatible sensor, meaning that it will be connected similarly to most optical or proximity DC sensors. 


close-up view of Hall Effect position sensor

Figure 5. Close-up view of Hall Effect position sensor. Note the three small soldered connections with brown, blue, and black colors common for industrial sensors. Author’s image

Pneumatic and Hydraulic Cylinder Position

Sensing the position of a cylinder is not only used for advanced motion control, it can also greatly increase the service life of the motion components and provide valuable diagnostic data about the system performance. With recent advances in IoT technology, position data paired with a timer can provide all sorts of insights to optimize even the most basic machines.