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. 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.

  5. This comment has been removed by the author.

  6. Es ist ein Medikament gegen erektile Dysfunktion. Bei Männern mit ED-Problemen wird das Blut blockiert und Blut fließt nicht in den Penisbereich. Bei der Anwendung von Kamagratoday in Deutschland entspannt die Wirkung dieses Medikaments die Muskeln und Blutgefäße. Sie werden genug Blut sehen können, das durch den Penisbereich fließt.