# Controlling temperature using PIDs on two separate controllers

I have a pellet smoker, and I am customizing it for tighter temperature control. Currently, I am controlling how much material is burning to control temperature using a PID loop. I want to achieve tighter control by also slowing down or speeding up the fan in response to temperature changes. I'm looking to find an algorithm that would allow these two to work together.

A pellet smoker works by using an augur to feed wood pellets into a burn chamber. Temperature is controlled by turning the augur on or off to control the amount of material that is burning in the burn chamber, and varying the speed of a fan to control how much air is flowing to the burn chamber.

Currently, I am controlling temperature with a PID loop controlling only the augur motor. The fan is running at a fixed speed of 90% of its maximum.

This leads to an acceptable temperature range, but I would like to achieve tighter temperature control by also using a PID loop on the fan speed rather than running it at a fixed speed.

I can control the fan with a completely independent PID loop. But I was hoping someone can point me towards and algorithm that would get them working together since they are pretty tightly coupled, and the fan influences temperature faster, but also doesn't work at all if the augur isn't feeding enough material.

• Ideally you'd have a PID on the level of pellets in the burner that controls the auger, and another one on the temperature that controls the fan speed. That should decouple things nicely -- but you'd need a way to estimate the mass of pellets in the burner. It may be worth figuring out how to sense that -- support the burner on something that comes out to a scale, perhaps? Sep 4, 2019 at 20:57

Controlling temperature using PIDs on two separate controllers

Currently, I am controlling how much material is burning to control temperature using a PID loop. I want to achieve tighter control by also slowing down or speeding up the fan in response to temperature changes. I'm looking to find an algorithm that would allow these two to work together.

So what is the real question are you looking for an algorithm to use as a second separate controller?

There is one very basic problem with this approach. One controller will influence the other controller so you will have an unstable control cycle. For example as the fan reduced speed to reduce the temperature the argue speed would increase to raise the temperature back to it's original point, the fan would then reduce speed further to compensate.

This is a common problem in air conditioning where both humidity and temperature control are needed one fights the other for dominance. Although the example you have given is more complicated some of the basics remain the same. You cannot use two independent PID controls. A special set of circumstances exist in which one control (I will call it a channel) needs to have priority control.

What is required is a two channel PID controller with a priority control option.

To be honest I have never come a cross an algorithm for this that works successfully except in a dedicated controller like Eurotherm or someone similar would manufacture. 20 years ago they cost over 2000 usd. (you are paying for the development costs). Today I have no idea of the costs. Algorithms for PLC's from Siemens and the likes are next to useless and my old company asked a university to estimate a time and cost to develop such an algorithm They estimated 2 years at which point the cost became irrelevant and the idea was scraped.

Your problem is infinitely more complexed than trying to control Temperature and Humidity. They are just two independent states that are physically related. So you can control each and just give priority to one. What you are trying to do is create 2 channels which are both based on temperature so even though one channel could be given priority it will still produce conflict with the second channel and the result would be a totally unstable control cycle. I think even Einstein would have considered this a considerable challenge.

The only way forward that I can see is to decide on an alternative control strategy that provides two independent control channels, or scrap the idea.

However there is some light at the end of the tunnel If you had addressed this question to a cooking web site they may have given you better advice.

## A smoker with little airflow, like some electrics, creates a larger stagnant bubble of air protecting the meat from smoke. Rapid, random air movement breaks up the bubble. For example, a strong convection fan.

Without the smoke, you might as well be grilling.

Ideally, I would imagine there would be sufficient material in the burner and the fan speed would be the only thing to modulate to regulate temperature.

If that's the case, then I would have the target temperature as a reference input to the fan loop.

Then, what you're left to look at is actual fan speed. As the material in the burner is consumed, the fan will have to work harder to stoke the fire up to an acceptable temperature. Conversely, if there's too much material, then the fan doesn't need to do a whole lot.

So, considering that, then I would set the auger controller to achieve a target fan speed. I would start testing with a target fan speed reference of 50 percent, but you'll need to test because there's going to be some variation in how the fire is (or isn't) sustained at particular fan speeds.

So the fan speed modulates to regulate the temperature, and the auger moves to modulate the fan speed. As the fan speed creeps above the setpoint (the fire is dying), the auger feeds more material.

• That is an interesting idea, and it might actually lead to more smoke than current pellet grills which typically always run the fan at 100% and only feed material to change the temperature. If there is always plenty of material burning and I only control the fan most of the time it will be lots of material smoldering at lower temperatures, then it would flare up when the barrel temperature starts to drop. I wonder what effect this will have on the usage rate of pellets. So in this case I'll try a cascading PID with fan speed the input to the augur PID. Sep 5, 2019 at 14:21