Get your HBT Growlers, Shirts and Membership before the Rush!


Home Brew Forums > Home Brewing Beer > Automated Brewing Forum > PID settings on arduino based hlt
Reply
 
LinkBack Thread Tools
Old 06-03-2012, 12:45 AM   #21
chuckjaxfl
Feedback Score: 1 reviews
Recipes 
 
Join Date: Feb 2010
Location: Jacksonville, FL
Posts: 327
Liked 19 Times on 12 Posts
Likes Given: 23

Default

Quote:
Originally Posted by chuckjaxfl
Hopefully, I'll have better answers for you guys today. I'm working on it today.

The part that is pertinent to this thread is that I changed the Serial.print parts to work on the LCD (no biggie), and I changed a couple lines in the working code. Specifically, I changed the aTuneStep to 200, and the aTuneStartValue to 250. I'm hoping this will bring the rise & fall of the autotune to a reasonable rate, instead of the huge spike and the take-forever fall I experienced before.

I'll let you know how it goes.
Okay, this went over like a fart in church.

I guess the numbers will work, eventually! I have hard time accepting that my PID should just be a P with no ID.

I'd try it, throw some more cold water in and see, but something just quit working in the can, so I'll have to fix that first.

Frustrating DIY day.
image-2676334983.jpg  
__________________
chuckjaxfl is offline
 
Reply With Quote Quick reply to this message
Old 06-03-2012, 09:29 PM   #22
chuckjaxfl
Feedback Score: 1 reviews
Recipes 
 
Join Date: Feb 2010
Location: Jacksonville, FL
Posts: 327
Liked 19 Times on 12 Posts
Likes Given: 23

Default

It's official... I'm no help.

The autotune library continues to give me values similar to the above for P.. and zeros for I & D.

I spent some time last night reading about PID loop tuning. I'm going to post in the DIY section and see if I can get some help.

__________________
chuckjaxfl is offline
 
Reply With Quote Quick reply to this message
Old 06-04-2012, 12:42 AM   #23
Rbeckett
HBT_SUPPORTER.png
Feedback Score: 0 reviews
 
Rbeckett's Avatar
Recipes 
 
Join Date: Dec 2011
Location: Bronson, Fl
Posts: 987
Liked 66 Times on 47 Posts
Likes Given: 29

Default

Hey Chuck!!!
Any results on the I and D numbers yet? You know I am watching to sneak a peak at where you end up too. I am using the REX C-100's and have been hard at assembling the rest of the circuit boards and relays to support this system. I decided to learn C and went with the PIC 16f877A 40 pin chip for a developement and prototype of the system. Keep us up with your results please..
Wheelchair Bob

__________________

What do you mean "no Kidneys"???, WTF now I gotta drink less beer...
Join the Automation sub forum in Electric brewing for a discussion of components and control systems. I did!!!!

Rbeckett is offline
 
Reply With Quote Quick reply to this message
Old 06-04-2012, 01:46 AM   #24
chuckjaxfl
Feedback Score: 1 reviews
Recipes 
 
Join Date: Feb 2010
Location: Jacksonville, FL
Posts: 327
Liked 19 Times on 12 Posts
Likes Given: 23

Default

No... I'm close to giving up the faith on the autotune. I'm really frustrated with it.

The only idea I have right now is to drag my the Arduino IDE, my sketches, etc, and everything over to my windows laptop so I can drag my laptop out to the garage. I'll have to tolerate using Windows, but that will at least allow me to make modifications on the fly using the Processing front end, if I can get that up and running. I'll have to rebuild my PCB on a breadboard, too, so I can use my Arduino Nano to get speak to the laptop. As it is, I'm pulling the chip from my homemade PCB, bringing it into the house and installing it into my UNO... writing a change to it, then carrying it back out and reinstalling it. It's a pain in the butt, and make me wish I'd installed a ZIF socket on my PCB because the pins are getting worn out.

Then I guess I'm going to have to use Processing to adjust the tuning manually. I'm reading a lot about it. So far, it looks pretty unachievable. There are a few methods. The one with the most data available (Ziegler-Nichols) appears to allow overshoot, and stabilizes in "a few cycles" which, for us, may be 1/2 through a brew session. There's another method (Labmda) that appears to work like my Auber pids (nice ramp up to temp with little-no overshoot), but the information that is available assumes you are a controls engineer and already understand all the terms.

I'm also considering "cheating", hooking up my Auber PID, running autotune with it, and copying the parameters over. But, I tried that when I was working with the crockpot, and settings for one controller don't equal the settings in another. For instance, the "I" may mean "resets per second" for one, and "seconds per reset" in the other. Same with "D".

It all makes me want to give up and just put the damn Auber PID in there.

In any case, I'm sorry to the OP for hijacking your thread. I think, though, that my solution will also be your solution.

__________________
chuckjaxfl is offline
 
Reply With Quote Quick reply to this message
Old 06-05-2012, 07:44 PM   #25
MarcMTL
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jan 2011
Location: Montreal, Quebec
Posts: 39
Liked 1 Times on 1 Posts
Likes Given: 1

Default

Looks like the auto tune is trying to guestimate using the Ziegler-Nichols method (increase P till the system oscillates, then fix P,I,D based on some simple approximations). It might be easier just to do it yourselves.

http://en.wikipedia.org/wiki/PID_con...Nichols_method

Or, just make your own PWM based control based on the temp differential and a certain K factor

__________________
Primary: Ó Flannagáin Standard AG Stout
Secondary 1: -
Secondary 2: -
Conditioning: -
Drinking:Edwort's Haus Pale Ale w/ 2oz dry hop
MarcMTL is offline
 
Reply With Quote Quick reply to this message
Old 06-07-2012, 02:23 AM   #26
Rbeckett
HBT_SUPPORTER.png
Feedback Score: 0 reviews
 
Rbeckett's Avatar
Recipes 
 
Join Date: Dec 2011
Location: Bronson, Fl
Posts: 987
Liked 66 Times on 47 Posts
Likes Given: 29

Default

Marc,
The Wiki on PID's was outstanding. That was a very timely link and an even better explanation. Sometimes WIKI goes over my head, but this one made enough sense that I could follow most of it and it really helped me understand the concept of wind-up and what the parameters were really for. Thanks a bunch, it really did help me a lot!!!
Wheelchair Bob

__________________

What do you mean "no Kidneys"???, WTF now I gotta drink less beer...
Join the Automation sub forum in Electric brewing for a discussion of components and control systems. I did!!!!

Rbeckett is offline
 
Reply With Quote Quick reply to this message
Old 06-07-2012, 05:45 AM   #27
FastTalker
Member
HBT_SUPPORTER.png
Feedback Score: 0 reviews
 
FastTalker's Avatar
Recipes 
 
Join Date: Sep 2011
Location: Nashville, TN
Posts: 130
Liked 4 Times on 4 Posts
Likes Given: 4

Default

Quote:
Originally Posted by MarcMTL View Post
Or, just make your own PWM based control based on the temp differential and a certain K factor
Sounds like that's what he already has--a Proportional only controller.

Have you tried adjusting some of the parameters for the auto tune, like aTuneStep, aTuneNoise, or aTuneStartValue? Noise could definitely cause issues. Also, you want to try to perform the autotune in the middle of the operational range where your system probably has the most linearity. You are likely to experience non-linearity at limits.
__________________
FastTalker is offline
 
Reply With Quote Quick reply to this message
Old 06-07-2012, 08:58 AM   #28
matho
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jan 2012
Location: hazelbrook, New South Wales
Posts: 42
Liked 16 Times on 13 Posts
Likes Given: 6

Default

I have had the same experience with the PID library, I don't think it is very suited for water heating because it lets I term ramp up to 100% of the output and the only thing that will reduce it is an overshoot of the setpoint. The I term is there to remove the constant error that will be there with a P drive only. We are also dealing with a system that can only heat so if it does overshoot we just have to let it cool down so the PID has no control over that. With such a slow system the derivative has no real effect because the rate of change is very small, especially with a fast sample rate.
What I have done is to have the heat output on until 5 degs c from the set point, I then hand it over to the PID to bring the temperature to the setpoint. Doing it this way stops the I term from winding up too much.

here is part of the code.

Code:
  myPID.SetOutputLimits(0, 100);
  myPID.SetSampleTime(5000);
  myPID.SetTunings(50,0.01,10);

void PID_HEAT (void){
  if((Setpoint - Input)>5){
    digitalWrite(Heat,HIGH);
    if ((Setpoint - Input)<6)
   {
    myPID.Compute();
    }
  }
  else{
  myPID.Compute();
  unsigned long now = millis();
  if(now - windowStartTime>WindowSize)
  { //time to shift the Relay Window
    windowStartTime += WindowSize;
  }
  if((Output*(WindowSize/100)) > now - windowStartTime) digitalWrite(Heat,HIGH);
  else digitalWrite(Heat,LOW);
  }
}
I have set the output to 100 to represent 100%
I have changed the sample time to 5 seconds, on my system I can set the window size from 500mS to 5000mS, so with a window size of 5000mS and an output of 50 the heat output will be on for 2500mS and off for 2500mS.
With P set to 50 and an output limit set to 100 that means the output is always on until 2 deg c error then it starts to ramp down.
I trialled it with 20l and a 2400w element and it ramped from 25 deg c to 52 deg c at 1.5 deg / min and came up to the set point and didn't overshoot
I work in deg c because thats what we use down here but I sure you guys can convert to deg F. I hope this helps a bit, here is the full code for my brauduino controller which is designed to mimic a braumeister controller

https://github.com/mathoaus/braumise...brauduino2.ino

cheers steve
__________________
matho is offline
chuckjaxfl Likes This 
Reply With Quote Quick reply to this message
Old 06-07-2012, 03:25 PM   #29
rockytoptim
HBT_SUPPORTER.png
Feedback Score: 0 reviews
 
rockytoptim's Avatar
Recipes 
 
Join Date: May 2009
Location: Livonia, MI
Posts: 806
Liked 93 Times on 74 Posts
Likes Given: 3

Default

I have been using Arduino for about 2 years as my PID for my mash. I manual set my parameters by trial and error and help from the PID tuning wiki.

When I heard there was an auto tune library for the arduino I tried it but never got it to work. I am happy with the way my responds and reacts I was just wanting to see if autotune could improve it.

Here are my setting for PID maybe it helps some of you out.
P: 450,
I: 461.53
D: 0

Below is graph of my last batch I brewed.

The blue line on the bottomw is the PWM of the HERMS element. 255 is 100% and is on the y axis on the right. X axis is in minutes.

__________________

On Tap: Bee Cave Robust Porter
On Tap: Bee Cave OktoberFest
On Tap: Bee Cave Kolsch
Primary: None
Up next: ????

rockytoptim is offline
 
Reply With Quote Quick reply to this message
Old 06-07-2012, 07:06 PM   #30
FastTalker
Member
HBT_SUPPORTER.png
Feedback Score: 0 reviews
 
FastTalker's Avatar
Recipes 
 
Join Date: Sep 2011
Location: Nashville, TN
Posts: 130
Liked 4 Times on 4 Posts
Likes Given: 4

Default

Quote:
Originally Posted by matho View Post
I have had the same experience with the PID library, I don't think it is very suited for water heating because it lets I term ramp up to 100% of the output and the only thing that will reduce it is an overshoot of the setpoint. The I term is there to remove the constant error that will be there with a P drive only. We are also dealing with a system that can only heat so if it does overshoot we just have to let it cool down so the PID has no control over that.
The derivative term is what helps prevent a large amount of overshoot. A PID controller is certainly capable of controlling a integrating type temperature loop like this. This type of temperature loop shouldn't have a lot of integral gain it will just cause the controller to windup as you have pointed out. It should have a decent amount of P to get you moving toward the setpoint, only enough I to help you get to set point and a good amount of D to prevent significant overshoot.

Quote:
Originally Posted by matho View Post
With such a slow system the derivative has no real effect because the rate of change is very small, especially with a fast sample rate.
If the derivative term isn't doing anything it means that you don't have a large enough derivative term. You might be surprised how large a derivative gain may need to be to be effective.

PIDs are ubiquitous in industrial control systems. Their use in a heating applicationd similar to this is very common.
__________________
FastTalker is offline
 
Reply With Quote Quick reply to this message
Reply



Quick Reply
Message:
Options
Thread Tools




Newest Threads

LATEST SPONSOR DEALS