Hi. I'm new to arduino, and also pretty new to both circuitry and coding in general. I want to build a sous vide or immersion cooker controller, sort of like this project, except I parted it out myself instead of buying a kit.
Before I can turn any cooker on and off, though, I need to be able to read the temperature. I bought this thermistor probe from amazon and some 10K resistors from radioshack to create a voltage divider. I used a screw shield to connect the probe from the 5V pin to the A0 pin, and the resistor from the A0 pin to ground.
The thermistor probe didn't come with a data sheet or really any documentation, just a little slip of paper that (in Chinese) seemed to say which air conditioners it was compatible with. It definitely did not come with a code library like the popular Dallas/OneWire probes. So what I did was record a bunch of analogread() (voltage?) values from the probe in a pot of ice water that I brought slowly to a boil. I also recorded the temperature in the pot according to two different (thermocouple) kitchen thermometers I had and then I fit the data to a 3rd-degree polynomial in excel.
Here is my code with that fit:
#include <SPI.h>
#include <LiquidCrystal.h>
#include <math.h>
//Function Declarations
double Thermistor(int RawADC)
{
double Temp;
//sample code from http://playground.arduino.cc/ComponentLib/Thermistor2 :
// Temp = log(10000.0*((1024.0/RawADC-1)));
//// =log(10000.0/(1024.0/RawADC-1)) // for pull-up configuration
// Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
// Temp = Temp - 273.15; // Convert Kelvin to Celcius
// Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
//temporary readings, course grade
Temp = (0.00007292585*RawADC*RawADC*RawADC) - (0.2014824*RawADC*RawADC) + (186.2261*RawADC) - (57518.79);
Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
return Temp;
//return RawADC;
}
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
void setup()
{
Serial.begin(115200);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.print("Hello, World!");
}
void loop()
{
lcd.setCursor(0, 1);
lcd.print(Thermistor(analogRead(0)));
lcd.print(" F");
delay(250);
}
This model provides reasonable temperatures, but there are some problems. Namely, I only get about 1ºC/2ºF resolution. That is between 0ºC and 97ºC, the analogread() value varied (nearly linearly?) from 860 to 964. This is problematic, because I would like (ideally) to have sub-1ºF resolution, but that is impossible if an integer change in my input takes ~2ºF difference.
Is this an unavoidable problem in the hardware—the probe—that I chose? I think the voltage in a voltage divider circuit should change most rapidly when the two resistors are very nearly the same resistance. I checked with a multimeter and both my thermistor and my resistor are within 5% of 10K ohms at room temperature. The voltage drop between the +5V pin and the ground pin is also correct. I would rather not replace the probe I already have if I don't have to, but perhaps this one is not sensitive enough for my needs.
I'm also confused that I'm reading around ~880 (from 0 to 1023 ?) at room temperature, when the resistor and the thermistor are both quite nearly 10K ohm. I expected the voltage drop to be about 2.5V and the analogread() value to be close to 600. Is analogread() not linear with voltage? Or is it possible that components in the LCD or arduino board itself are impacting my desired simple voltage divider circuit?
Thank you for any help or insight,
Daniel
EDIT: I forgot to mention I am using an Arduino Uno as my first board here. The LCD shield I am using, if it matters, is this one: http://www.amazon.com/gp/product/B007MYZF9S?psc=1&redirect=true&ref_=od_aui_detailpages00