Arduino Stir Plate (digital speed control) - Home Brew Forums

Register Now!
Home Brew Forums > Home Brewing Beer > DIY Projects > Chillers & Stir Plates > Arduino Stir Plate (digital speed control)

Reply
 
Thread Tools
Old 05-31-2008, 05:04 AM   #1
Yuri_Rage
Gritty.
HBT_MODERATOR.png
 
Yuri_Rage's Avatar
Recipes 
 
Jul 2006
Southwest
Posts: 14,285
Liked 804 Times on 510 Posts



I haven't made one, and I'm not sure if I will since I already have a nice stir plate, but I wrote and tested the code today with an LED (sheer boredom), and I have sourced all the parts, so I thought I'd share.

You'll need:
Arduino board ($35)
PWM driver (kit - $12)
12VDC muffin fan (lots of sources - $5)
9-12VDC (500mA min) power supply (electronics store - $5)
10k ohm linear taper potentiometer (electronics store - $1)
2 strong magnets (old hard drive, eBay, science surplus - $1)
An enclosure (cigar box, plastic tub, cardboard box, etc - practically free)
Wire + soldering skills
Glue (epoxy)
USB cable
Computer

Parts total: $69-ish (much cheaper if you have parts laying around or if you elect to use an Arduino kit board instead of the pre-assembled one linked above)

Code:
/*
  Arduino Stir Plate
  Uses PWM to control motor speed
  This is much more efficient and motor friendly than resistive speed controls
  It may also allow slower motor speeds to be achieved
  30 May 08 - Yuri_Rage - www.homebrewtalk.com
*/

int driverPin = 9;  // PWM driver connected to digital pin 9
int potPin = 0;     // potentiometer connected to analog pin 0
int oldValue = 0;   // store an old analog value
int newValue = 0;   // store a new analog value for comparison
float divisor;      // divide analog input by this value
float castFloat;    // for type conversion

/*
   NOTE: Increase minValue to keep the motor from stalling and give higher fidelity adjustment.
         The min value is 0 and will give full range adjustment (including off).
         The max value is 254 and will result in full speed regardless of adjustment.
         A minValue between 20 and 100 should be adequate.
*/
int minValue = 0;  // minimum PWM value - read above

void setup() 
{ 
  divisor = 1024.0 / (255.0 - (float)minValue);  // analog inputs are 10 bit while PWM are 8 bit, so we need some division
  //Serial.begin(9600);                          //uncomment for debugging
} 
 
void loop() 
{ 
  castFloat = (float)analogRead(potPin) / divisor + (float)minValue;  // use the divisor already calculated, then add the min value
  newValue = (int)castFloat;
  if (pow((newValue - oldValue), 2) > 1) { // only change state if the PWM value has changed by more than 1 (simple noise reduction)
    analogWrite(driverPin, newValue);      // make the new PWM value active
    oldValue = newValue;                   // store the new state
    //Serial.print("PWM value: ");         // uncomment for debugging
    //Serial.println(newValue);            // uncomment for debugging
  }
  delay(10);                               // wait a little - no need to run full tilt
}
Sorry, no schematic, but it's pretty simple. You'll wire the potentiometer to analog pin 0 on the Arduino. One of the PWM driver's inputs gets wired to digital pin 9. The fan is powered by the driver board output. The DC source can power both the driver board and the Arduino. I can take a picture of the breadboarded circuit with the LED if anyone is interested.
__________________
Homebrewed Blog..........YouTube Channel .......... Shirts, posters, etc

 
Reply With Quote
Old 05-31-2008, 05:11 AM   #2
eriktlupus
 
eriktlupus's Avatar
Recipes 
 
Jan 2007
Cereal City, USA
Posts: 2,618
Liked 13 Times on 11 Posts


yuri you have to much time on your hands again!
__________________
primary1 :UTOPIA BABY(still searching for it)
secondary:middling bastard ipa
kegged:simcoe blonde, crystal pale ale, yellow jacket golden ale, lemon shandy blonde
DRINKIN DAWG BREWERY
LET'S GO RED WINGS


join michigan mashers here

extraction calculator
grains in pounds(G) X 36(average points per gallon of grains) / batch size in gallons(g) = maximum efficiency(ME)
OG / ME = brewhouse efficiency

 
Reply With Quote
Old 05-31-2008, 05:13 AM   #3
Yuri_Rage
Gritty.
HBT_MODERATOR.png
 
Yuri_Rage's Avatar
Recipes 
 
Jul 2006
Southwest
Posts: 14,285
Liked 804 Times on 510 Posts


Yeah, I know. But I got another Arduino board for a new project, and I wanted to test it out. This was a simple way to do it.

The cool thing about PWM is that it's very efficient for things like stir plate control. Because it pulses full power in short, rapid bursts, slower motor speeds MIGHT be possible (in comparison to the LM317 circuits or simple potentiometer controls).
__________________
Homebrewed Blog..........YouTube Channel .......... Shirts, posters, etc

 
Reply With Quote
Old 05-31-2008, 01:25 PM   #4
Funkenjaeger
 
Funkenjaeger's Avatar
Recipes 
 
May 2007
Nashua, NH
Posts: 1,598
Liked 9 Times on 7 Posts


Well that's certainly one way to do it (and believe me, I'm a microcontroller fan), but you can build a PWM controller with a 555 timer for like <$10. On the one I built, the whole PCB is 1" x 3", and there's about 15-20 components.

PWM definitely does let you get down to nice low motor speeds. The problem you face there is that the motor can sustain movement at that speed, but it can't start up, so you need to kind of jump-start it, which normally involves cranking the speed up higher to start it spinning, and then dropping it back down. On my board, a couple passive components do it automatically by giving it a high duty cycle for a couple seconds on power-up, but you could do the same thing in firmware on your design.

 
Reply With Quote
Old 05-31-2008, 02:05 PM   #5
Yuri_Rage
Gritty.
HBT_MODERATOR.png
 
Yuri_Rage's Avatar
Recipes 
 
Jul 2006
Southwest
Posts: 14,285
Liked 804 Times on 510 Posts


Quote:
Originally Posted by Funkenjaeger View Post
Well that's certainly one way to do it (and believe me, I'm a microcontroller fan), but you can build a PWM controller with a 555 timer for like <$10. On the one I built, the whole PCB is 1" x 3", and there's about 15-20 components.
Oops, I meant to mention 555 based circuits as a means of keeping cost down in my original post. I know this particular design is a little bit of overkill. In fact, it's almost a waste of a perfectly good microcontroller board and multi-output driver to use them for something so simple. On the other hand, it would make a great microcontroller intro project.

However, if you've seen my other projects, you know that overkill should probably be my middle name...
__________________
Homebrewed Blog..........YouTube Channel .......... Shirts, posters, etc

 
Reply With Quote
Old 05-31-2008, 04:34 PM   #6
stevecaaster
Recipes 
 
Oct 2007
Posts: 196
Liked 2 Times on 2 Posts


yuri, are you into reprap? are you building one?

 
Reply With Quote
Old 06-02-2008, 12:08 AM   #7
Yuri_Rage
Gritty.
HBT_MODERATOR.png
 
Yuri_Rage's Avatar
Recipes 
 
Jul 2006
Southwest
Posts: 14,285
Liked 804 Times on 510 Posts


Actually, I found the RepRap site by looking for thermocouple circuits and PWM examples for Arduino. However, I quickly became fascinated by the RepRap project. I'm not building one, but I may look into it at some point.
__________________
Homebrewed Blog..........YouTube Channel .......... Shirts, posters, etc

 
Reply With Quote
Old 06-02-2008, 12:38 PM   #8
Funkenjaeger
 
Funkenjaeger's Avatar
Recipes 
 
May 2007
Nashua, NH
Posts: 1,598
Liked 9 Times on 7 Posts


Quote:
Originally Posted by Yuri_Rage View Post
On the other hand, it would make a great microcontroller intro project.
I was just thinking the same thing... Especially given the huge popularity of the Arduino recently.

 
Reply With Quote
Old 01-26-2013, 10:34 PM   #9
fc36
Recipes 
 
May 2010
Chicago, Illinois
Posts: 365
Liked 24 Times on 19 Posts


Resurrect... Yuri, do you think this would work with a pro mini or a lilypad board? That way you can keep costs close to a 555 build and still mess around with arduino.

 
Reply With Quote
Old 01-27-2013, 11:24 AM   #10
Yuri_Rage
Gritty.
HBT_MODERATOR.png
 
Yuri_Rage's Avatar
Recipes 
 
Jul 2006
Southwest
Posts: 14,285
Liked 804 Times on 510 Posts


It'll work with any PWM capable microcontroller. Use PWM to drive a transistor/MOSFET circuit that switches the power supply current.
__________________
Homebrewed Blog..........YouTube Channel .......... Shirts, posters, etc

 
Reply With Quote


Reply
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
What Magnets/Stir Bar do you use for your Stir Plate? Stevorino Equipment/Sanitation 28 10-04-2013 05:32 PM
Arduino for kegerator temperature control. Orfy Kegerators & Keezers 19 04-21-2010 12:18 PM
Arduino with 2wire/SMBUS digital thermometer Spine Brew Stands 11 12-30-2009 04:01 PM
My arduino fridge control build. simpleton Fermenters 4 01-09-2009 05:40 PM
DIY Stir Plate speed control - high/low switch knowltonm Equipment/Sanitation 5 10-05-2008 03:30 PM


Forum Jump