 # Arduino + Thermistor Breakout + Fan

1st of all, I’ve looked on the web for about 8 months now, so as not to ask for help if it’s already been posted.
But I haven’t seen anything that would get this going.
I’m trying to get a 2x16 lcd keypad to display the correct temp numbers. This is the biggest issue. It shows something like “535” for the temp. I must have tried a million things, but nothing is giving me the correct numbers.
Second, I’ve been finding “if” triggers to turn on a fan when the temp climbs to a certain temp. I don’t know which to put in that “if” line of code. This too, I’ve searched and tried a million times. I can’t figure out what is the correct line to put in the “if” section.
The thermistor break out is connected to the analog “0”.
The fan connected to pin 53.
With one code, I can get the correct temp numbers to display on the Serial Monitor, But not on the lcd keypad.
Again, I’ve tried learning and killing myself for about 6 to 7 months if not longer, before posting and asking for help.

Here’s the first code that shows the correct temp on Serial Monitor, But displays nothing to the lcd keypad:

#include <math.h>
//Schematic:
// [Ground] ---- [10k-Resister] -------|------- [Thermistor] ---- [+5v]
// |
// Analog Pin 0

int fanPin = 53;
// Inputs ADC Value from Thermistor and outputs Temperature in Celsius
// requires: include <math.h>
// Utilizes the Steinhart-Hart Thermistor Equation:
// Temperature in Kelvin = 1 / {A + B[ln(R)] + C[ln(R)]^3}
// where A = 0.001129148, B = 0.000234125 and C = 8.76741E-08
long Resistance; double Temp; // Dual-Purpose variable to save space.
Resistance=((10240000/RawADC) - 10000); // Assuming a 10k Thermistor. Calculation is actually: Resistance = (1024 * BalanceResistor/ADC) - BalanceResistor
Temp = log(Resistance); // Saving the Log(resistance) so not to calculate it 4 times later. // “Temp” means “Temporary” on this line.
Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp)); // Now it means both “Temporary” and “Temperature”
Temp = Temp - 273.15; // Convert Kelvin to Celsius // Now it only means “Temperature”

// Uncomment this line for the function to return Fahrenheit instead.
//Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert to Fahrenheit
return Temp; // Return the Temperature
}

void printDouble(double val, byte precision) {
// prints val with number of decimal places determine by precision
// precision is a number from 0 to 6 indicating the desired decimal places
// example: printDouble(3.1415, 2); // prints 3.14 (two decimal places)
Serial.print (int(val)); //prints the int part
if( precision > 0) {
Serial.print("."); // print the decimal point
unsigned long frac, mult = 1;
while(precision–) mult *=10;
if(val >= 0) frac = (val - int(val)) * mult; else frac = (int(val) - val) * mult;
unsigned long frac1 = frac;
Serial.print(frac,DEC) ;
}
}

void setup() {
pinMode(fanPin, OUTPUT);
Serial.begin(115200);
}

#define ThermistorPIN 0 // Analog Pin 0
double temp;
void loop() {
Serial.print(“Celsius: “); printDouble(temp,3); // display Celsius
temp = (temp * 9.0)/ 5.0 + 32.0; // converts to Fahrenheit
Serial.print(”, Fahrenheit: “); printDouble(temp,3); // display Fahrenheit
Serial.println(””); // End of Line
delay(1000); // Delay a bit… for fun, and to not Serial.print faster than the serial connection can output

digitalWrite(fanPin, HIGH); // turns buzzer on

} else{
digitalWrite(fanPin, LOW);
delay(1000);
}
}

For starters, What do I put in the line where all of the question marks are to the right of the “if” code?

Any help on this simple part would be appreciated sooooo much!
I’ve really tried to read up on this, but haven’t found anything.
Or directed help would be very cool too!

The lcd keypad hasn't been introduced to the project yet, as you can see in the code. The first problem is the "if" section.

I take it that too many people are asking too many questions, and nobody can keep up.

oh well. no biggie. Not like I need this to live.

Anybody know of another arduino board out there?