I am using an array of 10 LED/Photo-transistors to track a line. How can I implement PI control on it? I've did normal line tracking and I used PIC18f4520. I used the comparator outputs in logic to control speed of motors by PWM. Now i have to line track with PI control.
My system w/o PI control:
Sensors->Comparator->Controller->H-bridge->Motors
Where will the PI control fit in? And is it software only or has hardware too?
A regular PI control design is expecting a continuous error signal. But we can assume, that a 10 step quantization still gives some analog behaviour. Now you have effectively a proportional (P) controller, the control system has however integral behaviour, a constant manipulated value (PWM setpoint) results in a continuously increasing or decreasing error. In this case, only a small integral action would be allowed for a stable system. And I wonder, if there's any need to add integral action to your controller?
As long as the error signal quantization isn't a problem, the controller behaviour can be completely implemented in software.
Thanks, it cleared up quite a lot. And yeah, i'm supposed to implement PI on it. One more thing though, i will determine the Kp and Ki values by hit and trial?
Why not? Remember, that you already know a working Kp value. You possibly also have tried to modfy it. So the only difference is in adding integral action. As said, I won't expect too much from it under the present conditions. You could also try Ziegler-Nichols oscillation method to get an estimation for Ti.