I am wondering if a PID controller is the correct way to implement a stabilizer for a camera or any device. If I were to shake the device up and down and want to cancel out the movements by accelerating in the opposite way using a motor and linear actuator, would a pid controller work? I can collect real time data in Arduino or input a giant array of acceleration data.

I wanted to base it off of this lab. https://www.pdx.edu/nanogroup/sites/www.pdx.edu.nanogroup/files/2013_Arduino%20PID%20Lab_0.pdf

Its a circuit which uses a pid controller to keep the dimness of a light bulb the same brightness regardless of the amount of resistance you apply with the potentiometer.

The code confuses me because it changes the set point everytime. I thought a pid controller has an input , a desired output, and the output each iteration. why would the set point change?

Thanks for any help! I made sure to read every pid thread on here.

  • \$\begingroup\$ Check your link, please. \$\endgroup\$ May 25, 2016 at 3:59
  • \$\begingroup\$ I did. Is there a problem with it? Please let me know if so. \$\endgroup\$
    – lightro
    May 25, 2016 at 4:02
  • \$\begingroup\$ Doesn't work for me. Times out. \$\endgroup\$ May 25, 2016 at 4:04
  • \$\begingroup\$ That's not what this lab does / how this lab works. It's an LED, not a light bulb, but you add distance between the photosensor and the LED, causing it to try to compensate. The INPUT is the photosensor. The SETPOINT is the pot that tells it what light level it wants the photosensor to see. The SETPOINT is only changed if you turn the pot. Otherwise it just writes the same value every iteration. \$\endgroup\$
    – Daniel
    May 25, 2016 at 4:39
  • \$\begingroup\$ @WhatRoughBeast The link worked for me alright. \$\endgroup\$ May 25, 2016 at 18:49

1 Answer 1


Camera stabilization is a lot tougher than it sounds. A PID loop is just one necessary ingredient. Depending on the performance you require, you may also need feed-forward and a lot of bandwidth.

The first issue is that a pure PID loop is driven by error. If there is no error, there is is no command to correct any motion. So you won't get any correction until the there is enough error to effect a correction, and that amount of motion will likely be visible.

There are two ways to deal with this. One is to have a tight enough PID loop that a very small amount of motion effects a correction, with the sensor located with the camera (inside the envelope, where it senses how the camera is being affected). There will still be error, but the hope is to have the loop responsive enough that the resulting motion is hardly visible. That takes bandwidth, and I'm pretty sure an Arduino is not up to the task. I use a 200 MHz DSP to get a tight enough loop.

The second way to deal with the error is to try to prevent it from occurring in the first place. For that, you would use feed-forward. With feed-forward, you would need a sensor OUTSIDE the envelope, where it senses the motion that would affect that portion of the camera platform that is not being stabilized. This motion is then fed forward to command the loop, with a gain that is precise enough to apply the amount of correction needed to prevent any error. Again, it will require enough bandwidth to react before any motion is visible, and setting the precise amount of feed-forward gain is critical.

With either approach, high bandwidth sensors are required. Both techniques are often needed for high quality stabilization.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.