In hard disk drive (HDD) systems, disturbances commonly contain different frequency components that are time-varying in nature. Different HDD systems may subject to different excitation disturbances. In this case, it is difficult for fixed-gain PID controllers to maintain a good overall performance. When the characteristics of the disturbances change, or when servos are designed for different drive products, the PID gains have to be retuned. This paper presents automatic online gain tuning of PID controllers based on neural networks. The proposed control scheme can automatically adjust the PID parameters online in the presence of time-varying disturbances, or for different disturbances among different HDD products, and find the optimal sets of PID gains through the self-learning ability of neural networks.