Morning all, long time reader, first time poster...
I am working on a project that requires progressively increasing speed of fan as temperature increases... and i would like to output the temp to a lcd... this example( http://www.electroschematics.com/9540/arduino-fan-speed-controlled-temperature/ ) is perfect for what i need but with one little glitch, im using a 10k thermistor/10k resistor divider so u would think is just a simple output change...
It outputs a direct value to the lcd ( 250 = 2.5v ) ive tried Many different thermistor maths and they do weird and wild readings. .. any help would be great
im thinking it this particular spot
int readTemp() { // get the temperature and convert it to celsius
temp = analogRead(tempPin); return temp * 0.48828125;
I don't have access to the lm35 ic, but have lots of 10k thermistors
Thanks in advance , Glen
Quick update, i don't have a drama setting low and high point on the actual fan control section using the current outputs if i have to, all im aiming for is modifying the lcd output...
Thermistors are very nonlinear and it takes some high powered math to tame them.
Google: Steinhart - Hart equation.
http://www.daycounter.com/Calculators/Steinhart-Hart-Thermistor-Calculator.phtml
jcallen:
Thermistors are very nonlinear and it takes some high powered math to tame them.
Google: Steinhart - Hart equation.
Steinhart-Hart Thermistor Calculator
Ive done that, in fact that section of code i added this,
int readTemp() { // get the temperature and convert it to celsius temp = analogRead(tempPin);
return temp = temp / (0.001129148 + (0.000234125 + (0.0000000876741 * temp * temp ))* temp);
temp = temp - 273.15; // Convert Kelvin to Celcius
which is from the playground example ( Arduino Playground - HomePage ) and was off by about 8 degrees Celcius across the board, so i know im close
ok if anyone is interested, I think I fixed it...
int readTemp() { // get the temperature and convert it to celsius
temp = analogRead(tempPin);
return temp = (0.001129148 + (0.000234125 + (0.0000000876741 * temp * temp )) * 1000 );
temp = temp - 273.15; // Convert Kelvin to Celcius
Rather than " * temp" its " * 1000 " ,has been pretty close so far... please let me know if anyone spots a mistake
ok final code, if anyone is interested and mods if u could please move to the correct area, this will display temp and fan % on a lcd at 31250Hz(no noise)...
using a 10k thermistor / 10k resistor divider...
Glen
sketch_jul29a_fan_control_works2.ino (2.76 KB)
I can not follow your Steinhart-Hart Thermistor equation math.
int readTemp() { // get the temperature and convert it to celsius
temp = analogRead(tempPin);
return temp = (0.001129148 + (0.000234125 + (0.0000000876741 * temp * temp )) * 1000);
temp = temp - 273.15; // Convert Kelvin to Celcius
}
The generalized form of the equation which works fairly universally, and is in the reference you cited from the playground ( Arduino Playground - HomePage ) is as follows.
Temperature in Kelvin = 1 / {A + B[ln(R)] + C[ln(R)]3}
where A = 0.001129148, B = 0.000234125 and C = 8.76741E-08
with a 10K resistor and a 10K thermistor divider circuit, the temperature function works out to be
float Thermistor(int RawADC) {
long fixedR = 10000;
long Resistance;
float Temp; // Dual-Purpose variable to save space.
Resistance= fixedR*((1024.0 / RawADC) - 1);
Temp = log(Resistance); // Saving the Log(resistance) so not to calculate it 4 times later, log is ln in math.h
Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
Temp = Temp - 273.15; // Convert Kelvin to Celsius
return Temp; // Return the Temperature
}
ok, I have been working out the bugs and I would like some suggestions if anybody interested... Here is the final code with fixed calculations for thermistor, seems dead on.... you will need 'thermistorfun' library.. google it, its easy..
Thanks, Glen
sketch_jul29a_fan_control_works2_newpwm.ino (3.09 KB)