PID Controller C-Code

PID Controller source code

Jump start your embedded control project

Our PID Controller source code (C code) has everything you need to realise efficient optimal control, including bumpless PID with limit handling and setpoint weights in all terms, bumpless low pass and notch filters, and auto-tuning.

Our code is running in all sorts of systems all over the world, such as wind turbine controllers, motion controllers, and mould temperature controllers.
If you want to implement this software in dirt cheap hardware, Arduino might be suitable for you, and we have prepared a complete packacke for you (hardware and software).

Description of the software package

What exactly is in the software package? The package consist of a batch file, to compile and link the code using the GCC compiler (free and public), and ANSI C source code only. There are no 3rd party libraries involved. All code is commented. The ANSI C-code consists of the following routines:

  • Simulation: A tester main file shows how to implement and call all functions of the PID controller. It simulates an FOTD model, and the PID controller with all add-ons and logs the simulated data to a text file.
  • PID controller: An industry standard implementation of the PID controller, which has the following features:
    • Bumpless Control: Transfer between Manual and Automatic and vise versa without any ‘bumps’
    • Autotuning: Which automatically estimates the optimal P, I and D values.
    • 2-DOF Anti Overshoot: To get rid of overshoots when changing the setpoint
    • Differential Filtering: Such that the D-action can be used even if the process would normally be too ‘noisy’
    • Gain Scheduling: A robust implementation of gain scheduling on the PID controller
  • Filters: Second order filters that allows you to create any type of filter, like notch filters, lead lag, low pass.

Customer reviews

” This PID Controller source code with self-tuning algorithms and filters included, continues to work extremely well. We could not be more pleased with the results! 
CEO of J-Systems Inc, Lombard, USA.

” We have successfully applied the PID Controller source code in an embedded mould temperature controller. Using the PID Tuner software of DotX we tuned the PID settings to obtain fast temperature control with minimal overshoot. 
H. van Hulsen, Control Engineer at Small Processor Systems B.V., the Netherlands

Example of the code


The form has been submitted successfully!
There has been some error while submitting the form. Please verify all form fields again.

More Information?

Ask our expert!

Jelle Kalsbeek
Senior Control Engineer