Electric Brewing Supply 30A BCS Giveaway!


Home Brew Forums > Home Brewing Beer > DIY Projects > Arduino and two elements
Reply
 
LinkBack Thread Tools
Old 06-12-2012, 03:00 PM   #11
BetterSense
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jul 2011
Location: Richardson, Texas
Posts: 977
Liked 45 Times on 35 Posts
Likes Given: 3

Default

I don't understand the point of using only one element.

If you are controlling with the Arduino, you should have no reason to switch one element off. Just use both of them all the time.

You should be able to control with both elements from zero to full power. Your circuitry will be simpler.

__________________
BetterSense is offline
 
Reply With Quote Quick reply to this message
Old 06-12-2012, 03:33 PM   #12
GriFF3n
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jan 2011
Location: Belcamp, Maryland
Posts: 11
Default

Quote:
Originally Posted by BetterSense View Post
I don't understand the point of using only one element.

If you are controlling with the Arduino, you should have no reason to switch one element off. Just use both of them all the time.

You should be able to control with both elements from zero to full power. Your circuitry will be simpler.
Having both elements on at the same time cause the boil to go out of control. It's fine for heating up quickly, but not when maintaining a boil. Only one element is needed to have a good boil.

Quote:
Originally Posted by gx1400
Another option to consider mentioned above are SSRs. They would probably fit your purpose, are pretty cheap, and non-mechanical so you don't have to be as concerns with contact failures.
SSR's tend to be much more expensive. The mechanical relays I have listed are about $4 each, whereas the solid state relays are about $25.

Quote:
Originally Posted by gx1400
It doesn't look like there is any diode protection for the coil collapse so be sure to throw some fast switching diodes like a 1N914 reverse biased across the coil do you don't fry your arduino when the coil turns off.
Are you saying throw a diode from the Arduino output, or on the relay coil?
__________________
GriFF3n is offline
 
Reply With Quote Quick reply to this message
Old 06-12-2012, 03:50 PM   #13
berndtr
Feedback Score: 0 reviews
Recipes 
 
Join Date: May 2012
Location: Klamath Falls, Oregon
Posts: 13
Liked 1 Times on 1 Posts
Likes Given: 3

Default

Quote:
Originally Posted by GriFF3

Are you saying throw a diode from the Arduino output, or on the relay coil?
He's refering to D1 in your original diagram. It would appear that the relays you chose don't have that built in diode. that diode is very important as energy builds up in the coil and when you turn the coil off the energy has to go somewhere. Without the diode it would end up going into your I/O pin and fry it.
__________________
berndtr is offline
 
Reply With Quote Quick reply to this message
Old 06-12-2012, 03:55 PM   #14
BetterSense
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jul 2011
Location: Richardson, Texas
Posts: 977
Liked 45 Times on 35 Posts
Likes Given: 3

Default

You need to shunt the relay coil with a diode. There's only one way the diode can go; if you put it the wrong way the current will all go through the diode and the relay won't pull in (and the diode will probably burn out).

It still doesn't make sense to wire your elements seperately. You have a microcontroller and relays, use them! Control your boil electroncially. All you have to do is write the software. I haven't written Arduino in a while but I would do some thing like this for a combined mash/boil controller, with an LM335 temp probe. In boil mode, the dial just adjusts the element duty cycle from 0 to 100%. In mash mode, the dial is a temperature setpoint setting. Totally depends on your temp probe circuit if you can share pots. The pot may be too sensitive in mash mode unless it's multi-turn. No big deal to use 2 pots, anyway.

Code:
//simple combined thermostat/boil control for Arduino. 


void setup(){

int mode = 2;    //read switch on digital pin 2 to detect mode (mash or boil)
int probe = 5;    //temp probe connected to analog pin 5
int elements = 3; //element relays connected to digital pin 3

float deadband = 3;     //amount of temperature hysteresis
float setpoint = 128;    //default setpoint, in raw ADC counts, have to calibrate this
//float setpoint = analogRead(potentiometer)  //or have a convenient temperature setpoint knob
float reading;             //variable to hold the temperature reading 

//do other stuff

}

void loop(){

    if (mode){   //if switch is set to 'mash' mode,  do this 

        float setpoint = analogRead(potentiometer)  //read the setpoint dial
        reading = analogRead(probe);                    //read in the temperature. Will be 0-255. 
    
        if (reading < setpoint - deadband/2){  //it's too cold, turn on the elements
            digitalWrite(elements, HIGH);
        } else if (reading >= setpoint + deadband/2){ //it's too hot, turn off the elements
            digitalWrite(elements, LOW);
        }
    
        delay(1000);  //check once per second

    }


    if ( !mode){    //if in 'boil' mode, do this 

         setpoint = analogRead(potentiometer)  //read the setpoint dial to adjust boil vigorosity
    
        digitalWrite(elements, HIGH);
    
        delay (setpoint *5000 / 255); //stay on 5 seconds if dial is WFO, 0 seconds if it's off 
    
        digitalWrite(elements, LOW); 
    
        delay(255 - (setpoint *5000 / 255) );   //stay low 5 seconds if dial is off, 0 seconds if it's WFO

        

    }



}
__________________
BetterSense is offline
 
Reply With Quote Quick reply to this message
Old 06-12-2012, 03:59 PM   #15
crane
Feedback Score: 0 reviews
Recipes 
 
Join Date: Sep 2011
Location: San Diego, CA
Posts: 297
Liked 33 Times on 26 Posts
Likes Given: 1

Default

I would tie both elements together and use an SSR. I would then implement PWM your firmware to control the duty cycle (throttle) that they are on for. You will probably find that you want more control than just both elements on, both off or only one on. I typically boil at 70-75% duty cycle for 10 gallon batches with a 5500 watt element. When I do 12 gallon batches in my keggle it's nice to knock down by 10-15% when I add hops so I don't boil over. If you are going through all the trouble of setting this up and writing firmware go the extra bit to get better control and you will be glad you did down the road.

Edit: I'm confused by your setup. I was assuming you have 2 elements in the boil kettle.

__________________
crane is offline
 
Reply With Quote Quick reply to this message
Old 06-12-2012, 04:36 PM   #16
GriFF3n
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jan 2011
Location: Belcamp, Maryland
Posts: 11
Default

Quote:
Originally Posted by berndtr View Post
He's refering to D1 in your original diagram. It would appear that the relays you chose don't have that built in diode. that diode is very important as energy builds up in the coil and when you turn the coil off the energy has to go somewhere. Without the diode it would end up going into your I/O pin and fry it.
Ok, thats what I thought. Just wanted to make sure.

Quote:
Originally Posted by crane
I would tie both elements together and use an SSR. I would then implement PWM your firmware to control the duty cycle (throttle) that they are on for. You will probably find that you want more control than just both elements on, both off or only one on. I typically boil at 70-75% duty cycle for 10 gallon batches with a 5500 watt element. When I do 12 gallon batches in my keggle it's nice to knock down by 10-15% when I add hops so I don't boil over. If you are going through all the trouble of setting this up and writing firmware go the extra bit to get better control and you will be glad you did down the road.

Edit: I'm confused by your setup. I was assuming you have 2 elements in the boil kettle.
Quote:
Originally Posted by BetterSense
It still doesn't make sense to wire your elements seperately. You have a microcontroller and relays, use them! Control your boil electroncially. All you have to do is write the software. I haven't written Arduino in a while but I would do some thing like this for a combined mash/boil controller, with an LM335 temp probe. In boil mode, the dial just adjusts the element duty cycle from 0 to 100%. In mash mode, the dial is a temperature setpoint setting. Totally depends on your temp probe circuit if you can share pots. The pot may be too sensitive in mash mode unless it's multi-turn. No big deal to use 2 pots, anyway.
There are 2 heating elements in the setup. I have not looked into controlling the elements with PWN. I've read some stuff about PID controllers, but wasn't sure I could utilize that with the Arduino. Any links?
__________________
GriFF3n is offline
 
Reply With Quote Quick reply to this message
Old 06-12-2012, 04:39 PM   #17
huntb
Feedback Score: 0 reviews
Recipes 
 
Join Date: May 2012
Location: Grand Haven, Michigan
Posts: 146
Liked 15 Times on 15 Posts
Likes Given: 15

Default

Quote:
Originally Posted by BetterSense View Post
You need to shunt the relay coil with a diode. There's only one way the diode can go; if you put it the wrong way the current will all go through the diode and the relay won't pull in (and the diode will probably burn out).

It still doesn't make sense to wire your elements seperately. You have a microcontroller and relays, use them! Control your boil electroncially. All you have to do is write the software. I haven't written Arduino in a while but I would do some thing like this for a combined mash/boil controller, with an LM335 temp probe. In boil mode, the dial just adjusts the element duty cycle from 0 to 100%. In mash mode, the dial is a temperature setpoint setting. Totally depends on your temp probe circuit if you can share pots. The pot may be too sensitive in mash mode unless it's multi-turn. No big deal to use 2 pots, anyway.

Code:
//simple combined thermostat/boil control for Arduino. 


void setup(){

int mode = 2;    //read switch on digital pin 2 to detect mode (mash or boil)
int probe = 5;    //temp probe connected to analog pin 5
int elements = 3; //element relays connected to digital pin 3

float deadband = 3;     //amount of temperature hysteresis
float setpoint = 128;    //default setpoint, in raw ADC counts, have to calibrate this
//float setpoint = analogRead(potentiometer)  //or have a convenient temperature setpoint knob
float reading;             //variable to hold the temperature reading 

//do other stuff

}

void loop(){

    if (mode){   //if switch is set to 'mash' mode,  do this 

        float setpoint = analogRead(potentiometer)  //read the setpoint dial
        reading = analogRead(probe);                    //read in the temperature. Will be 0-255. 
    
        if (reading < setpoint - deadband/2){  //it's too cold, turn on the elements
            digitalWrite(elements, HIGH);
        } else if (reading >= setpoint + deadband/2){ //it's too hot, turn off the elements
            digitalWrite(elements, LOW);
        }
    
        delay(1000);  //check once per second

    }


    if ( !mode){    //if in 'boil' mode, do this 

         setpoint = analogRead(potentiometer)  //read the setpoint dial to adjust boil vigorosity
    
        digitalWrite(elements, HIGH);
    
        delay (setpoint *5000 / 255); //stay on 5 seconds if dial is WFO, 0 seconds if it's off 
    
        digitalWrite(elements, LOW); 
    
        delay(255 - (setpoint *5000 / 255) );   //stay low 5 seconds if dial is off, 0 seconds if it's WFO

        

    }



}
Not quite sure how I feel about this code... but the comments are nice!
__________________
huntb is offline
 
Reply With Quote Quick reply to this message
Old 06-12-2012, 04:40 PM   #18
GriFF3n
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jan 2011
Location: Belcamp, Maryland
Posts: 11
Default

Quote:
Originally Posted by huntb View Post
Not quite sure how I feel about this code... but the comments are nice!
Code:
//do other stuff
Best part
__________________
GriFF3n is offline
 
Reply With Quote Quick reply to this message
Old 06-12-2012, 05:22 PM   #19
BetterSense
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jul 2011
Location: Richardson, Texas
Posts: 977
Liked 45 Times on 35 Posts
Likes Given: 3

Default

Quote:
I have not looked into controlling the elements with PWN. I've read some stuff about PID controllers, but wasn't sure I could utilize that with the Arduino. Any links?
I wasn't talking about using a separate controller. I assumed that since you were going to hook up the elements to an Arduino, you were going to actually use the arduino to control them. Why else would you use an arduino? You can switch relays on with simple pushbutton switches. The point of using an arduino is to program it. You can use PID control if you want, but regular thermostatic control works fine for controlling to a temperature, like for mashing. To control your boil, you can't use temperature control but you can just adjust the duty cycle of the elements.
__________________
BetterSense is offline
 
Reply With Quote Quick reply to this message
Old 06-12-2012, 06:08 PM   #20
GriFF3n
Feedback Score: 0 reviews
Recipes 
 
Join Date: Jan 2011
Location: Belcamp, Maryland
Posts: 11
Default

Quote:
Originally Posted by BetterSense View Post
I wasn't talking about using a separate controller. I assumed that since you were going to hook up the elements to an Arduino, you were going to actually use the arduino to control them. Why else would you use an arduino? You can switch relays on with simple pushbutton switches. The point of using an arduino is to program it. You can use PID control if you want, but regular thermostatic control works fine for controlling to a temperature, like for mashing. To control your boil, you can't use temperature control but you can just adjust the duty cycle of the elements.
The arduino will be connected to a temperature probe. The program will monitor the probe and send a control to turn off the elements once the desired temperature is reached. Thats the function of this project. Adding a PID controller is a great idea, I just don't know how to do it.
__________________
GriFF3n is offline
 
Reply With Quote Quick reply to this message
Reply



Quick Reply
Message:
Options
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Arduino instead of BCS or Brewtroller OEHokie DIY Projects 75 06-17-2014 03:37 PM
Arduino, now what? CoalCracker DIY Projects 27 01-09-2012 11:40 PM
Looking for some help with an Arduino Keezer goaticus DIY Projects 6 05-08-2011 03:46 AM
Project Box for Arduino BulldogBrewer DIY Projects 0 09-30-2010 08:27 PM
Arduino for PID? rockytoptim DIY Projects 2 12-25-2009 02:51 PM