This paper introduced the self-tuning fuzzy PID controller based on particle swarm optimization which aims to gain more precise control over the position of pneumatic proportional valve barrel, where particle swarm works to optimize the membership function, fuzzy rule and PID parameter in fuzzy control. The study fruits also include online optimization of the self-tuning fuzzy PID controller parameters. Comparing to the conventional control methodology, The self-tuning fuzzy PID controller with PSO optimization is proven to show better precision, dynamic performance index and more rapid tracking performance and robustness. To this end, step response was used to compare and analyze the results from the PSO algorithm optimization, providing a pragmatic method of better comprehensive performance for PID parameter optimization.