I have a motor with an optoencoder on it, and I want to keep it matching a certain speed using a an Arduino PI loop. I'm not sure what the units of the P, I and D are or if they are even standard but I hope they are. I have found that using a P of 2-3 makes it ramp up and converge on the process variable in a couple seconds which is ok. But since there is some stiction in the motor, there is some oscillation around the setpoint and I think I need to change the I parameter to damp that out. Is there any kind of guideline for how you should set the I parameter depending on the system or the P parameter? For example, I know there is some stiction at one point in the motor's rotation and i know that happens about 3 times per second because of the motor's speed, so knowing that can I make a swag as to what I should set the I to? Or is there a rule of thumb that says that I should be no more than X fraction of P or anything?
I havent checked the formula for Arduino PID, but I usally start with safe params to avoid oscillation:
P = 0.8, I = 40s, no D.
In my opinion, 0.6 < P > 1.4. Finetuning with I.
And one more thing: always avoid the PID max speed to be faster than the actuator!
When I made a servo motor I used the manual tuning description from the Wiki page on PID. I only used P and I and like you didn't bother with D. I was aiming for positional control and you want speed control but they are both set points so I cant see why this 'rule of thumb' wont work.
Quote from Wiki page.
Manual tuning
If the system must remain online, one tuning method is to first set Ki and Kd values to zero. Increase the Kp until the output of the loop oscillates, then the Kp should be set to approximately half of that value for a "quarter amplitude decay" type response. Then increase Ki until any offset is correct in sufficient time for the process. However, too much Ki will cause instability. Finally, increase Kd, if required, until the loop is acceptably quick to reach its reference after a load disturbance. However, too much Kd will cause excessive response and overshoot. A fast PID loop tuning usually overshoots slightly to reach the setpoint more quickly; however, some systems cannot accept overshoot, in which case an "over-damped" closed-loop system is required, which will require a Kp setting significantly less than half that of the Kp setting causing oscillation.
To make things easy for myself I added extra potentiometers for the P,I values (I didn't bother with D) which enabled me to rapidly have a tinker and get he feel of it with the motor running. I read the pots 10 times a second and not at algorithm speed to minimise the loop speed change when disabling this extra set-up code. Once my motor was behaving as I wanted it I noted the values with a serial print back to the PC and then and set them as constants in the program code
Using the external pots allowed me to set the P and I values within about 5 mins after several unsuccessful evenings of guesstimating what they should be and recompiling.
I also adjusted the speed of the loop which has a significant impact on the PID algorithm.
Did you write your own PI code?
Hi there
Try to look at this:
-Fletcher