PID controller trying to understand frequency response

Thread Starter

justtrying

Joined Mar 9, 2011
439
I am working on implementing an analog (yes, op-amps, possibly digital in the future) PID controller to regulate current for a laser. There is more to come...

For now, I have the PID match various inputs from function generator (sine waves, square waves, triangle waves i.e. AC input, haven't tried the "step process" yet as described in all tuning procedures) with a set point also coming from function generator to see how the thing is supposed to work as I have no formal background, I have read quite a bit and followed all the lins advised on the site.

On to my question - I am trying to figure out why I am able to get the input signal to match the setpoint by adjusting all the gains, but at lower (below 50 Hz) it always has a sine wave riding on top of it. It is not random noise and it disappears at higher frequencies. Is it the undamped oscillations that from improper tuning? Does it have something to do with the fact that the signal is AC? I cannot find any reference discussing this.

Another question is this - if my setpoint is AC signal with a frequency of 100kHz, is PID capable of getting the input perfectly close to the setpoint, what are acceptable standards? I understand that it depends on the tuning...

Thank you for any input; if needed, I will try to get a pic of that waveform tomorrow.
 

ErnieM

Joined Apr 24, 2011
8,377
In the analog world, the two basic circuits are amplifiers and oscillators. The biggest problem is oscillators that just amplify and amplifiers that tend to oscillate.

Definitely sounds like your PID is marginally unstable and that is what you are seeing.

Just seeing the waveform isn't going to tell us much. We'll also need to see the schematic.

Your are now entering the "black" area of electronics magic.
 

Thread Starter

justtrying

Joined Mar 9, 2011
439
Here is the circuit so far. I am wondering whether op amps are contributing to the oscillations. I am using AD820 for PID, as per reference. But the spec sheet talks about problems with capacitive load and some other issues. I am hoping that once I actually have all the parts for the application it will work, but it would be nice to get some answers... Black area indeed... Still it is quite the dark magic

I tried a DC signal today and found that the oscillations somehow get fed into the input... so definitely need a way to get rid of them. Otherwise I do not see any large overshoots or anything like that.
 

Attachments

atferrari

Joined Jan 6, 2004
4,771
I do not know if it could help: search for an article about PID implemented with opamps by Bob Pease, who knew a LOT about all that and who passed away recently.
 

anindya

Joined Jul 18, 2011
1
you can try puting a rc lpf infront of the derivative part. the non interacting pid that you have chosen is practically unsysnthesizable because if you see the transfer function of pid you will see the order of the numerator >order of denominator...so the lpf has 2 basic functions it equalises the order mismatch and also limits the high frequency noise from entering the derivative part which is very critical. google type b pid controller
 

mcasale

Joined Jul 18, 2011
210
You ask if the op amps will add phase shift -- for sure. Many control systems do not need a derivative term, unless you need very fast response from a fast "plant".

The "right way" to do this is to see what frequency response your diode needs. Then you set the compensation pole/zero in your circuit to match that. I do not see the diode in your schematic.

Can you just make a current driver to deliver current to the diode, based on a function generator input signal? Why do you need a feedback system?

Maybe I'm missing something.
 

Thread Starter

justtrying

Joined Mar 9, 2011
439
there is definitely some lack of information...

The diode is not in the circuit because I don't have it. This is a diode used in atom trapping experiments, and my understanding is that PID will be used to control the current that goes into it. The concept is still a little vague to me, until I get real parts. What I am trying to do right now is understand the basics of the PID and various variables that need to be controlled, as well as those little things that may go wrong (like oscillations)

So far I think I get this:

Happy moment - most oscillations were caused by my breadboard (I guess too many fires during the learning process)

rest of oscillations can be minimized by an RC filter as suggested by anindya (thank you)

know I need the rest of my circuit to actually start looking at the real response

I am sure there will be more problems

Victoria

p.s. spent 20 min poking everywhere to find out why rewired differentiator doesn't work only to find out that it wasn't connected to Vcc. Life on the wild side.
 

mcasale

Joined Jul 18, 2011
210
Hi. I recommend you start simple. I assume that, at some point, you will be sensing current through the diode, and you want to make it follow some type of setpoint signal? Take out all the "compensation circuits" (I & D) except the one that provides Proportional gain (P). Start at the lowest possible gain setting and watch the step response. If it oscillates or rings when you change the setpoint, you already have too much gain. If the reponse is nice and smooth, keep increasing the gain until it starts to oscillate. Then back off on the gain. At this point, you can start adding a little integral gain and see what it does. There are probably many techniques available online for tuning PID systems empirically. Does this make any sense to you?
 

Thread Starter

justtrying

Joined Mar 9, 2011
439
Yes, I've been playing around with tuning random signals and I can see that "P" has the most effect and "I" and "D", like the literature says are there to fine tune the result.

I've been using both a switch and a function generator to observe a step response because function generator and am starting to get the idea of how this works.

There are too many tuning methods out there... I think I am going to learn more about what the input and set point to this thing are tomorrow.

Thank you all
V.
 
Top