Wednesday, December 12, 2012

Arduino PID Control

PID you say. What's that?

According to Wikipedia: A proportional–integral–derivative controller (PID controller) is a generic control loop feedback mechanism (controller) widely used in industrial control systems – a PID is the most commonly used feedback controller. A PID controller calculates an "error" value as the difference between a measured process variable and a desired setpoint. The controller attempts to minimize the error by adjusting the process control inputs.

Here's the issue: Let's say you want to heat a tank of water to 150 degrees. you check the temp sensor, and it says 100 degrees, so you turn on the heat full bore. You check again, and it says 160 degrees, so you turn off the heat. But now the water has cooled to 140. Now with a micro-controller like the Arduino, keeping a 10 degree spread (+/- 5 degrees) isn't too hard, but for finer and more intelligent control, it's time for PID! 

The Arduino Playground puts it this way: So, you tell the PID what to measure (the "Input",) Where you want that measurement to be (the "Setpoint",) and the variable to adjust that can make that happen (the "Output".) The PID then adjusts the output trying to make the input equal the setpoint.

There is an awesome library for the Arduino that makes this process almost easy.

Read more at http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/

PID Controllers: Theory, Design, and Tuning