# Pid Controllers - Part 2 of Why I don't recomend one.



## banjo (May 3, 2018)

My thoughts on "PID Controllers - Part 2 of Why I don't recommend one."

Topic 2: What are some different methods in controlling temperature?

Note: I'm specifically saying I don't recommend a PID controller, not that I don't want to control the temperature! Also, there is nothing wrong with using a PID controller; I'm just saying it's not needed!

I'm going to discuss the following, in order.

    1 Why are we interested in controlling smoke-chamber temperature?
    2 What are some different methods in controlling temperature?
    3 What is a PID controller?
    4 Why would someone use a PID controller?
    5 Is a PID controller needed?
    6 What is the optimum controller for controlling a pellet smoker?
    7 Why I don't recommend a PID controller



Previous: https://www.smokingmeatforums.com/threads/pid-controllers-part-1-why-i-dont-recommend-one.275085/

On the fire pit, temperature control was rather basic: throw another log on the fire if you want more heat, let it burn down if you want less. 

Once we had the wood burning Franklin stove and kitchen stove, we also had an air inlet damper that could control the amount of air flowing into the fire, and an exhaust damper that could control the amount of exhaust flowing out of the fire.  Meanwhile, the metal walls of the stoves and exhaust flues added additional heat, whether wanted (as in the winter) or hated (as in the summer).

The inlet air damper allowed the tuning of the air to fuel ratio, as is done in a carburetor and fuel injection.  Too little air, and there is a lot of un-combusted fuel sent out the exhaust as smoke; too much air could cause the temperature to drop and the fire to extinguish.  In some cases, extra fuel (as in gasoline engines - enriching the mixture) is deliberately added in order to cool the exhaust to protect valves. 

The optimum amount of air for the fire should produce the maximum temperature: too little and we get smoke and the fire isn't as hot; too much and we run clear exhaust but the exhaust is cooled by the extra air.

So the air-to-fuel mixture will influence what we see in the exhaust.

Clean burning fires result in exhaust may appear clear.  Since there is not any visible smoke, then there is less smoke-flavor imparted to items in the cooking-chamber (convection oven) area between the combustion-chamber and the exhaust.

In a wood-burning kitchen stove with two dampers, one inlet, the other outlet, the inlet-damper controls the amount of air that can easily flow into the combustion chamber, while the exhaust-damper, along with the vertical length of the exhaust pipe, controls the amount of low-pressure that exists in the combustion-chamber.  The lower the pressure in the combustion-chamber, the more air that will flow in through the inlet-damper opening for the same opening value.  This is sort of like "restrictor-plate racing in NASCAR": the engine basically provides the low pressure point within the engine cylinders, so the retstrictor is the inlet-damper set for a specific area.  The exhaust on the NASCAR vehicle is removed so the air-flow and fuel-flow are all at their maximum potential for a given restrictor-plate.  Maximum energy developed by the engine is controlled by the restrictor-plate.

For smoking meats, and other things, our ability to control temperature and the amount of smoke are critically important; otherwise, we could just make do with a standard kitchen-oven with it's standard 50 degree temperature swing.

So, ideally we would like to control both the amount of fuel in the combustion-chamber as well as the amount of air flowing into the combustion-chamber, in order to control the amount of smoke and temperature administered to the meat.

We get more smoke when the air-to-fuel mixture is not set for maximum temperature: as a smoker, we're not trying to burn our fuel at the optimal efficiency.  We typically want more smoke.

In my opinion, our wanting more smoke taste in our meats is a modern thing.  If I look at old BBQ pictures from NC, the meat is almost always laid out over supports above a pit that contains hot coals, not an open fire.  The wood is first burned to exhaust and consume the smoke, then the remaining coal is spread out under the meat.  I've prepared it this way, and it produces a very good tasting BBQ meat, but with a smaller hint of smoke than most people now days seem to prefer.

---Some Different Methods In Controlling Temperature---

The most basic method of controlling the temperature is to control the amount of air supplied to the combustion via the use of inlet-dampers and exhaust-dampers.  Assuming no air leaks into or out of the combustion-chamber other than the inlet and exhaust dampers, then you control the temperature easily within ten (10) degree swing (5 degree up, 5 degrees down) of your desired temperature.  But you have to stay with it.  I like to cook for long periods of time, so staying with my smoker manually controlling the dampers for a long period of time means I can't smoke meat as frequently as I would like.

This was my method from about 1989 - 1998.  I had three (3) different smokers during this time, all using this method.

So some sort of automation was desirable if I intended to smoke for a longer period of time, at a lower temperature.

--inlet air control, non-proportional via thermocouple and controller--
This is on-off inlet air control.  It can be as simple as a bi-metalic thermostat designed for high-temperature environments, that closes contact on low setpoint, opens contact when above setpoint.  But thermocouple temperature controls on Ebay for $20 are plentiful (or were the last time I bought one!).

My first automated design (around 1998) used an Arduino microcontroller and a thermocouple in the combustion-chamber, another one in the smoke-chamber, and a third one in the meat.  I wrote the code for this controller.  The one in the smoke-chamber was used by a controller to adjust an air-inlet valve I bought.  It wasn't proportional (meaning it didn't open up just a little for a small temperature decline vs open up a lot for a large temperature decline ); it was either fully open or fully closed.  I used the exhaust-damper as a throttle to help average out the amount and temperature of air passing through the combustion-chamber and into the smoke-chamber. 

This worked really well on my Big Green Egg (BGE).  I would have been happy ever after except for one problem:  the meat was directly over the coals, so I had to place some sort of deflector (eg., pizza stone) between the coals and the meat.  This meant the bottom of the meat didn't get much smoke.  In addition, I was pretty much stuck with charcoal, and it was difficult to add any additional fuel if needed.

Note: Automated temperature control, but no PID was necessary!

--forced fan control, non-proportional--
This can also be used, where the fan control is turned on by some device (e.g., thermocouple controller, bi-metallic thermostat, etc.)

I bought a BBQ Guru controller for my BGE, as it was more compact than the air-inlet damper control valve I had designed and had been using.  It was a commercial product, well designed, easy to use.  It used a temperature sensor to control the fan, which was placed in the air-inlet of the BGE.  IT worked really well, but of course had no way to over come the issues I had with the BGE: low smoke flavor, only charcoal, and meat directly above and in close proximity to the coals.

So I stopped using this.

Note: Automated temperature control, but no PID was necessary!

--Timer for gas heat on my enclosed porch--

My porch has removable Plexiglas panels with screens.  We take the Plexiglas panels down in the summer, and put them up in the late fall.  Then we can run our gas heater during the winter.  It didn't come with any controls, just an on/off switch that controlled a gas valve.

My first attempt at automating this was so we didn't have to get up to turn it off when the temperature got too warm, and up again to turn it on when the temperature got too cool. 

Using an Arduino and a relay, I opened and closed the gas valve to let gas in to the heater.   I wrote the code and built the circuit for the relay for this.  This first controller was a simple timer: it controlled the ratio of time on and time off.  When I first turned it on, I would just turn it on full time: on ratio was 100%.  When the temperature had wormed up to where we wanted it, I would back off the ratio until the heater turned off.  Then a couple of more adjustments over the next 10 - 20 minutes, and we were good to go for the rest of the day. 

Note: Automated temperature control, but no PID was necessary!

--Thermocouple controller for gas heat for enclosed porch--

I decided I would like a little more convenience than the timer offered; I decided I just wanted to be able to set the temperature and walk away.

Which is what I did, using an Arduino and a thermocouple, making the necessary software changes to the code.  I wrote the code and designed the circuit for this.

It worked even better than the timer approach.

Note: Automated temperature control, but no PID was necessary!

---Review---
I've demonstrated multiple instances of controlling the temperature without using a PID.

Different methods shown:
- Air inlet-damper control, on/off.  Used a thermocouple control to open/close the air inlet damper.  Non-proportional, non-PID.  Could have used an RTD as well, but since I also had thermocouples for the combustion chamber, I wanted to stay with the same system of sensors.
- Air inlet air flow, on/off.  Used a temperature sensor (not sure if RTD or thermocouple) to push air into combustion chamber when temperature increase was desired; fan off when at or above setpoint.
- Gas valve, on/off timer ratio.  Initial porch control.  No setpoint.
- Gas valve, on/off using thermocouple control for heat on/off. Non-proportional, non-PID.
Note: All were automated temperature controls, but no PID was necessary!

--My Pit Boss 820D--
Currently, I'm using what came with the unit.  In my opinion, it is terrible at controlling the temperature, if the setpoint method is used.  Using just the P "smoke" mode, it's basically a timer ratio controller: the auger supplies whatever amount of pellets will be fed to the combustion chamber in 18 seconds, followed by an off time, the duration of which is controlled by the P setting.  Appears that, on a given day, each P increase lowers my average temperature by about 20 degrees, and the temperature swing is about 20 degrees.  Not great, but can work with it until I get or build, something better.  May have to change P setting based on wind and temperature changes in the environment, but infrequent.  I have run for 25 hours at this setting and have been pleased with the results, maybe making 4 P changes during that time.

When in the temperature control mode, it almost appears to me that someone was trying to build a PID controller, and the Derivative function is ramped up way too high.  But I'm not aware of any method for changing this (e.g., a trim poi), except for a software upgrade, which would entail sending the controller back to PB.  So, for the time being, I'm not taking that route.  I have a friend that has the same module (he bought his a week before I bought mine), and has the exact same problem; he's going to call the manufacturer when he gets back from a trip.

---Conclusion---
As I shown by the examples above, a simple controller, much like the thermostat in your home, is sufficient to control the temperature of your smoker. 

I've demonstrated:

***** A PID is not necessary for precise temperature control of a smoker ****

Part 3: What is  PID Controller? will follow soon.

My background: 10 years in process control at nuclear power plants, as a technician and engineer, and 41 years in software. Smoking BBQ since 1989.

Banjo


----------



## JC in GB (Jun 20, 2022)

banjo said:


> My thoughts on "PID Controllers - Part 2 of Why I don't recommend one."
> 
> Topic 2: What are some different methods in controlling temperature?
> 
> ...



*A very interesting piece but the only differences between your non-PID and PID control system are the gain formulas.  Even in your Arduino programmed version, you used a mathematical formula to control the output based on the input error. *

*Proportional gain only is just a bang on bang off kind of controller.  Like your first air inlet design.

Proportional gain control works but has a high amount of hysteresis unless you have a very high gain which will cause your valve to open and close constantly.

So there you have P.

When you add integral gain, you smooth out the hysteresis that is caused by the proportional gain.  If you calculate the system time constant correctly, you can get very precise control using a PI regulator.

There you have PI.

Derivative gain is similar to having a very high proportional gain channel that will provide a sudden change in the output based upon the error trend.  It is simply another way of massaging the system gain.

Now, do you need PID for control, no you do not, but all of your alternative methods used the basic function for system regulation.  

Many people use PID controllers today as they are inexpensive and readily available.  Also, I can configure the PID parameters to use only P, or PI if I wish.

I could design and build an analog PI controller that would rival that of any digital PID but why?  That wheel has been invented and is the current state of the art.

Please don't get me wrong.  As a fellow gadgeteer and designer I salute your project accomplishments.   I look forward to reading your next installment.*

*JC  *


----------



## jbruce (Jul 1, 2022)

I think it all depends on your goal. If cooking good food is your goal, you can do that with temp swings of fifty degrees or more. Most temperature graphs I've seen for pellet smokers swing this much and they produce some fine food. Hell, most home ovens have giant temp swings.

If you're like me and you're in it for the technical challenge, an on-off controller, P controller, or PI controller will get you close... but not perfect. Every time I cook, I strive to get a little closer to perfect control. On my custom stick smoker with a custom built controller, that means small temperature swings [less than a few degrees F average error over an entire cook] ... regardless of environment changes like wind or rain or changes in available heat over time from the firebox. For instance, I can add a split without adjusting dampers and walk away from my smoker knowing the temperature at the meat wont change.

As a bonus while investing in this tech [and drinking a few beers], I get some really great food.









						GitHub - jbruce12000/smoker-controller
					

Contribute to jbruce12000/smoker-controller development by creating an account on GitHub.




					github.com
				




If you take a look at the code for this controller, you'll note that it is an on-off controller until it gets within a certain window close to the set point, then the PID takes over. On-off controllers have their place, but they only get you close.


----------



## Nefarious (Jul 1, 2022)

banjo said:


> My thoughts on "PID Controllers - Part 2 of Why I don't recommend one."
> 
> Topic 2: What are some different methods in controlling temperature?
> 
> ...


One thing to remember is that a PID controller can be used when one doesn't know the relationship between input and response.  The P, I, and D values allow one to find a best guess at that relationship.  If you know the relationship or have a system that you can figure the relationship out, then you are correct that you don't need a PID controller 

As an example think of how many different brands of smokers can use the exact same controller in totally different conditions.


----------

