How can I control the position of a pneumatic piston?

The only way I know about is using a magnetic reed switch (magnetic sensor) with a matching piston and use some type of control algorithm, like PID for instance, to keep the piston where the sensor is.

The problem with that is that it gives you only limited control of the position, it just adds another "state" (open, closed, sensor position) and not full control. for example I want it to be 43% once and 70% the other time, but without using a sensor for each position because I would like all the "options" to be available (I mean that the percentages aren't pre-defined)

This is an example of the pistons I use:


This is a good example of what I want: http://www.youtube.com/watch?v=A8LZ15uiuXU

  • $\begingroup$ Perhaps add more context. Is it driving a fixed load, or variable? Also, is your air supply pressure constant or variable? Clean environment, or dirty? What's the maximum frequency you need? $\endgroup$ Aug 21, 2013 at 22:15
  • $\begingroup$ @jwpat7 This is a general question, I may use it for multiple applications, sometimes fixed and some variable. Also, I usually control the piston with a solenoid, does this mean that it is a constant air supply pressure? And about the frequency, the best the better. $\endgroup$ Aug 22, 2013 at 7:38
  • $\begingroup$ In the comments under the video they mention that the piston has a builtin sensing resistor. $\endgroup$
    – cube
    Aug 22, 2013 at 18:02
  • $\begingroup$ @cube you are correct, but my piston does not have a built-in feedback sensor, so my question is how can I still get that functionality. $\endgroup$ Aug 23, 2013 at 8:19
  • $\begingroup$ Hi @Dan, welcome to robotics. As it stands, your question is too broad. Such general questions are a poor fit as a stack exchange question, it would be much easier for us to answer if we did have the details jwpat7 is asking for. A generalised answer is very simple, if you want precise position control you need a proportional actuator and a proportional position sensor and you tie them together with closed loop control, but such a generalised answer isn't very useful. I would start your research with a google search on pneumatic servos. $\endgroup$
    – Mark Booth
    Aug 24, 2013 at 23:34

2 Answers 2


You probably could attach an optical encoder strip to the piston, maybe even paint the piston rod with some reflecting / non reflecting paint. Or you could attach a modified digital caliper to it, using something similar to this: http://hackaday.com/2013/06/20/giving-digital-calipers-bluetooth/ .

I have never done anything like this, so I don't really know if it would work in reality :-)

  • $\begingroup$ +1 for the very creative idea with the caliper :) $\endgroup$ Aug 23, 2013 at 15:55
  • $\begingroup$ The only problem is that with all these solutions, the piston moves fast and has only 2 states.. (extended\retracted) and the question really is how to stop a piston at a certain point and how to slow its action down (because it extends\retracts very fast, probably damaging the load if stopped spontaneously), while you answered how to detect its position instead of how to control its position. Thanks for answering anyway and I hope you understand :) $\endgroup$ Aug 23, 2013 at 16:08
  • $\begingroup$ @Dan: Your comment contradicts your stated method for controlling the piston. The piston doesn't have just two states -- it just moves from stop to stop very quickly. You need to wrap it with a controller that reacts significantly faster than it moves: whether you do that by restricting the air supply to slow down the piston, or speeding up the controller (and actuator) is another layer of problem. $\endgroup$
    – TimWescott
    Aug 25, 2013 at 21:18

To control the position of a piston, you need -- at the very least -- a position sensor and an actuated valve.

In reality, you will encounter a few other effects that will complicate the simple PID algorithm you're attempting.

  1. Depending on how many pistons you're driving, or how much airflow your piston takes, you may find that the available air pressure fluctuates. If your valve can achieve a range of positions (not just open or closed), this changes the relationship between valve position and the resulting pneumatic force.

  2. The system may exhibit negative damping for a variety of reasons. For a good explanation, see this page about a robot experiencing negative damping, and how to fix it. (This might also be a solution to your problem of the actuator moving too fast.)

There is no simple answer; these systems are complicated and require testing every step of the way.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.