Gallery, Projects and General > Project Logs
Oven controller (arduino based)
<< < (3/5) > >>
Dawai:
By the way, that oven will do "wax burnout" for castings too.. (sideways hobby for casting small parts for your blades)

I built a similar system for my casting rig years ago. THE wax burnout took 12 hours to perform, a computer-file controlled heat steps, as it got to the 1 hour mark, the electro melt kicked on and metal was molten at the time when the wax was gone from the crucible-mold. I didn't have arduino's then, it was turbo basic on a pc.

Advantage to using the arduino is you can buy a $12 (your money is different cause I don't recognize that flag) HC-05 bluetooth adapter, and read it on your "android phone or tablet, or computer wirelessly".

Now that is cool.. you are no longer tied to the system watching it.
pardydon:
I am currently modifying a second kiln to be operated with an Arduino. I am very interested in the Bluetooth adapters to send my temperature readings to my smartphone.I am sure that many many people have the similar old kilns they would like to convert to computer control. there are people using them for glass slumping and people using them to heat treat metal I am using it for ceramics.I would like to see the code that the original person who posted this used and compare that to what I am doing. when I get done with my modifications to the second Kiln I would like to tackle the bluetooth challenge. Perhaps you can direct me to a tutorial for that.
I am in Canada. rschilp is in Holland.
rschilp:
Ok, took me a few days to have time to get on here..

The code works great, although I haven't made many changes since I got it working, I've used the kiln for pottery and glaze, metal hardening and softening and wax mold removal.. everything I could think of doing.

The code is included below.


--- Code: ---/*
Pin information
Analog 0 = Button
Digital 0 = MAX31885 CLK
Digital 1 = MAX31885 CS
Digital 2 = MAX31885 DO
Digital 4 = LCD DB4
Digital 5 = LCD DB5
Digital 6 = LCD DB6
Digital 7 = LCD DB7
Digital 8 = LCD RS
Digital 9 = LCD Enable
Digital 10 = LCD Backlight
Digital 13 = Heater relays
*/

/* 2013 by Rob Schilperoort
parts inspired by dfrobot LCD Keypad shield example
parts inspired by AdaFruit MAX31885 Example
*/

#include <LiquidCrystal.h>
#include "Adafruit_MAX31855.h"

int thermoDO = 2;
int thermoCS = 1;
int thermoCLK = 0;

Adafruit_MAX31855 thermocouple(thermoCLK, thermoCS, thermoDO);

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

// define some values used by the panel and buttons
int lcd_key     = 0;
int adc_key_in  = 0;
#define btnRIGHT  0
#define btnUP     1
#define btnDOWN   2
#define btnLEFT   3
#define btnSELECT 4
#define btnNONE   5

int heatmode    = 0;
#define Manual    0
#define Timed     1
#define Anneal    2
#define Harden    3
#define Biscuit   4
#define Glaze     5

int targettemp = 0;
const int maxtemp = 1200;
int backlight = 0;
int err = 0;

// read the buttons
int read_LCD_buttons()
{
 adc_key_in = analogRead(0);      // read the value from the sensor
/*
lcd.setCursor(8,0);
lcd.print("Key:    ");
lcd.setCursor(11,0);
lcd.print(adc_key_in);
*/
 // my buttons when read are centered at these valies: 0, 144, 329, 504, 741
 // we add approx 50 to those values and check to see if we are close
 if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
 // For V1.1 us this threshold
 /*
 if (adc_key_in < 50)   return btnRIGHT;
 if (adc_key_in < 250)  return btnUP;
 if (adc_key_in < 450)  return btnDOWN;
 if (adc_key_in < 650)  return btnLEFT;
 if (adc_key_in < 850)  return btnSELECT;
 */
 // For V1.0 comment the other threshold and use the one below:

 if (adc_key_in < 50)  {delay(150); return btnRIGHT;}
 if (adc_key_in < 195) {delay(150); return btnUP;}
 if (adc_key_in < 380) {delay(150); return btnDOWN;}
 if (adc_key_in < 555) {delay(150); return btnLEFT;}
 if (adc_key_in < 790) {delay(150); return btnSELECT;} 

 
 return btnNONE;  // when all others fail, return this...
}

void printheatmode() {
   switch (heatmode)
   {
      case Manual:
      {
         lcd.print("Manual  ");
         break;
      }
      case Timed:
      {
         lcd.print("Timed  ");
         break;
      }
      case Anneal:
      {
         lcd.print("Anneal ");
         break;
      }
      case Harden:
      {
         lcd.print("Harden ");
         break;
      }
      case Biscuit:
      {
         lcd.print("Biscuit");
         break;
      }
      case Glaze:
      {
         lcd.print("Glaze  ");
         break;
      }
   }
}

void heatto(int temp)

  lcd.setCursor(8,1);
  lcd.print("->  ");
  lcd.print(temp);
  digitalWrite(13,HIGH);
 
  unsigned long stamp = millis();
 
  double c;
  while (c<temp)
  {
     lcd.setCursor(13,0);
     lcd.print(lround((millis()-stamp)/60000));
     lcd.setCursor(0,1);
     c = thermocouple.readCelsius();
     if (isnan(c))
     {
       lcd.print("Error");
       c=0;
     }
     else
     {
       lcd.print(lround(c));
       lcd.print("   ");
     }
     delay(1000);
  }
  digitalWrite(13,LOW);
}

void maintain(int temp, int time)
{

  int variation = (temp/50);
  lcd.setCursor(0,1);
  lcd.print("                ");
  lcd.setCursor(8,1);
  lcd.print("=             ");
  lcd.setCursor(10,1);
  lcd.print(temp);
 
  unsigned long endtime = (time*60*1000)+millis();
  double c;
 
  while (millis()<endtime)
  {
    lcd.setCursor(13,0);
    lcd.print(lround((endtime-millis())/60000));
    c = thermocouple.readCelsius();
    lcd.setCursor(0,1);
    if (isnan(c))
    {
      lcd.print("Error");
      c=0;
    }   
    else
    {
      lcd.print(lround(c));
    }
   
    if (c>(temp+variation))
    {
      digitalWrite(13,LOW);
    }
   
    if (c<(temp-variation))
    {
     digitalWrite(13,HIGH);
    }
    delay(500);
  }
  digitalWrite(13, LOW);
}

void coolslow(int rate)
{
}

void monitor()
{
  lcd.setCursor(0,1);
  lcd.print("Cooldown        ");
 
  unsigned long stamp = millis();
  double c;
 
  int select = 0;
  while(select==0)
  {
    lcd.setCursor(13,0);
    lcd.print(lround((millis()-stamp)/60000));
   
    lcd.setCursor(11,1);
    c = thermocouple.readCelsius();
    if (isnan(c))
    {
      lcd.print("Error");
      c=0;
    }
    else
    {
      lcd.print(lround(c));
      lcd.print("   ");
    }
   
    lcd_key = read_LCD_buttons();  // read the buttons
 
    switch (lcd_key)               // depending on which button was pushed, we perform an action
    {
      case btnSELECT:
      {
        select = 1;
        break;
      }
    }
  }
}

void manualmode() {
  int select = 0;
  unsigned long stamp = millis();
  while (select==0)
  {
    lcd.setCursor(13,0);
    lcd.print(lround((millis()-stamp)/60000));
   
    double c = thermocouple.readCelsius();
    lcd.setCursor(0,1);
    if (isnan(c))
    {
      lcd.print("Error");
      c=0;
    }
    else
    {
      lcd.print(lround(c));
      lcd.print("    ");
    }
 
    lcd.setCursor(11,1);
    lcd.print(targettemp);
    lcd.print("   ");
   
    if (targettemp>c)
    {
      lcd.setCursor(8,1);
      lcd.print("+");
         digitalWrite(13,HIGH);
    }
    else
    {
      lcd.setCursor(8,1);
      lcd.print("=");       
         digitalWrite(13,LOW);
    }   
 
  lcd_key = read_LCD_buttons();  // read the buttons
 
  switch (lcd_key)               // depending on which button was pushed, we perform an action
  {
   case btnRIGHT:
     {
     if (targettemp<(maxtemp-99))
     {
        targettemp = targettemp + 100;
     }
     else
     {
         targettemp = maxtemp;
     }
     break;
     }
   case btnLEFT:
     {
     if (targettemp>99)
     {
        targettemp = targettemp - 100;
     }
     else
     {
        targettemp = 0;
     }
     break;
     }
   case btnUP:
     {
       if (targettemp<(maxtemp-4))
     {
        targettemp = targettemp + 5;
     }
     break;
     }
   case btnDOWN:
     {
     if (targettemp>4)
     {
        targettemp = targettemp - 5;
     }
     else
     {
        targettemp = 0;
     }
     break;
     }
     case btnSELECT:
     {
       select=1;
       break;
     }
   }
  }
}

void timedmode()
{
  lcd.setCursor(0,1);
  lcd.print("Target Temp:");
  targettemp=500;
  int select = 0;
  while(select==0)
  {
    lcd.setCursor(13,1);
    lcd.print(targettemp);
    lcd.print("   ");
    lcd_key = read_LCD_buttons();  // read the buttons
 
    switch (lcd_key)               // depending on which button was pushed, we perform an action
    {
      case btnRIGHT:
      {
        if (targettemp<(maxtemp-99))
        {
           targettemp = targettemp + 100;
        }
        else
        {
            targettemp = maxtemp;
        }
        break;
      }
      case btnLEFT:
      {
        if (targettemp>99)
        {
          targettemp = targettemp - 100;
        }
        else
        {
          targettemp = 0;
        }
        break;
      }
      case btnUP:
      {
        if (targettemp<(maxtemp-4))
        {
          targettemp = targettemp + 5;
        }
        break;
      }
      case btnDOWN:
      {
        if (targettemp>4)
        {
          targettemp = targettemp - 5;
        }
        else
        {
          targettemp = 0;
        }
        break;
      }
      case btnSELECT:
      {
        select = 1;
        break;
      }
    }
  }
  lcd.setCursor(0,1);
  lcd.print("Duration:       ");
  int duration=0;
  select = 0;
  while(select==0)
  {
    lcd.setCursor(10,1);
    lcd.print(duration);
    lcd.print("   ");
    lcd_key = read_LCD_buttons();  // read the buttons
 
    switch (lcd_key)               // depending on which button was pushed, we perform an action
    {
      case btnRIGHT:
      {
        if (duration<(999-59))
        {
           duration = duration + 60;
        }
        else
        {
            duration = 999;
        }
        break;
      }
      case btnLEFT:
      {
        if (duration>59)
        {
          duration = duration - 60;
        }
        else
        {
          duration = 0;
        }
        break;
      }
      case btnUP:
      {
        if (duration<(999-4))
        {
          duration = duration + 5;
        }
        break;
      }
      case btnDOWN:
      {
        if (duration>4)
        {
          duration = duration - 5;
        }
        else
        {
          duration = 0;
        }
        break;
      }
      case btnSELECT:
      {
        select = 1;
        break;
      }
    }
  }
 
  lcd.setCursor(0,1);
  lcd.print("         ");
 
  heatto(targettemp);
  maintain(targettemp,duration);
  monitor();

}

void annealmode()
{
   lcd.setCursor(0,1);
  lcd.print("Anneal Temp:");
  targettemp=400;
  int select = 0;
  while(select==0)
  {
    lcd.setCursor(13,1);
    lcd.print(targettemp);
    lcd_key = read_LCD_buttons();  // read the buttons
 
    switch (lcd_key)               // depending on which button was pushed, we perform an action
    {
      case btnRIGHT:
      {
        if (targettemp<(maxtemp-99))
        {
           targettemp = targettemp + 100;
        }
        else
        {
            targettemp = maxtemp;
        }
        break;
      }
      case btnLEFT:
      {
        if (targettemp>99)
        {
          targettemp = targettemp - 100;
        }
        else
        {
          targettemp = 0;
        }
        break;
      }
      case btnUP:
      {
        if (targettemp<(maxtemp-4))
        {
          targettemp = targettemp + 5;
        }
        break;
      }
      case btnDOWN:
      {
        if (targettemp>4)
        {
          targettemp = targettemp - 5;
        }
        else
        {
          targettemp = 0;
        }
        break;
      }
      case btnSELECT:
      {
        select = 1;
        break;
      }
    }
  }
 
  heatto(targettemp);
  maintain(targettemp,10);
  coolslow(60);
  monitor();
 
}

void hardenmode()
{
 
}

void biscuitmode()
{
   lcd.setCursor(0,1);
  lcd.print("Temperature:");
  targettemp=955;
  int select = 0;
  while(select==0)
  {
    lcd.setCursor(12,1);
    lcd.print(targettemp);
    lcd.print("     ");
    lcd_key = read_LCD_buttons();  // read the buttons
 
    switch (lcd_key)               // depending on which button was pushed, we perform an action
    {
      case btnRIGHT:
      {
        if (targettemp<(maxtemp-99))
        {
           targettemp = targettemp + 100;
        }
        else
        {
            targettemp = maxtemp;
        }
        break;
      }
      case btnLEFT:
      {
        if (targettemp>99)
        {
          targettemp = targettemp - 100;
        }
        else
        {
          targettemp = 0;
        }
        break;
      }
      case btnUP:
      {
        if (targettemp<(maxtemp-4))
        {
          targettemp = targettemp + 5;
        }
        break;
      }
      case btnDOWN:
      {
        if (targettemp>4)
        {
          targettemp = targettemp - 5;
        }
        else
        {
          targettemp = 0;
        }
        break;
      }
      case btnSELECT:
      {
        select = 1;
        break;
      }
    }
  }

  lcd.setCursor(0,1);
  lcd.print("                ");         
  heatto(targettemp);
  maintain(targettemp,10);
  monitor();


void glazemode()
{
   lcd.setCursor(0,1);
  lcd.print("Temperature:");
  targettemp=1055;
  int select = 0;
  while(select==0)
  {
    lcd.setCursor(12,1);
    lcd.print(targettemp);
    lcd.print("     ");
    lcd_key = read_LCD_buttons();  // read the buttons
 
    switch (lcd_key)               // depending on which button was pushed, we perform an action
    {
      case btnRIGHT:
      {
        if (targettemp<(maxtemp-99))
        {
           targettemp = targettemp + 100;
        }
        else
        {
            targettemp = maxtemp;
        }
        break;
      }
      case btnLEFT:
      {
        if (targettemp>99)
        {
          targettemp = targettemp - 100;
        }
        else
        {
          targettemp = 0;
        }
        break;
      }
      case btnUP:
      {
        if (targettemp<(maxtemp-4))
        {
          targettemp = targettemp + 5;
        }
        break;
      }
      case btnDOWN:
      {
        if (targettemp>4)
        {
          targettemp = targettemp - 5;
        }
        else
        {
          targettemp = 0;
        }
        break;
      }
      case btnSELECT:
      {
        select = 1;
        break;
      }
    }
  }
 
 
  lcd.setCursor(0,1);
  lcd.print("                ");
 
  heatto(targettemp);
  maintain(targettemp,10);
  monitor();
}

void setup() {
  lcd.begin(16, 2);              // start the library
  lcd.clear();
  lcd.print("Thermocontroller");
  lcd.setCursor(0, 1);
  lcd.print("v1 2013");
  pinMode(13,OUTPUT);
  digitalWrite(13,LOW);
  pinMode(10,OUTPUT);
  digitalWrite(10,HIGH);
  delay(1000);
  int c = thermocouple.readInternal();
}

void loop() {
  lcd.clear();
  lcd.print("Select mode:");
  heatmode=0;
  int select = 0;
  while(select==0)
  {
     lcd_key = read_LCD_buttons();  // read the buttons
 
     switch (lcd_key)               // depending on which button was pushed, we perform an action
     {
        case btnUP:
          {
             heatmode++;
             break;
          }
        case btnDOWN:
          {
             heatmode--;
             break;
          }
        case btnSELECT:
          {
             select=1;
             break;
          }
      }
      if(heatmode==6) heatmode=0;
      if(heatmode==-1) heatmode=5;
      lcd.setCursor(0,1);
      printheatmode();
  }
 
  lcd.clear();
  printheatmode();
    switch (heatmode)
   {
      case Manual:
      {
         manualmode();
         break;
      }
      case Timed:
      {
        timedmode();
         break;
      }
      case Anneal:
      {
        annealmode();
         break;
      }
      case Harden:
      {
        hardenmode();
         break;
      }
      case Biscuit:
      {
        biscuitmode();
         break;
      }
      case Glaze:
      {
        glazemode();
         break;
      }
   }
 
}


--- End code ---
Dawai:
Thank you for sharing your work.
I am not familiar with the thermocouple input device there.. I'll have to research it.
AdeV:

--- Quote from: Dawai on February 12, 2014, 10:38:42 AM ---Thank you for sharing your work.
I am not familiar with the thermocouple input device there.. I'll have to research it.

--- End quote ---

It's the replacement for the old MAX6675 chip, which is a K-type thermocouple amplifier/A-to-D converter with SPI interface & built in cold-junction compensation. It's a cracking piece of kit, but a tad pricey at around $10 per piece ($6 in bulk). It's also a sod to hand-solder as it's only available in surface mount form...
Navigation
Message Index
Next page
Previous page

Go to full version