# What is a "PID"???



## fwismoker (Jan 14, 2013)

Most acronyms i can eventually figure out but i'm at a loss on this one.


----------



## diggingdogfarm (Jan 14, 2013)

http://en.wikipedia.org/wiki/PID_controller


~Martin


----------



## fwismoker (Jan 14, 2013)

Someone just linked a video of understanding a PID in 4 minutes and it looks like an equation to building a nuclear reactor or something.  Can we say things in English sometimes?   Is this thing some kind of automatic temperature control like a bbq guru i have?


----------



## gotbags-10 (Jan 14, 2013)

Yep use them for temp control. I use one with a solid state relay for my electric smoker but you can also put a fan on it to controll charcoal smokers as well


----------



## diggingdogfarm (Jan 14, 2013)

In a nutshell, it's an intelligent temperate controller.
I don't know anything about the Guru.
Obviously, not all temperature controllers are PIDs.

~Martin


----------



## gigantor (Feb 17, 2013)

*proportional-integral-derivative controller*


----------



## dward51 (Feb 17, 2013)

gigantor said:


> *proportional-integral-derivative controller*


Ouch, that makes my brain hurt! 

It's a little box that controls the heating element in a electric smoker (99% of the time, but it can be used for other purposes such as to make a power draft like a Guru, or as a thermal limiter, etc... as well).  Dial in what temp you want and let it do it's thing. That's where the integral derivative thingy part comes in....


----------



## handymanstan (Feb 17, 2013)

If you ask me it's a lifesaver. For electric or charcoal smokers the  PID and the Maverick 732 and you are pretty much set it and forget it till the maverick alarms.

Stan


----------



## holyfeld (Jul 21, 2013)

The two basic ways to control temperature to a set point. On-off control and continuous control.

A great example of on-off control is the thermostat on your air conditioner. You set a temperature you want for the room. If the temperature gets far enough above the setpoint, a relay closes and the air conditioner turns on. When the temperature falls far enough below the setpoint the relay opens and the air conditioner turns off.

Continuous control is like the cruise control on your car. Gas always flows to the injectors. If the car is going faster than the setpoint, less gas flows and the car slows; if the car is going slower than setpoint, more gas flows and the car speeds up.

PID is a form a continuous control. This means rather than "All On" or "All Off", the power cycles on/off several times a minute. The output is computed by the equation:

Output = Kp*e(t) + Ki*[integral of errors] + Kd*[derivative of two most recent errors] where

Kp*e(t) is the proportional term - P and contributes based on the difference between the current temp and the previous temp reading

Ki*[integral of errors] is the integral term - I and contributes based on the sum of all errors. As dward51 said, it's the magic.

Kd*[derivative of two most recent errors] is the derivative term - D and adds or subtracts based on the derivative of the current temp and previous temp.

The constants Kp, Ki, and Kd can be manually calculated, but most modern PID controllers have an "auto-tuning" feature that does this usually better and quicker than manual calculations.

As HandymanStan says ... "[color= rgb(24, 24, 24)]If you ask me it's a lifesaver."[/color]


----------



## dcarch (Jul 21, 2013)

I think a PID is a high precision electronic thermostat which has some "intelligence" built in.

It can “learn” the output characteristics of your heating element (assuming it has constant output, such as an electric heater) and thermal mass/heat loss of your cooking vessel and make the necessary adjustments to the on-off cycle to keep your set temperature constant.

dcarch


----------



## sigmo (Aug 20, 2013)

You've gotten some good replies to your question, but I'll pontificate a bit more in case it's of some help.

As has been said, a PID controller is simply a sophisticated controller that tries to use some "smarts" to control something (temperature in our case) by adjusting the power to the heater intelligently.  Many PID controllers can auto-tune themselves to work well with whatever gadget we're controlling.  They've gotten cheap and can work extremely well.

As Holyfeld pointed out:

With an "on off" (often called a "bang-bang" controller), the thing being controlled is switched 100% on, or 100% off. There's no in between.  This is often all that can be done because the thing being controlled can only BE fully on or fully off.  The air conditioner is a good example, and so is a typical gas or oil burning furnace.  You can't turn your air conditioner half or 1/3 on (usually) and likewise, the typical gas or oil-burning furnace can only be switched on or off.

Further, something like a (typical) furnace or (typical) air conditioner needs to be left running for a while once you turn it on.  And likewise, you need to leave them off for a while once you turn them off.  The compressor in a normal AC unit needs to be left off for (for example) five minutes at a minimum whenever you switch it off so that the gas pressures can equalize and the liquid refrigerant can get to where it's supposed to be before you fire the compressor up again.  Failing to provide the required minimum "off time" can damage the valves in the compressor, etc.  In a typical furnace, the heat exchanger needs to get up to temperature before the furnace operates efficiently.  So once you've achieved that, you want to "make hay while the sun shines" so to speak and let it run for a while so you get some heat into the house and don't just waste it all up the flue.

So anyhow, there are many examples of heaters/coolers, etc., that CANNOT be operated in anything but a fully on / fully off control.

But the problem with any such "bang bang" control system is that you end up with fluctuation in temperature (in the case of a temperature control system).

There MUST be either a built-in time delay to guarantee the minimum on or off times for the system OR a temperature "hysteresis".  (Hysteresis is a fancy word for a built-in difference between the "on" temperature and the "off" temperature).  Using either or both of these will guarantee that the furnace or air conditioner (or whatever) doesn't cycle on and off too quickly.  Once that AC compressor is on, we run it for a good while.  Once that furnace is fired up, we let it run for a good while, too.  And once either is off, we let it "rest" for a good while.

Cycling your furnace or AC on and off too rapidly would be bad for the system, inefficient, and kind of annoying, too!

But, of course, that dooms us to the temperature in our room cycling up and down significantly!

The same is true with many old-style temperature controls in something like an old oven.

Even though an electric heating element _could_ be controlled more precisely, the normal old-style thermostats cycle them on and off quite slowly just to make their electrical contacts last longer.  (Fewer cycles = longer life).  The heating element couldn't care less, though, or would actually last longer if it was cycled more quickly, or better yet, controlled "proportionally".

So that gets us to "Proportional Control".

Proportional control is what we have when we operate the heater (or whatever) in a way that allows us to "throttle" the power or cooling being applied.

When you drive your car, you are using "proportional control" of the throttle by varying the position of the gas pedal.

Imagine if the only way you could control the speed of your car was by running the engine either at full power, or completely off!  (Yeah, I know, some people DO seem to drive like that, but that's another story).

Anyhow, imagine how you control the speed of your car when driving.  You adjust the position of the gas pedal with your foot, constantly, to provide just the proper amount of fuel to the engine to make it produce just the proper amount of power to maintain the desired speed.  If you start to go up a hill, you give it a bit more gas so that the speed won't drop.  If you start to go down a hill, you can let off on the gas a bit to compensate for the reduced load.  And all the time, you can glance at the speedometer to see if you're maintaining the speed you want.

In effect, your brain, eyes, and throttle foot are behaving as a sophisticated proportional controller.

And realize that this is a so-called "closed loop" feedback control system.  Your brain knows what the car's speed is by looking at the speedometer.  That's the "feedback".  You "close the loop" by pressing or releasing the gas pedal.

You're smart enough, and have enough experience driving, to understand, or "have a feel for" how much gas you need to give the car to get the car to the desired speed quickly, yet not "overshoot" the desired speed.  When you start from a stop, but want to be going 75 MPH, you know that you'll have to stand on the gas pretty hard.  Then, as the car's speed approaches 75, you slowly let off on the gas so that when the car reaches 75, you're applying just the correct amount of gas to maintain the car at 75.  You don't just mash the pedal 100% until you get to 75, then let off on the gas completely, then, seeing the speed drop below 75, mash the pedal to the floor again.

Instead, you apply just the right amount of fuel, and don't even really consciously think about it.  But what's happening, really, is pretty darned sophisticated.

A PID loop controller strives to do this seemingly simple control task.  But as with a lot of things we humans do all of the time, it's not as simple as you might think to reproduce that "intelligence" with a machine.

OK.  So, simple Proportional control is straightforward.

Let's consider an electric smoker.

The oven/chamber has a certain amount of internal mass.

We also have something we put in the oven that has its own "heat capacity".

Further, the oven is not perfectly insulated.

To complicate matters more, we have moisture in the meat, and as that moisture evaporates, it cools the oven.

Then, maybe we toss in a pellet burner to get smoke and it adds a bit of heat.

With simple proportional control, the idea is that we apply an amount of power to the electric heater that is proportional to the difference (error) between the setpoint and the actual oven temperature.

So let's say we have a 1200 Watt heating element.  And we set the proportional control to have a "proportional band" of 10 degrees.  And let's say we start with the oven at room temperature. Further, let's say we set the "setpoint" (desired temperature) to be 200 degrees.

When we switch the unit on, the oven temperature is more than ten degrees below the setpoint, so the heating element will receive 100% power.  It'll come on at 1200 Watts.  It will heat up for a while at 1200 Watts.  The controller constantly monitors the oven temperature and compares it to the setpoint.  Until the oven temperature gets up to 190 degrees, the heating element will receive 1200 Watts.

But as the temperature in the oven reaches 190 degrees, the proportional control will begin to back off on the power.

Theoretically, at 190, the control will give 100% power to the heater, and at 200 degrees, it'll give the heater 0% power.

At 195, it should give the heating element 50% power (600 Watts).

So what will happen, is that the oven temp will rise rapidly until we reach 10 degrees below the setpoint, and then the power will throttle back until we reach some steady (more or less) temperature.

BUT, since the power being applied is proportional to the error (difference between the setpoint and the actual temperature), AND since the oven is not perfectly insulated, AND the meat and inside of the oven are absorbing heat energy, the actual temperature at which the oven will "settle in" will always be lower than the setpoint.

The oven can never get to the setting of 200 degrees because the power being applied will be zero at 200 degrees.

So the oven may hover in the area of, say, 195 degrees.

Therefore, a "proportional only" control guarantees that we will have a constant error.

That might actually be just fine for a non-critical application.

But if you were driving, and the speed limit was 75, you wouldn't want to drive at 70.  You'd be passed, and block traffic, etc., causing an unsafe and annoying situation.  So you simply stomp down a bit more on the gas pedal and correct things.

That's what engineers wanted their temperature controllers to do.

But how?

That's where the "I" in PID comes in.  This is the integral term.

The idea is that the control watches the temperature over a somewhat long time interval and if it sees that there's a lingering error, it simply turns up the setpoint a bit  to correct for this "standing" error. It does this behind your back, without you actually adjusting the setpoint.

Another problem with any closed-loop control system is that of trying to make the controlled variable reach the setpoint as quickly as possible, but without overshooting that setpoint or "ringing" (oscillating).

In the Proportional-only situation, we could have simply adjusted the proportional band to be narrower until we were happy with the error being smaller.

For example, we could have set the proportional band to be only 2 degrees.  So at 198 degrees, we're still at 100% power, but at 200, we'd be down to zero.  But then you end up with a situation where the temperature overshoots the setpoint at first because the system doesn't anticipate the fact that the heating element itself will have stored up a lot of heat energy, and even though you shut it off quickly, it retains a lot of heat energy and continues to heat the oven up even after you've quickly let off on the gas, so to speak.

We'd be back to the person holding the gas pedal to the floor until they reach 75, then letting off completely on it again until they notice they're going too slow, etc.

So a too-narrow proportional band leads to overshoot and "ringing" (cycling up and down as the controller (or nut behind the wheel of the car) keeps seeing that they're over the setpoint, then below it, then over it, then below it, etc).

So we want a reasonable proportional band.  But then we are stuck with a "standing error".

Another thing we do, unconsciously, when driving, is we can anticipate the effect of what mashing the gas pedal will do.  We have a "feel" for the mass of the car, the power of the engine, and the air resistance, the rolling resistance of the tires, etc.

So we just "know" approximately how much fuel we've got to give the engine to adjust the speed to what we want in a reasonable time, and smoothly, without overshooting the desired speed "setpoint".

The PID loop attempts to "anticipate" what the system will do, too.

That's the "D" (or derivative) term in the PID loop.

The controller looks at the "rate of change" of the temperature.  If the rate of change is high, then it knows it's hammering the gas pedal too hard.  If the rate of change is really low, then maybe it knows to give it a bit more gas.

To achieve this PID loop control, there are a number of different PID algorithms (calculation formulas) that can be used.  Different ones suit different tasks (or actually - different designers personal tastes).

Anyhow.   A PID controller has the capability to be set up to control the temperature in an oven or smoker very well IF it is tuned properly.  The auto-tune built into a lot of the controllers is extremely good.  If you know what you're doing, you can put a PID controller to good use in an oven or smoker.

The downside, for many electric smokers, is that the design of the smoke generator depends on the idea that the controller will be a "bang-bang" type, "mashing the gas pedal to the floor" periodically so that the heating element is on full blast every so often.  That gets the heating element up to a high enough temperature that it can burn the chips to create smoke.

If we replace the bang-bang controller with a PID loop controller, we guarantee that we'll have little or no smoke except right at the start, when the smoker is first heating up, because that's the only time the heater will be on full blast.

So if you replace a temperature controller with a PID loop unit, you will need to provide a different means of producing smoke.

A smoker with a PID controller and an AMNPS, for example, would be a great system.

Also, you wouldn't need to be completely restricted to an electric heating element in your PID-Controlled smoker.  You could use a PID controller to control the speed of a fan that blows combustion air into a charcoal-heated smoker, etc.  The possibilities are endless!


----------



## blat (Aug 20, 2013)

here is pic of aubers pid  in action













20130805_181415.jpg



__ blat
__ Aug 20, 2013






once you get up to temp seldom does it vary by more than 2  degrees of your set temp.


----------



## hoity toit (Dec 14, 2013)

Sigmo said:


> You've gotten some good replies to your question, but I'll pontificate a bit more in case it's of some help.
> 
> As has been said, a PID controller is simply a sophisticated controller that tries to use some "smarts" to control something (temperature in our case) by adjusting the power to the heater intelligently.  Many PID controllers can auto-tune themselves to work well with whatever gadget we're controlling.  They've gotten cheap and can work extremely well.
> 
> ...


You have explained this where even I can understand it. thank you. Good explanation and examples.


----------

