This repository describes a simple implementation of a discrete Proportional- Integral-Derivative (PID) controller. When working with applications where control of the system output due to changes in the reference value or state is needed, implementation of a control algorithm may be necessary. Examples of such applications are motor control, control of temperature, pressure, flow rate, speed, force, or other variables. The PID controller can be used to control any measurable variable, as long as this variable can be affected by manipulating some other process variables. Many control solutions have been used over the time, but the PID controller has become the ‘industry standard’ due to its simplicity and good performance.
This code example is based on the document AVR221 - Discrete PID Controller on tinyAVR and megaAVR devices, and will be performed on the ATmega328p device.
- MPLAB® X IDE 6.25 or later
- ATmega DFP 3.4.282 or later
- MPLAB® XC8 3.00 or later
- AVR/GNU C Compiler 5.4.0 or later
- ATmega328p
- Customboard
- Alternatively the ATmega Xplained Mini can be used
-
Connect the board to the PC.
-
Download the zip file or clone the example to get the source code.
-
Open the project in MPLAB X IDE.
-
Build the solution and program the device.
This code example has illustrated how to create a simple PID controller for tinyAVR and megaAVR devices from Microchip.