Monday 18 April 2016

Arduino-PID-Library online Trainer

PID seems to be a rather magical thing. I ported the Arduino-PID-Library to javascript so you can play with the constants in a simulator and and see the results immediately. Hopefully this will make people less scared about the tuning process.

In this simulator, you are Lara Croft driving a car. Using the sliders below you have to choose Kp, Ki and Kd to follow the green line as closely as possible, that is without overshooting or oscillating (so, not like now).

This PID controls the accelerator/decelerator of a car. There is some drag and the vehicle has a certain mass.

The X axis is time and the Y axis is the position of the car. Make sure she is at the right position at the right time

Can you help her? Good luck!


PID's output (accelerator):


  • The car is simulated by using the following equations:
    • x(t) = v*t + 0.5*a*t^2
    • v(t) = a*t
  • The PID code is based in the Arduino PID Library by Brett Beauregard.

Lessons learnt:

There are 2 types of processes.
  • Processes that keep their last state (like in the level 1, a car on a flat road). These are called integrating processes, they don't need a Ki and the PID won't overshoot
  • Processes that feel an external force (car on a slope, something cooling down). These are called self regulating processes, they do need a Ki and they will overshoot when the external force changes

Credits go to Brett Beauregard for his excellent library and his great explanations in the diy-pid-control forum


  1. Thanks for this. It helps make the PID algorithm more intuitive.

  2. Thank you for this interactive demo. It really helped me to understand Brett's library and how PID works.

  3. Can we get the data as a table in order to use ?

  4. as i notice.. KI really dont matter ...

  5. thank you,i like them

  6. This comment has been removed by the author.

  7. เกม UFA Wallet 777 เป็นเครื่องบินในกลุ่มของสายการบินไทยแอร์เอเชีย (Thai Airways International) PG SLOT งเป็นเครื่องบินโดยสารขนาดใหญ่ที่มีความจุสูงสุดถึง 364 ที่นั่ง มีระยะทางบินได้ถึง