first of all I want to apologize for my english, if I make any mistakes, please correct me.
I'm planning on building an arduino hot plat stirrer (for lab and kitchen use)
I need to be able to control the stirring speed (DC 12V motor /or stepper) and heating (2x600W heating elements in a thick aluminium plate; reads temperature via thermcouple) independently.
My heating element would be switched on or off depending on the need to heat via a flip-flop.
The motor requires a PWM signal which is why I can't just make a flip-flop for them.
I found the adafruit motor shield v2 but I'm wondering if you can control a motor the way I described (If not how does that shield controls the motor?)
My code would be something like that:
read temperature
IF temperature is below temperature needed: start heating //sends pulse to a flip-flop if not already ON.
ELSE: stop heating //sends pulse to a flip-flop if not already OFF.
GET desired speed via potentiometer
SET speed of motor
IF speed > 0: turn motor ON
ELSE: turn motor OFF
I am assuming that the heaters run from mains power. The easiest way to control the heaters, in my opinion, would be with a solid state relay rated for the current and voltage required. It can be controlled directly from a digital output pin. For the stirrer, I would use a DC motor. To drive the motor you don't really need a board like you pointed to. The motor will turn in one direction only (I again assume for stirring) so you can drive it with a just a transistor or MOSFET with PWM to control the speed. Google Arduino motor speed control to see how it is done. The next problem is reading the thermocouple. Do you have a schematic of the heater to see how the thermocouple is incorporated?
I just tried a simple bc547 transistor at the output of the arduino and it worked fine :). I didn't knew it was possible to send a PWM signal while running the rest of the code!
Anyway, sorry for the newbie topic...
heating with ssr is best it needs a signal from the arduino have them separate to avoid big starting currents. have them in a loop of 10 seconds thus a pulse for example 4 seconds.
the motor with a simple mosfet (transistor needs cooling) and a resistor the mosfet should be just above gnd.
I've wrote a topic discussing the same project (" motor and heater control ") it's the topic name . Take a look at my code in this topic and tell me if we have the same idea .
We can share our codes together to try to make a perfect coding that suits our requirements of the program .
Thats my code take .
Hope u rebly .
Wapp: +201112180842
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 10, 5, 4, 3, 2);
#define PIN_SET 8
#define PIN_DEC 1
#define PIN_INC 0
int buttonState = 0; // current state of the button
int lastButtonState = 0; // previous state of the button
#define motorpin 11
#define heaterpin 9
int startbutton = 6;
int stopbutton = 7;
unsigned long Temp = 0;
unsigned long Speed = 0;
int Sensorpin = A0;
unsigned long tempsensor = 0 ;
void setup()
{
pinMode(motorpin, OUTPUT);
pinMode(heaterpin, OUTPUT);
pinMode(startbutton, INPUT_PULLUP);
pinMode(stopbutton, INPUT_PULLUP);
pinMode(PIN_INC, INPUT_PULLUP);
pinMode(PIN_DEC, INPUT_PULLUP);
pinMode(PIN_SET, INPUT_PULLUP);
lcd.begin(16, 2 );
lcd.setCursor(0, 0);
lcd.print(" Kemetch Sealer ");
delay(3000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Speed:");
lcd.setCursor(10, 0);
lcd.print("%");
lcd.setCursor(0, 1);
lcd.print("TEMP:");
lcd.setCursor(9, 1);
lcd.print("C");
}
void loop()
{
buttonState = digitalRead(PIN_SET); // read digital pin 2
if (buttonState != lastButtonState)
{
//*****************************************************************//
if (buttonState = HIGH)
{
if (PIN_INC == HIGH && PIN_DEC == LOW)
{
if (Speed < 10)
{
Speed ++;
delay(100);
lcd.setCursor(7, 0);
lcd.print(Speed);
}
if (PIN_INC == LOW && PIN_DEC == HIGH)
{
if (Speed >= 0)
{
Speed --;
lcd.setCursor(7, 0);
lcd.print(Speed);
delay(100);
}
}
}
}
//*****************************************************************//
if (buttonState == LOW) // THIS WAS POINTED OUT BY jimLee AND NEEDS
// FIXING (= FOR ASSIGNEMENT == FOR COMPARE).
{
if (PIN_INC == HIGH && PIN_DEC == LOW)
{
if (Temp < 400)
{
Temp ++;
delay(100);
lcd.setCursor(6, 1);
lcd.print(Temp);
}
if (PIN_INC == LOW && PIN_DEC == HIGH)
{
if (Temp >= 0)
{
Temp --;
delay(100);
lcd.setCursor(6, 1);
lcd.print(Temp);
}
}
}
}
}
//} THIS EXTRA } CLOSES THE LOOP FUNNCTION. EVERY THING
// AFTER THIS IS OUTSIDE OF A FUNCTION AND NOT LEGAL
tempsensor = analogRead(A0);
unsigned long tempvalue = tempsensor * 0.48828125;
if (Temp > tempvalue)
{
if ((digitalRead(startbutton) == HIGH) && (digitalRead( stopbutton) == LOW))
{
analogWrite(motorpin, (Speed * 25.5));
digitalWrite(heaterpin, HIGH);
}
if ((digitalRead(startbutton) == LOW) && (digitalRead( stopbutton) == HIGH))
{
analogWrite(motorpin, LOW);
digitalWrite(heaterpin, LOW);
}
}
}