# Build PID Controller

I'm in my 3rd year of my electrical eng. degree. I have a project right now, where I must create a PID controller for implementation. They gave me the exact values for constants Kp, Ki, Kd and the maximum acceptable frequency.

My integrator circuit is based on the Miller integrator, but with a resistance in parallel with the capacitor, so I can have constant gain with low frequency signals.

My question is: How do I choose or calculate the values of the resistances and the capacitor, based on the max frequency they give me and the integration constant Ki?

My integrator looks like this picture: Image source: Electronics Tutorials - AC Op-amp Integrator with DC Gain Control

I uploaded a photo of the PID i am trying to use. Feel free to point any erros. It uses a proporcional, integral and differentiator components and then a inverting summing op amp. • What you're showing is not a PID, but a 1st order lowpass. To be a PI, RC must be series, and to be PID, another cap is needed at the input. The gain is given by the ratio of Rs. Oct 20, 2020 at 14:57
• isn't that a integral circuit? Oct 20, 2020 at 15:03
• A lowpass has an integral part. If you calculate the transfer function you'll end up with a 1/(1+s) form, which is a lowpass. The slope that you're seeing is the integral part, and the corner is given by the pole. And what I meant was for a one opamp PID, but it looks like you want to build it with more than one opamp. You should specify this in your question, but that would mean you're no longer looking for a PID, but for a PID that must be built according to your rules. Oct 20, 2020 at 15:06
• @aconcernedcitizen: In actual motion control usage, such a lowpass circuit with a high DC gain is often used as and referred to as an integrator, or a leaky integrator if you want to get specific. So depending on who you ask that's an integrator -- or not. Oct 20, 2020 at 15:13
• In order to build a PID circuit with that leaky integrator block, you need more circuitry. That, in turn, affects everything. Edit your question to show the whole circuit you intend to use. Oct 20, 2020 at 15:14

The difficulty in your approach is the lack of link between the PID coefficients and the poles/zeroes positions. In the APEC seminar I gave in 2012, I have re-derived the poles and zeroes calculation based on the existing PID coefficients. Once you know where the poles and zeroes are located, you can determine the components value in your circuit. The relationship linking the coefficients to the poles and zeroes is given below: These are raw expressions and could probably somehow be simplified I believe. Once you have these formulas on hand, you can build a discrete filtered form PID using op-amps as you did but I have used a slightly different implementation: In this filter, an additional pole is added to form the equivalent of a type 3 compensator which ensures the gain drops at high frequencies with a -2 slope. Below are the parameters calculated by the program: As you can see below, responses between the two approaches are identical: I honestly don't know how to stabilize a power converter directly using raw PID coefficients but I sure know how to do it via poles and zeroes placement. You can find more derivations on the subject in the book I published on loop control in 2012.