Brewery Programming
-
- Telling imaginary friend stories
- Posts: 5229
- Joined: Sun Oct 16, 2011 1:49 pm
- Location: Cowley, Oxford
Re: Brewery Programming
Oh dear ive started reading about CT sensors and arduino now, i can guess where this will go..
have you tried the auto tune lib to derive your variable set steve? tho you might need to set the sample time back for that.
have you tried the auto tune lib to derive your variable set steve? tho you might need to set the sample time back for that.
ist update for months n months..
Fermnting: not a lot..
Conditioning: nowt
Maturing: Challenger smash, and a kit lager
Drinking: dry one minikeg left in the store
Coming Soon Lots planned for the near future nowt for the immediate
Fermnting: not a lot..
Conditioning: nowt
Maturing: Challenger smash, and a kit lager
Drinking: dry one minikeg left in the store
Coming Soon Lots planned for the near future nowt for the immediate

Re: Brewery Programming
Fil, no I haven't, I just think its weird that if I term is there to remove a consistent error why is it let to ramp to 100% of the output and not clamped to a percentage of the output. This PID algorithm might be good for drives that can drive both ways but for heating water we can heat but cooling is going to be slower so if we overshoot the temp takes a longer time to come down. Anyway I have changed the code a bit to clean up the change over from ON to PIDFil wrote:
have you tried the auto tune lib to derive your variable set steve? tho you might need to set the sample time back for that.
Code: Select all
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);
}
}
Re: Brewery Programming
I don't think this needs a new thread so Ill post it here
http://www.mediafire.com/?v9tswo53m22gypd
this is a ZIP of the manuals,eagle files and programs to make a brauduino controller.
cheers steve
http://www.mediafire.com/?v9tswo53m22gypd
this is a ZIP of the manuals,eagle files and programs to make a brauduino controller.
cheers steve
- barneey
- Telling imaginary friend stories
- Posts: 5423
- Joined: Mon Jul 25, 2011 10:42 pm
- Location: East Kent
Re: Brewery Programming
Steve,
Nice work on the files mate.
Cheers
Nice work on the files mate.
Cheers
Hair of the dog, bacon, butty.
Hops, cider pips & hello.
Name the Movie + song :)
Hops, cider pips & hello.
Name the Movie + song :)
Re: Brewery Programming
hey guys, I have been playing with the PID library for the Arduino and have added a function to clamp ITerm, everything else is the same as the PID_V1 library,
http://www.mediafire.com/?oo9e5b0t7g1l08w
I have loaded it up to my unit and it seems to work the line of code to clamp the ITerm is,
put it in where you load up your pid settings , what it does is stops the ITerm from ramping up to 100% of the output and causing overshoot. I would suggest to set it to the maximum % of the output needed to keep the temperature constant at the highest mash temp needed, I have my output max set at 100 and at 75dec I need about 19% power to hold the temp constant.
cheers steve
http://www.mediafire.com/?oo9e5b0t7g1l08w
I have loaded it up to my unit and it seems to work the line of code to clamp the ITerm is,
Code: Select all
myPID.SetITermClamp(0,20);
cheers steve
Re: Brewery Programming
Hi Steve,
As an Arduino begginer, I did not understand how you did to change the program to insert the new code (Iterm). Can you help me?
Cheers Claudio
As an Arduino begginer, I did not understand how you did to change the program to insert the new code (Iterm). Can you help me?
Cheers Claudio
Re: Brewery Programming
hey Claudio,
First thing is you have to put the library into the arduino library folder, then where it says
#include <PID_V1.h>
at the beginning of the code, replace it with this
#include <PID_v1_ITerm_Clamp.h>
next in the "load_PID_settings" function add
myPID.SetITermClamp(0,20);
I ran the library the other day and while it worked OK I wasn't really happy with it, I have been looking at the PID library that the brewtroller uses and it looks a lot better at stopping I windup, I have just changed the library to include the I term windup control so if you wait a bit then I should be able to give it a run and see how it works.
cheers steve
First thing is you have to put the library into the arduino library folder, then where it says
#include <PID_V1.h>
at the beginning of the code, replace it with this
#include <PID_v1_ITerm_Clamp.h>
next in the "load_PID_settings" function add
myPID.SetITermClamp(0,20);
I ran the library the other day and while it worked OK I wasn't really happy with it, I have been looking at the PID library that the brewtroller uses and it looks a lot better at stopping I windup, I have just changed the library to include the I term windup control so if you wait a bit then I should be able to give it a run and see how it works.
cheers steve
Re: Brewery Programming
Hi Steve,
I tought that I would have to include the library not change (I'm stupid). I'll be waiting your reply about the test.
Cheers Claudio
I tought that I would have to include the library not change (I'm stupid). I'll be waiting your reply about the test.
Cheers Claudio
Re: Brewery Programming
[quote="Matho"]hey Claudio,
First thing is you have to put the library into the arduino library folder, then where it says
#include <PID_V1.h>
at the beginning of the code, replace it with this
#include <PID_v1_ITerm_Clamp.h>
next in the "load_PID_settings" function add
myPID.SetITermClamp(0,20);
I ran the library the other day and while it worked OK I wasn't really happy with it, I have been looking at the PID library that the brewtroller uses and it looks a lot better at stopping I windup, I have just changed the library to include the I term windup control so if you wait a bit then I should be able to give it a run and see how it works.
cheers steve[/quote]
Hi Steve,
Any news?
First thing is you have to put the library into the arduino library folder, then where it says
#include <PID_V1.h>
at the beginning of the code, replace it with this
#include <PID_v1_ITerm_Clamp.h>
next in the "load_PID_settings" function add
myPID.SetITermClamp(0,20);
I ran the library the other day and while it worked OK I wasn't really happy with it, I have been looking at the PID library that the brewtroller uses and it looks a lot better at stopping I windup, I have just changed the library to include the I term windup control so if you wait a bit then I should be able to give it a run and see how it works.
cheers steve[/quote]
Hi Steve,
Any news?
Re: Brewery Programming
Hi Claudio,
I have been working on the PID library and have made it so if the P is larger than the output max, the ITerm is set to 0 and if P is less than the output min ITerm is reset to 0. I have tried this and it seems to work really well on multiple steps, the other option I tried worked well on the first step but then because ITerm was already wound up a bit from the first step the second step would overshoot. I don't think there is much need to change libraries for the original code because I made it only to use the PID when it was within 5 deg's of the set temperature. You can see it in the PID_heat function
If you want to use the new library I would suggest deleting the code in the red
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);
}
}
http://www.mediafire.com/?htzio472x8xbxrl here is the new library there is nothing else to add the the original code except changing the
#include <PID_V1.h>
to
#include <PID_V102.h>
and don't worry about setting the ITerm clamp as its not required.
cheers steve
I have been working on the PID library and have made it so if the P is larger than the output max, the ITerm is set to 0 and if P is less than the output min ITerm is reset to 0. I have tried this and it seems to work really well on multiple steps, the other option I tried worked well on the first step but then because ITerm was already wound up a bit from the first step the second step would overshoot. I don't think there is much need to change libraries for the original code because I made it only to use the PID when it was within 5 deg's of the set temperature. You can see it in the PID_heat function
Code: Select all
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);
}
}
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);
}
}
http://www.mediafire.com/?htzio472x8xbxrl here is the new library there is nothing else to add the the original code except changing the
#include <PID_V1.h>
to
#include <PID_V102.h>
and don't worry about setting the ITerm clamp as its not required.
cheers steve
Re: Brewery Programming
Hi Steve,
I'm finishing the project and will try it soon. Thank you again.
cheers Claudio
I'm finishing the project and will try it soon. Thank you again.
cheers Claudio
- barneey
- Telling imaginary friend stories
- Posts: 5423
- Joined: Mon Jul 25, 2011 10:42 pm
- Location: East Kent
Re: Brewery Programming
Thanks to Matho, Ive got my PCB today, do just need to order the components, then I can start building 
Cheers

Cheers
Hair of the dog, bacon, butty.
Hops, cider pips & hello.
Name the Movie + song :)
Hops, cider pips & hello.
Name the Movie + song :)
- barneey
- Telling imaginary friend stories
- Posts: 5423
- Joined: Mon Jul 25, 2011 10:42 pm
- Location: East Kent
Re: Brewery Programming
I need help in getting a relay for the project, I can get them from RS but they want to charge an additonal £10.00 for the shipping of the thing!
Part Number G5SB-14-DC12.
Anyone help please?
Part Number G5SB-14-DC12.
Anyone help please?
Hair of the dog, bacon, butty.
Hops, cider pips & hello.
Name the Movie + song :)
Hops, cider pips & hello.
Name the Movie + song :)
Re: Brewery Programming
Hey barneey,
Farnell has them too http://uk.farnell.com/omron-electronic- ... =lookahead
If thats no good they cost me about $2.20 au free delivery from RS australia (the part has to come from the UK, go figure) and post it back (air mail would be $12.50 and sea mail would be $7.75). I picked the relay because it was easy for me to get and a good price too but as with all relays it has a unique footprint. A G5Q will also fit in its place
http://www.components.omron.com/compone ... ABE-6WNT6Y with a bonus of taking 10A instead of 5A
cheers steve
Farnell has them too http://uk.farnell.com/omron-electronic- ... =lookahead
If thats no good they cost me about $2.20 au free delivery from RS australia (the part has to come from the UK, go figure) and post it back (air mail would be $12.50 and sea mail would be $7.75). I picked the relay because it was easy for me to get and a good price too but as with all relays it has a unique footprint. A G5Q will also fit in its place
http://www.components.omron.com/compone ... ABE-6WNT6Y with a bonus of taking 10A instead of 5A
cheers steve