I am having trouble getting my PID controller to be accurate over a range of values. My goal is to input a duty cycle for a PWM wave, which controls the speed of a fan rotor. The range of possible speeds should be 300RPM to 2700RPM.
Currently the PID controller is achieving accurate speeds when 800 to 1600 RPM is requested, but below those speeds the output is too high, and above those speeds the output is too low. I think this may be because the relationship between duty cycle and rotor speed is not entirely linear.
Here is our current PID equation: duty_cycle = [ speedset + control + 735] / 4300 Speedset is the requested speed, control is the PID control variable, and the constants are from the equation that we found to be mostly accurate for linking duty cycle with output speed (it is however a linear equation, and was not entirely accurate for extremely low and high data points).
The control variable is: control = 0.104*error + 0.104*previous_error + 0.13*next_error
This is my first time working with PID, so please correct me on anything I am doing wrong. Does anyone have any advice for how I might improve the accuracy of the system at very low and very high speeds?