Hello all,

I have been going through various documents and sources regarding PID in particular I have also read the AVR APP NOTE AVR221 for implementing the a Discrete PID control on Microcontroller. So far I have understood that the Proportional term simple looks at the error and multiplies it with a known factor. The Integral term looks at the sum of error(Set Point - Process Value) and multiplies it with a known factor and finally the Derivative term looks at the difference between the Current Process Value and Last Process Value and multiplies this with a known Factor. Ultimately we have a result in Measured Value Unit/Time unit. The control loop has to be called at a regular interval to achieve the goal. My question is that often the result of the PID is scaled by a factor, how is this factor calculated? Does it depend on the system being controlled or is there a method to calculate this? Besides this Since I want to translate the result of the PID control to position of a valve which is actuated using a DC motor and the position of the Valve is determined with a reflective sensor which provides pulses on motor rotation. What should I do with the result of PID to translate it into pulses? I understand I will have to convert the result into percentage and then to pulses but how exactly do I get the percentage from PID result? Besides this all I am planning to use Fixed point arithmetic to avoid the use of float and for this I will have to scale the PI and D terms with a factor, what should I consider while selecting the scale factor?

I haven't yet decided the controller which I will need for this application but in general I would like to understand the control scheme and details involved to be able to implement it regardless of the controller used. I will be measuring temperature which I will scale by *1000 to avoid floats again so lets say 22.5 Degree will be represented by 2250. This temperature will then be the input to the PID control loop. Will the other parameters of the PID control loop be affected by the scale factor that I am using for Temperature? I kn ow these are a lot of questions to ask but I am trying to grasp not only the theory but also the way that I can implement it using a microcontroller.

Thank you for your time and effort and I hope to get a response soon. Please feel free to ask more details.