This paper proposes an accurate control method for position of a pneumatic cylinder using on-off solenoid valves in combination with a programmable logic controller (PLC). In order to deal with this purpose, an experimental setup of the pneumatic system using a double acting pneumatic cylinder, four on-off solenoid pneumatic valves and a PLC siemens S7-1200 is considered. The control law is designed basing on the transitions between seven operating modes of the pneumatic valves and selection of the operating modes is depended on the tracking position error of the cylinder. The experimental results show the usefulness of the proposed control method. The pneumatic cylinder can track well the desired step position with a rise time less than 1 s, no overshoot and steady-state tracking errors less than 2 mm.