PI controller design with a buck converter

This tutorial will examine the process of designing a controller for a power electronic converter. To begin with, power electronic converters differ vastly in topology and principle of operation which in turn results in the controllers implemented to achieve their desired operation to be drastically different. However, Proportional Integral (PI) controllers are the most commonly used controllers for most power electronic applications due to their simplicity of implementation and method of operation. In this tutorial, we examine the software implementation of a PI controller in an embedded controller such as DSP or FPGA rather than a hardware implementation using analog components. The purpose of this tutorial is to describe how the gains of the PI controller can be chosen by examining the output of the converter.

Usually, any control design will follow a mathematical process. The open loop transfer function of the converter is derived from which a frequency response characteristic is obtained. By deciding the type of controller (in this case a PI controller), the type of transfer function of the controller is known. Knowing the transfer function of the converter and the controller, the closed loop transfer function of the system is determined. The gains of the controller can be adjusted such that the frequency response characteristics of the closed loop system result in a stable system. Such a design process is highly recommended as this results in a rigorous design process that can be adjusted if the converter were to be scaled up or down in power rating. There are many commercial and free software that have in-built functions for designing controllers.

However, another method exists for choosing control gains - trial and error method. This method simply involves choosing different gains of the controller and observing the performance of the converter. Such a for designing any practical system. However, many systems in practice involve such a trial and error method to some extent. It should be noted that when a controller is designed, the parameters of the converter are never exactly equal to what they would be when the converter is fabricated. Component tolerances, temperature and aging will cause the parameters to drift with time. Therefore, even if a controller is designed mathematically, it is recommended to use the trial and error method to change the gains close to the designed values to check for improved operation.

This tutorial will examine how a PI controller can be designed for a buck converter purely by trial and error method. By using simulation as a technique to design controllers and also learn about the method of operation of the controller, such a trial and error method does not have the risks of implementation in hardware. The objective of the tutorial is to understand how converter output, control output and actual converter operation can be used together to design a controller. Even after designing a controller by such a trial and error method, it is advisable to perform a frequency response analysis to check the stability margin of the system.

The outline of the tutorial is as follows:

  1. Description of operation of a buck converter
  2. Closed loop control scheme for a buck converter
  3. Tuning of the PI controller

This tutorial is accompanied by a number of simulation cases. It is recommended to try out the simulation cases while reading the tutorial.

The report for the tutorial can be found in the link: .

Click here for report

The simulation files for the tutorial can be purchased from the link:


All the latest updates in the project are added to the Updates page:


The latest version of the software can be found on the link:


In order to install the software, read the document INSTALL.pdf:


To use the software, check out the user manual:


For further questions, contact me by email at pythonpowerelectronics@gmail.com.