PID for BBQ smoker -- question about extending PID library to return if it's time to Compute

Skip to first unread message

Jun 16, 2011, 11:59:19 AM6/16/11
to DIY PID Control
I'm putting together a PID for a charcoal smoker (Thanks for the great

I'm using 2 k-type thermocouples with a dual MAX6675 shield from

This will run on a freakduino chibi (802.15.4 wireless w/ 8MHz
ATmega328p internal clock).

Anyway, considering the wireless cpu time, menu and lcd update time,
and the limited cpu, I'd like to make this as efficient as possible.

Basically I don't want to take the time to read each MAX6675 (5) times
to get an average value if Compute isn't going to run. I think this
will take much more time than an AnalogRead.

I was thinking of extending the PID library to include:
double PreComputeTime = 0
void .SetPreComputeTime(double ...)
float .GetPreComputeTime()
int .PreCompute() // return 1 if in Windosize - PreComputeTime area

Basically with a WindowSize of 5000 (or 10000), I just want to read
the MAX chips in the last 500 (or whatever) milliseconds, instead of
every single loop (where I'm doing wireless and menu stuff).

I'm going to code on it tonight, but I'd thought I'd see if anyone had
any thoughts on this.

And thanks to everyone on the list (and Brett for your excellent blog
posts on PID) -- I'm learning a ton of stuff.


Brett Beauregard

Jun 16, 2011, 12:26:32 PM6/16/11
Another thing you could try is a GetLastCalcTime() function that just returns the internal "lastTime" variable.  that would tell you the last time the pid calculated, which you could use to trigger a read from the therocouples.

Jun 16, 2011, 12:29:26 PM6/16/11
to DIY PID Control
Thanks -- that seems to make more sense and it would keep the PID
library clean.

I'm glad I asked before doing anything....


On Jun 16, 11:26 am, Brett Beauregard <> wrote:
> Another thing you could try is a GetLastCalcTime() function that just
> returns the internal "lastTime" variable.  that would tell you the last time
> the pid calculated, which you could use to trigger a read from the
> therocouples.
> On Thu, Jun 16, 2011 at 11:59 AM, <


Jun 17, 2011, 1:43:51 AM6/17/11
to DIY PID Control
> I'm putting together a PID for a charcoal smoker (Thanks for the great
> library...)

Me too! Just curious - what type/brand of charcoal smoker are you
using? I recently built a UDS with a PID controller, and I love it.
It makes it a lot easier for me to learn and focus on the food rather
than the smoker.


Jun 17, 2011, 9:29:07 AM6/17/11
to DIY PID Control
Bringing the discussion back on list if you don't mind...

Your smoker sounds very cool! When I get the time, I'd like to build
a big one like that.

Anyway, I've got a used medium green egg that I mostly smoke boston
butts on for bbq.

I'm using a 10 CFM blower w/ adapter plate (in the mail -- not
After reading your post, I think I could have gone smaller...

Your setup is very interesting with damper and motor control.

(I'm sure you know most of this, but I'll throw out what I've
researched for anyone else reading this)

Most of the ceramic smoker setups I've researched simply pulse the
They recommend to really close off the top of the smoker so smoke can
barely draft out.
(then a damper is not needed). Then the centrifugal motors motor
pulse for 0 to whatever seconds and then are off for so many seconds.
This pushes the smoke out the top and gives oxygen to the coals, then
it lets the meat sit in the heat and smoke with very little draft.
This also lets the motor is run at full voltage so the lifetime should
be good.

Your setup sounds pretty slick for metal smoker (I can't imagine how
much food you can get on there...)

I was hoping to have all the parts by the weekend, but I think it
might be next week -- I'll post an update and pics when I get it

Even though we have different output requirements, it might be helpful
for anyone making one like yours if they had your PID Variables as a
starting point. I might use them as a start point (magnified by my



On Jun 17, 12:43 am, Murl <> wrote:
> Hi, Jeb!
> Sorry, I tried to strike up a conversation on the Google group before I
> noticed your email.
> What kind of smoker are you controlling? How big is your blower? It sounds
> like we're doing similar things with different setups, so it'll be
> interesting to see how yours progresses.
> On mine, the only air intake I have is a single 3/4" pipe nipple welded into
> the side of the drum towards the bottom. I have a ball valve threaded onto
> the nipple, and a small blower attached to the valve. I read a blog
> somewhere that someone had used a 5cfm blower for his, so that's what I
> bought. When it came in, though, I thought for sure it was too small. I
> almost ordered a bigger one before even trying the one I bought. It turns
> out that 5cfm was plenty - in fact, I found that a lot of the time I was
> having to throttle back the ball valve in order to keep it from drafting
> through the blower and running too hot. Later, I built a dampner for the
> blower intake that's controlled by a servo connected to my controller. Now,
> I can do a 14+ hr smoke without adding charcoal or worrying too much about
> the temperature. When I first fire it up, it runs mostly off the dampner,
> then over time, the dampner ends up wide-open, and it controls off of the
> blower.
> So, the short version is that I'm not using a WindowSize, because I'm using
> analog outputs for both devices. The output range on the PID controller is
> 0-100%, with 0-50% being used for the dampner, and 50-100% being used for
> the fan. I'm still playing with the tuning a little, but that arrangement
> seems to be working pretty well.
> The only minimum I have is that I don't run the fan between 0-10% of full
> speed - but that's mainly to save the motor, since it starts sounding weird
> if I try to run it too slow.
> Please let me know if there's anything I can do to help you out. I'm also
> interested in hearing more about your smoker.
> Thanks!
> -Murl

Wes Mays

Mar 23, 2022, 1:43:14 PM3/23/22
to DIY PID Control
This is a relatively old string (circa 2011) and wondering if anyone is still monitoring.  I've got a Oklahoma Joe's offset wood smoker.  I'm currently using a commercial PID that is running a stepper motor to open and close the damper to control air flow.  It currently only does "open" and "shut".  I have coded the Arduino PID to run the stepper motor, but am curious as to the parameters that I need to set.  This is a very large smoker with a very slow response.  It takes a full hour for the temperature chamber to go from 60 degrees to 225 degrees.  Any guidance on where to start?  I'm currently using 4, .2, 1 but my testing is showing that something is not right.  I haven't implemented it yet; still in the testing stage.

Richard Appleton

Mar 23, 2022, 2:08:36 PM3/23/22
Are you setting the sample time? The default is 1/10 of a second which is reasonable for controlling a motor, but not great for controlling a glacier.

/* SetSampleTime(...) *********************************************************
 * sets the period, in Milliseconds, at which the calculation is performed   
void PID::SetSampleTime(int NewSampleTime)

Maybe start with 60,000 (a minute), though for testing and development purposes you may want to choose something like 6 seconds, then you would simulate the smoker temp change at something like 10 times speed. I think there is a thread on the list somewhere that talks about a setting a reasonable 'starting tuning' sample time in relation to the system response time.


You received this message because you are subscribed to the Google Groups "DIY PID Control" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Wes Mays

Oct 3, 2023, 10:59:29 AM10/3/23
to DIY PID Control
Richard Appleton and all:

Sorry for not responding.  I somehow was not receiving responses to this string.  To answer your first question, I am not setting the sampling time, but I am only measuring the temperatures every 15 seconds (that seemed like a reasonable time).

A year has passed and I've learned a lot.   I'm now into my 4th version (both hardware and software).

Primarily, I've learned (or re-learned) that PID's are fundamentally designed to operate in a linear region.  The system that I put together worked fine when I slowed the parameters and increased the gain but only while the combustion was relatively "controlled".  I ran into big problems with overshoot when the fire got "out of control".  Essentially when the heat source (fire) was either increasing or decreasing, the response rate was beyond the capacity of the PID to keep up.  I tried using "aggressive" and "mild" tuning parameters for the PID, but it just didn't work well.  I may have been able to get that to work, but it was very dependent on where the switchover from mild to aggressive was.     I ended up with crazy temperature swings in the firebox.  The cookbox, being so large, was not as impacted as much, but still bothered me.

I've now adjusted the code so that I only use the PID in a relatively narrow window (temperature wise)  and simply open or close the damper if the temperature is out of that range.    This is essentially overriding the "aggressive" mode and only using the "mild".  I also look at the slope of the temperature to determine whether to open or close the damper.  As I gain some experience with this system, I plan to start using the firebox temperature as the control point, not the cookbox temperature, but I will have to use the cookbox temperature to adjust the set point for the firebox.  So it's going to be a 2nd degree control loop.

Yes, it's getting complicated.  I've got hundreds of lines of code and countless hours troubleshooting both the hardware and software.  Getting closer to a workable solution.

Wes M
Reply all
Reply to author
0 new messages