Sunday, January 26, 2014

PID Controllers

I have a few ongoing projects where a feedback loop that considers a moving goal and adjusts to achieve that goal is essential. One of these projects is a two wheeled self balancing robot. This type of problem is perfect for a PID control loop. I have been procrastinating biting the PID bullet because I was under the impression that PID was not easy to learn or implement. Thankfully, after much searching, I have found a very straightforward and intuitive overview of PID.

After the above overviews I dug around to find some PID Controller pseudocode.
previous_error = 0
integral = 0 
  error = setpoint - measured_value
  integral = integral + error*dt
  derivative = (error - previous_error)/dt
  output = Kp*error + Ki*integral + Kd*derivative
  previous_error = error
  goto start

I am no longer intimidated by PID. Should be fun.


  1. I don't know where you find the time! This is good stuff; I did something similar several years ago in building a gyro camera stabilizer. Turning a significant flywheel @18000RPM and trying to keep it from surging...
    Wish we could share notes!

  2. Wow, that makes scene just give it a try to

    Buy Generic Viagra

  3. Thanks for the GREAT info. You have helped me greatly : see more

  4. Estimate found the site and now I sit here all my free time thinking about working out. Interesting? Okay, share a link topnotch video poker machines You can not thank.

  5. PID Controllers have three basic types of controllers: on-off, proportional and PID.
    Click Here for Air Duct Cleaning Denver to know more about us.

  6. This comment has been removed by the author.