# PID range too little

Good evening

U have setup a PID calculation in arduino program.

output signal limits are setup from 50 to 255.

Output PID is working between 50 and 65.

Maximum gap between setpoint and input is 16.

I want output signal to work on full range but I Don t know what to change Kp Ki or Kd or something else !

Thanks for explanation

There are many tutorials on selecting the K constants, called PID tuning. Use your favorite search engine with the phrase "pid tuning tutorial" to find them. Kp sets the gain that relates (input-setpoint) difference to output.

For full range output, you will probably need to use the constrain() function to make sure that the PID algorithm output never exceeds the limits.

The PID library actually has a constraint method built in:
`SetOutputLimits(double min, double max)`.

SetOutputLimits (50, 255);

i oculd not Constrain because output does not go over the limits, it stays around 55 and never reach 255 !

If you set Kp correctly, you probably will need the constraint.

So, do your homework and learn how to choose those constants.

How are you testing this? What type of project is this for?

• Note that PID will try to stabilize the input at the setpoint value. What value is your setpoint?
• Ideally, the gap between setpoint and input will reduce to 0. (increasing Ki reduces this error).
• The output signal will use whatever value it takes to make the input match the setpoint .... it may not need to use the full range of output to do this.

255 / 16 = 15.9
Set Kp to 16 to get an Output of 255 with an Error of 16.

In that case make sure the I term is not zero. If its active it will push the output without limit over time. Be careful not to overdo the I-term.

Hi dlloyd, thanks for the curve that makes sence !

Please could you let me know where did you found this simulation tool that i can simulate other stuffs ! ?

Thanks

Thanks guys for informations, i found a good way and now my output is climbing up to 120, witch is half of the range but fine, system is running fine without big peaks !

Regards

The gif image is from Wikipedia (PID Controller).
There's some online PID simulators available ... here's one.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.