ziegler nichols PID tuning

Thread Starter


Joined Aug 10, 2011
hi all,

i'm having some trouble simulating a PID controller for buck converter.

From what ive read, we can find the gains of the P, I and D terms by manual tuning. Initially, this means setting Ki and Kd = 0, and increasing Kp until we see some oscillations. however, no matter what i set the Kp value to be, i cannot seem to get any sustained oscillation.

Out of sheer frustration, i also just tested random gain values for the other parameters, but it made no difference in my measurement "Vprobe" As you can see in the following waveforms, the "Vprobe" waveform never reaches 2.4 (my desired setpoint value). it is almost as if my controller is doing nothing at all.

Here is an example waveform and my schematic that i've attempted.



if anybody has some insight on what might be going on here, it would be greatly appreciated.


Edit: please note that the waveforms is for Kp = 1000, Ki = Kd = 0. In this case, i think what i expect to happen is that i get oscillations in my measurement Vprobe.
Last edited:


Joined Mar 6, 2009
You need to add a modulator for the switching FET. And if you are wanting to control the output voltage you need to feed that back rather than the current sensing. If you actually want to control the current then the 5V source is insufficient to give 2.4A current in a 5 ohm load.

More like this ...


Thread Starter


Joined Aug 10, 2011
ah, thank you so much, it works much better now. I believe i am getting reasonably good results for Kp = 100, Ki = 15, and kd = 3.

That makes sense that you would need to have the comparator, otherwise you would just be feeding the FET nonsense values. I suppose the other thing i am wondering now is why did you choose 20kHz as the triangular wave frequency? From what i can see, would using a higher frequency give a better resolution/better accuracy? Please correct me if any of my logic here is incorrect.

Thanks again!