PID_v1 output creep

I am using the PID_v1 library and found an anomaly. I connect a pot to the input and adjust it close to the set point. The PID will produce an output of close to 50% (PWM). If the output was less that 50%, the output would drift downwards until it reaches 0% and stay there. If the output was over 50%, it would drift upwards util 100% and stay there. I tried this on the example code and ditto.
Any suggestions?

Sounds like control action is reversed, or needs to be reversed. Most PID libraries have a parameter where you can specify direct or reverse acting control.



I think there's an error in the PID Library v.1.0.1. I'm not sure I'm seeing the same effect you are, but it sounds similar. In my setup (Temperature Control of Solid State Relay with the PID relay example), watching the Output variable, it never backs off 100% (or 4000 in my code) until the the PV reaches the set point, then Output goes to 0. Output stays at 0 until the the temperature overshoots and then drops back below the setpoint, and then it's back to 100%, wash, rinse, repeat. I could get the same results from a simple if then statement. The beta6 version would pulse my Output as expected.

Try your code using the Beta6 version of the library:

Check out my post to the diy PID Control Google Group that the library author started for more details. Hopefully I get some response:!topic/diy-pid-control/hJywRcwGPX8

Lib v.1.0.1

Lib v. beta6

Hi guys,
Firts of all, sorry for my english, it's not my first language.
The pid regulator is a swiss army-knife regulator, good for everything, but only if the process requires it, else it would only make things worse. Before you can use a Pid, try to model the process, to get a transfer function, and then using online research try to get a regulator like P,I,PI,PD,dead-beat, fuzzy, 2dof or PID.
Use software like the open-source octave to model it, and read @ controlguru something about system modeling, to get a basic understanding of how it works.
Here's an exemple: A bldc motor with an encoder and pwm input is a PT1 system, and the best regulator is a I regulator. only a few lines of code in C.