I have no problem with fuzzy logic, but for the relatively simple things you are trying to do, it seems like an over kill. Also, most people on the forum are not using it, so if you hit a snag, you will limit the amount of help you will get. Learn it by all means if it interests you. Your incremental approach (with LOTS of testing) is really the only valid way to go, especially with potentially flammable and corrosive chemicals.
I use a K thermocouple and the kiln gets up to 1300 C. I have also used a AD 595 and a voltage divider to drop the output to the Arduino down to within 5 volts. If you don't need great accuracy in the temperature, you can just use the output of the thermocouple and run it through an op amp to boost the gain, and then imbed a lookup table in the setup of the Arduino code.
thirty cent op amp and a couple of resistors would be all you need to set this up. here is some code I found that I incorporated into another controller that I have used.
#include <stdio.h>
#define POINTS_COUNT 65
int command = 0;
double temp = 0;
void setup() {
Serial.begin(9600);
}
typedef struct {
long temp;
unsigned long microvolts;
} temp_point;
static temp_point thermocouplePoints[] = {
{ 0 , 0 },
{ 10000 , 397 },
{ 20000 , 798 },
{ 30000 , 1203 },
{ 40000 , 1612 },
{ 50000 , 2023 },
{ 60000 , 2436 },
{ 79000 , 3225 },
{ 98000 , 4013 },
{ 116000 , 4756 },
{ 134000 , 5491 },
{ 139000 , 5694 },
{ 155000 , 6339 },
{ 172000 , 7021 },
{ 193000 , 7859 },
{ 212000 , 8619 },
{ 231000 , 9383 },
{ 250000 , 10153 },
{ 269000 , 10930 },
{ 288000 , 11712 },
{ 307000 , 12499 },
{ 326000 , 13290 },
{ 345000 , 14084 },
{ 364000 , 14881 },
{ 383000 , 15680 },
{ 402000 , 16482 },
{ 421000 , 17285 },
{ 440000 , 18091 },
{ 459000 , 18898 },
{ 478000 , 19707 },
{ 497000 , 20516 },
{ 516000 , 21326 },
{ 535000 , 22137 },
{ 554000 , 22947 },
{ 573000 , 23757 },
{ 592000 , 24565 },
{ 611000 , 25373 },
{ 630000 , 26179 },
{ 649000 , 26983 },
{ 668000 , 27784 },
{ 687000 , 28584 },
{ 706000 , 29380 },
{ 725000 , 30174 },
{ 744000 , 30964 },
{ 763000 , 31752 },
{ 782000 , 32536 },
{ 801000 , 33316 },
{ 820000 , 34093 },
{ 839000 , 34867 },
{ 858000 , 35637 },
{ 877000 , 36403 },
{ 896000 , 37166 },
{ 915000 , 37925 },
{ 934000 , 38680 },
{ 953000 , 39432 },
{ 972000 , 40180 },
{ 991000 , 40924 },
{ 1010000 , 41665 },
{ 1029000 , 42402 },
{ 1048000 , 43134 },
{ 1067000 , 43863 },
{ 1086000 , 44588 },
{ 1105000 , 45308 },
{ 1124000 , 46024 },
{ 1143000 , 46735 },
{ 1200000 , 48838 }
};
static inline unsigned long interpolate(unsigned long val, unsigned long rangeStart, unsigned long rangeEnd, unsigned long valStart, unsigned long valEnd) {
return rangeStart + (rangeEnd - rangeStart) * (val - valStart) / (valEnd - valStart);
}
static inline unsigned long interpolateVoltage(unsigned long temp, unsigned char i){
return interpolate(temp, thermocouplePoints[i-1].microvolts, thermocouplePoints[i].microvolts, thermocouplePoints[i-1].temp, thermocouplePoints[i].temp);
}
static inline unsigned long interpolateTemperature(unsigned long microvolts, unsigned char i){
return interpolate(microvolts, thermocouplePoints[i-1].temp, thermocouplePoints[i].temp, thermocouplePoints[i-1].microvolts, thermocouplePoints[i].microvolts);
}
/**
* Returns the index of the first point whose temperature value is greater than argument
**/
static inline unsigned char searchTemp(unsigned long temp) {
unsigned char i;
for(i = 0; i < POINTS_COUNT; i++) {
if(thermocouplePoints[i].temp > temp) {
return i;
}
}
return POINTS_COUNT-1;
}
/**
* Returns the index of the first point whose microvolts value is greater than argument
**/
static inline unsigned char searchMicrovolts(unsigned long microvolts) {
unsigned char i;
for(i = 0; i < POINTS_COUNT; i++) {
if(thermocouplePoints[i].microvolts > microvolts) {
return i;
}
}
return POINTS_COUNT-1;
}
/**
* Returns temperature as a function of the ambient temperature and measured thermocouple voltage.
* Currently only positive ambient temperature is supported
**/
long thermocoupleConvertWithCJCompensation(unsigned long microvoltsMeasured, unsigned long ambient) {
//convert ambient temp to microvolts
//and add them to the thermocouple measured microvolts
unsigned long microvolts = microvoltsMeasured + interpolateVoltage(ambient, searchTemp(ambient));
//look up microvolts in The Table and interpolate
return interpolateTemperature(microvolts, searchMicrovolts(microvolts));
}
/**
* Returns temperature, equivalent to the voltage provided in microvolts
*/
long thermocoupleMvToC(unsigned long microvolts) {
return interpolateTemperature(microvolts, searchMicrovolts(microvolts));
}
/******************************************************************************
* Additional info
* ****************************************************************************
* Changelog:
* - v. 1.0 (initial release) 2014-04-24 by Albertas MickÄ—nas mic@wemakethings.net
*
* ****************************************************************************
* Bugs, feedback, questions and modifications can be posted on the github page
* on https://github.com/Miceuz/k-thermocouple-lib/
* ****************************************************************************
* - LICENSE -
* GNU GPL v2 (http://www.gnu.org/licenses/gpl.txt)
* This program is free software. You can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
* ****************************************************************************
*/
void loop() {
unsigned long x;
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);
voltage =10.1744*voltage - 0.8191;
if ( analogRead(0)> 1021) { // it's too high turn it off
digitalWrite(13,LOW);
}
Serial.flush();
if (Serial.available()) { // Look for char in serial que and process if found
command = Serial.read();
if (command == 84 & analogRead(0)< 1021) { // If command = "T" turn it on (unless to high)
digitalWrite(13,HIGH);
// delay (500); // keep it on for at least half a sec to prevent bounce
}
if (command == 67) { // If command = "C" turn it off
digitalWrite(13,LOW);
// delay(500); // keep it off for at least half a second to prevent bounce
}
if (command==68){ //if command ="D" sound tone
tone(9,220);
}
if (command==69){ //if command ="E" end tone
noTone(9);
}
command = 0; // reset command
}
delay(100);
Serial.flush();
delay(100);
temp= thermocoupleMvToC(voltage);
if (temp <=0) {temp = 0;} // if it goes negative just utput 0
Serial.print("@- "); // output to computer USB port
Serial.print(temp);
Serial.println(" -Tmp ");
}