Ira
I'm going to use an AD595 ($11) and thermocouple ($10) to get the temp. There is a fair amount of code written for the AD595 for the Arduino so it should be easy to breadboard and test. I'm hoping to start reading temp next week on my current Sonofresco and start seeing how they really programmed the ramp... once I get an idea of how they control the heat now... then it's just developing a few heat control subroutines, a little re-wire and I should have it...
BTW I'm using som solid state relays ($4 ea) for the blower and the heater.... simple... one could always add another relay for the drum motor if the roaster has one...
I will keep folks updated on the progress.
Hey Milo .... I'm trying to follow along with you ... if you don't mind me inquiring ... where is the code you are using for the AD595?
Thanks
MP
I'm not far enough along to start coding yet.... but here is the code to read the temp using the AD595 and thermocouple.
// Define which analog input pin we have connected to the temperature sensor
#define TEMP_SENSOR_PIN 0
// if you tie the Arduino's vRef to the 3.3 volt supply, change this to 3.3
#define ANALOG_VOTLAGE_REFERENCE 5
void setup() {
Serial.begin(115200);
}
void loop() {
// prints the currrent temperature with 1 place after the decimal point
printFloat(getTemperature(), 1);
// print a carriage return
Serial.println();
// rest 100 milliseconds
delay(100);
}
float CtoF(float c) {
// optionally convert from Celsius to Farenheit if you are into that sorta thing
return c * 9.0 / 5.0 + 32.0;
}
float analogInToDegreesC(int inputValue) {
// divide by 1023, the maximum possible input value, that scales the input between 0 - 1
// then multiply by the reference voltage, which scales 0-1 to 0-vREF (default is 5V)
// lastly, multiply by 100 to scale it to 10s of millivolts or degrees
return inputValue / 1023.0 * ANALOG_VOTLAGE_REFERENCE * 100.0;
}
float getTemperature() {
// read the analog input, convert to degrees C, and covert to F
return CtoF(analogInToDegreesC(analogRead(TEMP_SENSOR_PIN)));
}
// ---- This last function, printFloat isn't necessary to understand unless you want to
// ---- feel free to ignore it for now, and treat it as a built-in utility,
// ---- it prints out floating point point values
// printFloat prints out the float 'value' rounded to 'places' places after the decimal point
void printFloat(float value, int places) {
// this is used to cast digits
int digit;
float tens = 0.1;
int tenscount = 0;
int i;
float tempfloat = value;
// make sure we round properly. this could use pow from <math.h>, but doesn't seem worth the import
// if this rounding step isn't here, the value 54.321 prints as 54.3209
// calculate rounding term d: 0.5/pow(10,places)
float d = 0.5;
if (value < 0)
d *= -1.0;
// divide by ten for each decimal place
for (i = 0; i < places; i++)
d/= 10.0;
// this small addition, combined with truncation will round our values properly
tempfloat += d;
// first get value tens to be the large power of ten less than value
// tenscount isn't necessary but it would be useful if you wanted to know after this how many chars the number will take
if (value < 0)
tempfloat *= -1.0;
while ((tens * 10.0) <= tempfloat) {
tens *= 10.0;
tenscount += 1;
}
// write out the negative if needed
if (value < 0)
Serial.print('-');
if (tenscount == 0)
Serial.print(0, DEC);
for (i=0; i< tenscount; i++) {
digit = (int) (tempfloat/tens);
Serial.print(digit, DEC);
tempfloat = tempfloat - ((float)digit * tens);
tens /= 10.0;
}
// if no places after decimal, stop now and return
if (places <= 0)
return;
// otherwise, write the point and continue on
Serial.print('.');
// now write out each decimal place by shifting digits one by one into the ones place and writing the truncated value
for (i = 0; i < places; i++) {
tempfloat *= 10.0;
digit = (int) tempfloat;
Serial.print(digit,DEC);
// once written, subtract off that digit
tempfloat = tempfloat - (float) digit;
}
}