Author Topic: off the shelf PID control IC ?  (Read 19061 times)

0 Members and 1 Guest are viewing this topic.

Online Simon

  • Global Moderator
  • *****
  • Posts: 14437
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
off the shelf PID control IC ?
« on: March 15, 2013, 11:05:06 am »
I've been asked second time around now to make a controler for a servo mechanism that uses a potentiometer for position feedback and takes essentially a voltage input to tell the controller how to drive the motor.

I believe this is nothing new and known as a PID ? Last time i tried to do this I ended up with an MCU messing about with program parameters as I needed the servo to track my input but because of the motor inertial I ended up making a buzzer.

Ideas ?
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4522
  • Country: au
  • Question Everything... Except This Statement
Re: off the shelf PID control IC ?
« Reply #1 on: March 15, 2013, 11:16:14 am »
more often than not its a slew rate dampened op amp, with some hysteresis added, P and I right there,

most servos don't require full blown PID, and in most cases the methods to tune a PID chip don't work at the speeds your loop would be facing...

p = proportional, which is what an op amp naturally does for its inputs,
I = integral, or time based response, where your hysteresis would come in handy as it will slowly over time leak it towards the correct output,
D = derivative, this is effectivly having a capacitor coupling to one of your inputs, it responds to rate of change and unless your loading it oddly would work against you,
 

Online Simon

  • Global Moderator
  • *****
  • Posts: 14437
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: off the shelf PID control IC ?
« Reply #2 on: March 15, 2013, 11:25:34 am »
hm, I sort of see what you mean, my first attempt was with comparators but I was working with a window comparator setup (the hysteresis bit).

So are you suggesting that basically the opamp output will change based on the difference between required position and actual position so that as the gap closes the drive (voltage) reduces to stop over shoot. I'm not clear on what you mean by capacitve coupling.

Would something like a comparator with hysteresis work ? providing the hysteresis is enough for the motor to stop before overshooting.
 

Online kripton2035

  • Super Contributor
  • ***
  • Posts: 1835
  • Country: fr
    • kripton2035 schematics repository
Re: off the shelf PID control IC ?
« Reply #3 on: March 15, 2013, 11:45:02 am »
good readings :
microchip app note 937 : Implementing a PID Controller Using a PIC18 MCU
explainations about pid : http://projeneering.com/electronics_projects/elec_pid.html
another : http://www.pcbheaven.com/wikipages/PID_Theory/?p=0
pid library for arduino : http://playground.arduino.cc/Code/PIDLibrary

Online Simon

  • Global Moderator
  • *****
  • Posts: 14437
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: off the shelf PID control IC ?
« Reply #4 on: March 15, 2013, 12:00:01 pm »
I'm thinking, possibly not completely straight, what if I have a H bridge, each side controlled by a different comparator using common feedback and reference, it will just drive the motor in the correct direction until it goes over the threshold and stop, this does not need to be super accurate.
 

Offline notsob

  • Frequent Contributor
  • **
  • Posts: 644
  • Country: au
Re: off the shelf PID control IC ?
« Reply #5 on: March 15, 2013, 01:33:21 pm »
Georgios over at pcbheaven has several PIC projects using PID, with some associated theory, may be of interest to you simon

http://www.pcbheaven.com/projectpages/
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1283
  • Country: fi
Re: off the shelf PID control IC ?
« Reply #6 on: March 15, 2013, 03:00:27 pm »
Sigh. In the halcyon days of The Analog i spent my youth implementing op amp based PID controllers for heavy industry. You really need only a single op amp, a few caps and resistors and there is your PID controller. Nowadays everyone uses MCUs for that, and why not.
A true analog PID controller takes a setpoint voltage, process feedback voltage, and produces the command signal as a voltage. If you drive a motor a more desirable output may be a pwmn signal or similar, but strictly that is not part of the PID controller. The command signal is the proportional-integral-derivative of the setpoint and actual value difference. Hence PID.

The key challenge is not at all in implementing the controller, practically anyone can cobble together the circuit or the source code. The trick is in correctly tuning the controller. There is no real shortcut, you need to know at least the bare rudiments of control theory to be able to accomplish anything by design as opposed to chance. This is where the math bogeyman enters. Ideally, you would characterize the "plant" i.e. your system that needs controlling. The full expression of said characterization would be to write the plant transfer function from which you can then extract the poles and zeros and position them in s-coordinate plane for examination. Or if you do the PID using a discrete time system such as a MCU, you would need to perform the z transform to extract the discrete time response of the system.
In practice you really need to be an actual trained control engineer to be able to do this consistently. I wrote above that there is no real shortcut and that is true in a sense, but you don't have to tune a PID the hard way every time. You will get a long way by just doing a rudimentary frequency response analysis, and actually your buzzer will function as one. The first task is to get an idea of the resonant frequency of the plant+controller loop. Most anything you will encounter will count as a LTI or Linear Time-Invariant system, or as close as makes no difference. That means that the internal signal transport delays in the system are more or less constant and that in turn means that the resonant frequency will stay more or less in one place regardless how you fiddle the system (provided you do not change the loop topology in a significant way). So, after finding out that your dandy control system is actually a poor man's oscillator, the next task is to find the frequency of oscillation. Once you have an idea about that, check that your controller time constants (the derivation and integration times) are roughly in the same ballpark. Once there you know that you can position transfer function poles and zeros somewhere around the resonant frequency.
There are different methods of tuning a PID controller. Many of those start by first finding the maximum proportional gain that the system tolerates and then tuning the integral and derivative terms. It is important to understand that the function of the integral term is to provide "infinite" DC gain, thus removing any static operating point offset remaining after the P term is done. The derivative term in turn gives an enhanced control response to rapid variations in either setpoint or actual value. Both should be set to 0 when tuning the proportional term.
After this it gets more complicated - hopefully the Interweb has something to say about it.
Like i wrote, i have played with those things all my life so ask away if there are details you want to clarify.

Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2024
  • Country: au
Re: off the shelf PID control IC ?
« Reply #7 on: March 15, 2013, 04:22:33 pm »
As Kremmen has already stated a PID control loop is easy to build, it’s the tuning of it that can be a PITA. I’ve often been called to plants where they have changed out a PID controller or some peanut has fiddled with the set points and they can’t get a stable output anymore.

The methods I’ve used are exactly as Kremmen has stated. Turn Integral and Derivative off. Then adjust Proportional to give you the desired rate of change in the output for an error. This can be seen as the gain but on some controllers they blur it in with the set point. It can also be a little confusing because adjusting P, I and D can also be called adjusting the gain of the PID terms. The bottom line is that the output is proportional to the error input

Integral is the area under the curve graphed by the output over time. As the output ramps up from off, the area under the curve increases essentially giving “weight” to the control. This is used to prevent over or undershoot once the proportional part has reached or is reaching its set point.

Imagine that what you are controlling is sitting exactly where you want it. As you plot this over time and take the area under that plot for a give unit of time then this is exactly what you want. The integral part of the controller will have no error. In the situation described above, where you have just started, the output starts ramping up towards the set point and the area under the curve is growing so slowly the integral part is winding back its output. As it approaches the set point the proportional is still trying to drive the output the integral will start subtracting from the output, essentially killing any proportional output. Too much integral and you end up with an overdamped response to little and you’ll get ringing, or a slight oscillation upon reaching the set point.

Normally for the stuff I’ve dealt with that’s about it, rarely do the systems I have worked with need any derivative namely because they have used PID to mitigate slow response systems where once the output is ramping up, simply turning it off doesn’t immediately halt the ramp due to inertia.

Derivative is the gradient or slope of the feedback curve at the current point in time.  Say for example the output shoots away from the set point for some reason. It looks at the slope of the deviation and applies more feedback if it is steep or less feedback if it isn’t. Derivative can be tricky on some systems, too little and the system is slow to respond, too much and the system “hunts” or oscillates.

I hope I haven’t stuffed anything up in my explanation

 

Online Simon

  • Global Moderator
  • *****
  • Posts: 14437
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: off the shelf PID control IC ?
« Reply #8 on: March 15, 2013, 05:11:46 pm »
Well I don't need full blown control here. I just need a motor position (given by a pot it drives) to mirror that set on a manual potentiomter.

Now immediately i need to have 3 settings as is a motor controlling a flap so open, closed and mid point is all they want, I can do that with a window comparator for the middle position and a single comparator for upper and lower positions.

But i know that we have water valves operating in the same way. And it would be good to be able to control those too. The PWM idea is good, this would slow the motor down as it approaches the the desired point so that it does not overshoot. I guess a minimum duty must be maintained to carry the motor into the "hysterisis" zone where it can rest. An opamp can make a triangle wave and another can be used with a DC voltage from the main oopamp as a comparator to generate the PWM impulses.
 

Online kripton2035

  • Super Contributor
  • ***
  • Posts: 1835
  • Country: fr
    • kripton2035 schematics repository
Re: off the shelf PID control IC ?
« Reply #9 on: March 15, 2013, 05:32:46 pm »
isnt it how a servo works ?
so sparkfun has a ready made open source module : http://www.sparkfun.com/products/9014/
also a schematic with a M51660L integrated circuit : http://corsair.flugmodellbau.de/files/elektron/225215~1.PDF

Online Simon

  • Global Moderator
  • *****
  • Posts: 14437
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: off the shelf PID control IC ?
« Reply #10 on: March 15, 2013, 05:55:09 pm »
yea, that is all i want, a servo circuit
 

Online Simon

  • Global Moderator
  • *****
  • Posts: 14437
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: off the shelf PID control IC ?
« Reply #11 on: March 15, 2013, 06:05:05 pm »
what a pity the M51660L is "unobtainium" i had the same problem with another similar chip.
 

Offline qno

  • Frequent Contributor
  • **
  • Posts: 422
  • Country: nl
Re: off the shelf PID control IC ?
« Reply #12 on: March 15, 2013, 07:07:50 pm »

Go play with it, you will learn the most.

You will find out that a P controller will never reach the setpoint because then the difference is 0 and your motor will stop.
To reach te set point you will need an Intergator.

If you need only open and close and close a valve you can use to end switches to indicate full open and fully closed.
Why spend money I don't have on things I don't need to impress people I don't like?
 

Online Simon

  • Global Moderator
  • *****
  • Posts: 14437
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: off the shelf PID control IC ?
« Reply #13 on: March 15, 2013, 07:13:51 pm »
I need some intermediate points. At the moment only one midpoint so i could do it with a window comparator, but i need something that will do any position too.
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1283
  • Country: fi
Re: off the shelf PID control IC ?
« Reply #14 on: March 15, 2013, 07:18:23 pm »
If you actually want an off the shelf solution, as in "no design required" then your best bet is a small PLC with a PID function.
And just to avoid confusion: a "servo" is by nature a control loop so it is a "full blown" control. If it isn't then it isn't a servo either.

Nothing sings like a kilovolt.
Dr W. Bishop
 

Online Simon

  • Global Moderator
  • *****
  • Posts: 14437
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: off the shelf PID control IC ?
« Reply #15 on: March 15, 2013, 07:21:12 pm »
well it's definitely a servo, motor drives a pot circuit compares motor driven pot to user pot and commands motor accordingly
 


Online Simon

  • Global Moderator
  • *****
  • Posts: 14437
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: off the shelf PID control IC ?
« Reply #17 on: March 15, 2013, 07:26:58 pm »
hm may or not be what my work want. they will probably want a more reliable source. but why are these only available from china ? don't we use them in europe any more ?
 

Online Simon

  • Global Moderator
  • *****
  • Posts: 14437
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: off the shelf PID control IC ?
« Reply #18 on: March 15, 2013, 07:39:52 pm »
i'M THINKING SOMETHING ALONG THE LINES OF THE ATTACHED
 

Online Simon

  • Global Moderator
  • *****
  • Posts: 14437
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: off the shelf PID control IC ?
« Reply #19 on: March 15, 2013, 07:58:55 pm »
I found the TLE4206 at RS which looks good.
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1283
  • Country: fi
Re: off the shelf PID control IC ?
« Reply #20 on: March 15, 2013, 08:25:09 pm »
i'M THINKING SOMETHING ALONG THE LINES OF THE ATTACHED
Won't work, i am afraid. That is an oscillator, not to mention that i have serious doubts about the circuit itself.
You are obviously trying to take shortcuts that won't result in a working system.

I found the TLE4206 at RS which looks good.
That looks better, if you can get it. DK at least says "non-stocked"
« Last Edit: March 15, 2013, 08:29:41 pm by Kremmen »
Nothing sings like a kilovolt.
Dr W. Bishop
 

Online Simon

  • Global Moderator
  • *****
  • Posts: 14437
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: off the shelf PID control IC ?
« Reply #21 on: March 15, 2013, 08:31:33 pm »
yea that was meant to be quick and nasty.

I'm guessing a proper system will need a diff amp to give a value of how far apart what you have and what you want is and that needs to be fed into a pwm circuit (triangle wave gen + comparator) that also needs some way of differentiating direction. Hysteresis is needed and a minimum value of PWM must be maintained to get you into the hysterysis region so that's added circuitry and i have no idea of how to put in a bidirectional hysteresis.

I'm hoping that chip from RS will do it, they say it's for things like headlighht alignment and that is similar to what we want.
 

Offline Cones

  • Regular Contributor
  • *
  • Posts: 62
  • Country: gb
Re: off the shelf PID control IC ?
« Reply #22 on: March 15, 2013, 08:32:43 pm »
Is something like this any good?

http://www.pololu.com/docs/0J38/1.a

I've used the standard servo controller they make before, for small self contained operation without a model Receiver. The above board has built in PID and a software interface to tune it.

Mark
 

Online Simon

  • Global Moderator
  • *****
  • Posts: 14437
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: off the shelf PID control IC ?
« Reply #23 on: March 15, 2013, 08:34:26 pm »
this needs to be cheap and not require any "programming" unless I just go for an MCU and to be fair i did once and nearly nailed it.
 

Offline Cones

  • Regular Contributor
  • *
  • Posts: 62
  • Country: gb
Re: off the shelf PID control IC ?
« Reply #24 on: March 15, 2013, 08:35:13 pm »
They make this BIG servo that is driven with the above board.

http://www.pololu.com/catalog/product/1391

HTH

Mark
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf