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)
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.
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.