The PID algorithm is one of the most important contributions in control engineering. A PID controller continuously calculates an error as the difference between a desired setpoint and a measured process variable and applies a correction based on proportional, integral, and derivative terms. As a mean to learn how to handle a PID controller this small project has a low pass filter connected between an analog entry and a PWM output forming a feedback loop. The low pass filter has a long time constant enabling a slow visual output.
The project is very simple. It needs only a suitable capacitor and resistor mounted as a low pass filter. The values used are 1000uF and 100 Ohm but other values will also do. It is convenient that the time constant of the low pass filter is high. The filter is mounted between a PWM output of an Arduino and an analog input on a feedback loop. The rest is handled by the software. One can try several values for the Proportional, Integral and Derivative factors as to obtain the best output. This tuning is somewhat of an black art and it's best to start from the proportional factor with the others reduced to zero and so on. The montage in the breadboard is trivial.