willblev / SmokeyTheBarrel

Automatic temperature controller (ATC) for an ugly drum smoker (UDS)
23 stars 4 forks source link

Update on your smoker controller #1

Closed SouthernAtHeart closed 6 years ago

SouthernAtHeart commented 6 years ago

Hi, I’m wondering how this project is working out for you after 6 months. I’m working on making a similar project and was wondering if the Wemos wifi is working well for you. Thanks.

willblev commented 6 years ago

It's working out swell! The only things I have changed were some snippets of code to correct for some of the temperature probes which were giving low readings, and adjusting the PID.

On Feb 23, 2018 03:43, "SouthernAtHeart" notifications@github.com wrote:

Hi, I’m wondering how this project is working out for you after 6 months. I’m working on making a similar project and was wondering if the Wemos wifi is working well for you. Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/willblev/SmokeyTheBarrel/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AFot7ZYl1T0zDQBHpVTyiJ4i2y1hWGy6ks5tXiXfgaJpZM4SQTnH .

SouthernAtHeart commented 6 years ago

That sounds great! Is the code here your latest code?

willblev commented 6 years ago

Most likely it is not, but I will update it soon :-)

On Fri, Feb 23, 2018 at 5:22 PM, SouthernAtHeart notifications@github.com wrote:

That sounds great! Is the code here your latest code?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/willblev/SmokeyTheBarrel/issues/1#issuecomment-368058473, or mute the thread https://github.com/notifications/unsubscribe-auth/AFot7QJ1R-CgEvJcKt8RIzOuFKf6-n6oks5tXuXKgaJpZM4SQTnH .

SouthernAtHeart commented 6 years ago

Have you been able to tweak your code some? Could you post your latest code with improved PID control. Thanks!

willblev commented 6 years ago

Oh jeez, I'm so sorry- I completely forgot to reply!

The only part of the code that I've changed over the past few months are a few lines that deal with getting the UDS up to the correct temperature & holding the temperature there. I have tweaked the values for the tuning parameters for the PID, but you will likely have to adjust these to suit your own UDS (lines 38-40):

//Define the aggressive and conservative Tuning Parameters (PID)
double aggKp=8, aggKi=0.2, aggKd=1;
double consKp=2, consKi=0.1, consKd=.5;

The values you should use for your UDS will depend on several factors- since you will have a slightly different setup (different coal bucket, different blower, different heat dissipation, etc.) the speed which your barrel heats up will be different to mine. The best way to test this out is to track the temperatures of the probes over time, then check to see if your temperature controller is doing what you want it to do.

I noticed that my barrel would heat up quickly when I first started it, but it would stop when it got to ~10 degrees below my target temperature. This was because I had told it to switching from the agressive tuning parameters to the conservative tuning parameters when it got within 10 degrees of the target temp (on line 197):

} else if(gap > 0 && gap<=10) {  //we're close to setpoint, use conservative tuning parameters

I've since changed the 10 in this line to 3, so it is 'easier' for the PID to get close to the target temperature with the aggressive parameters, then to fine-tune the last 3 degrees.

You will also probably want to adjust line 232, as the true temperature inside the UDS will not be exactly the same temperature as your probes may say. In my case, because the thermocouples are located on the exterior of the barrel, there is quite a big difference between the indirect heat that the thermocouples experience, and the more direct heat that the meat gets (in my case, there is ~45 degrees C difference).

tempWeightedAvg=((probe_A+probe_B+probe_C+probe_D)/4)+45; //add 45 to compensate for outside of barrel being cooler than center

Hope this helps!

SouthernAtHeart commented 6 years ago

Thanks so much! My custom board I’ve made is just on its way in the mail now, so I’ll be ready to start testing. I made a little PCB that the Wemos plugs into, it has accommodation for three thermal couples and two motors drivers. I know the most difficult part is going to be the PID tuning. Cheers.

Charlie Kerr

On May 23, 2018, at 10:55 AM, Will notifications@github.com wrote:

Oh jeez, I'm so sorry- I completely forgot to reply!

The only part of the code that I've changed over the past few months are a few lines that deal with getting the UDS up to the correct temperature & holding the temperature there. I have tweaked the values for the tuning parameters for the PID, but you will likely have to adjust these to suit your own UDS (lines 38-40):

//Define the aggressive and conservative Tuning Parameters (PID) double aggKp=8, aggKi=0.2, aggKd=1; double consKp=2, consKi=0.1, consKd=.5; The values you should use for your UDS will depend on several factors- since you will have a slightly different setup (different coal bucket, different blower, different heat dissipation, etc.) the speed which your barrel heats up will be different to mine. The best way to test this out is to track the temperatures of the probes over time, then check to see if your temperature controller is doing what you want it to do.

I noticed that my barrel would heat up quickly when I first started it, but it would stop when it got to ~10 degrees below my target temperature. This was because I had told it to switching from the agressive tuning parameters to the conservative tuning parameters when it got within 10 degrees of the target temp (on line 197):

} else if(gap > 0 && gap<=10) { //we're close to setpoint, use conservative tuning parameters I've since changed the 10 in this line to 3, so it is 'easier' for the PID to get close to the target temperature with the aggressive parameters, then to fine-tune the last 3 degrees.

You will also probably want to adjust line 232, as the true temperature inside the UDS will not be exactly the same temperature as your probes may say. In my case, because the thermocouples are located on the exterior of the barrel, there is quite a big difference between the indirect heat that the thermocouples experience, and the more direct heat that the meat gets (in my case, there is ~45 degrees C difference).

tempWeightedAvg=((probe_A+probe_B+probe_C+probe_D)/4)+45; //add 45 to compensate for outside of barrel being cooler than center Hope this helps!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

willblev commented 6 years ago

Here's a fairly detailed explanation behind the PID magic. As far as I understand, the algorithm will eventually sort itself out, but starting with the right parameters will get the smoker to your target temp faster (and keep it there). Let me know if you end up posting the PCB!

SouthernAtHeart commented 6 years ago

Got my board in, but I’ve been tied up with other things. I will send you some photos of my project when I get it done.
Later, Charlie

On May 27, 2018, at 2:39 PM, Will notifications@github.com wrote:

Here's a fairly detailed explanation behind the PID magic https://www.controleng.com/single-article/understanding-pid-control-and-loop-tuning-fundamentals/61530560e8cf5044c7291bda7e44b655.html. As far as I understand, the algorithm will eventually sort itself out, but starting with the right parameters will get the smoker to your target temp faster (and keep it there). Let me know if you end up posting the PCB!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/willblev/SmokeyTheBarrel/issues/1#issuecomment-392360827, or mute the thread https://github.com/notifications/unsubscribe-auth/ABlnH9cUfTJEG7aZFYNbQPkRkG2YPqOWks5t2wDbgaJpZM4SQTnH.

willblev commented 6 years ago

Hope your smoker is now up and running smoothly! I will update this repo soon to include some code which protects against undesired ATC behavior which could happen if any of the temperature probes stop working in the middle of a smoke. I'm going to close this issue, but feel free to contact me about any future questions!