Thanks for getting back to me. I'm not sure why I am getting wildly different results. at 70 F room temp (21.1C) I am getting a raw value from the 1114 sensor of about 295. The formula that gets me to within a degree or two of accuracy seems to be:
tempC = ((analogRead(2) / 4.2) - 50);
but that is only through trial and error, not thru actual calculations. Below is my full code; I value any feedback on why my formula seems to be so far off.
// Digital Thermometer, using a combination of LM35's (cheap, but narrower range), and
// Phidgets 1114 sensors (-40C - 125C range). Remember that the Phidgets sensors are
// 8-bit instead of 10-bit, so the standard calculations provided by Phidgets do not
// work. The corrected calculation for sensorValue to Celcius is:
// phidgetsTempC = ((analogRead(2)/4.2) - 50);
// Also remember that to use the Phidgets sensors, you have to use the slightly
// less accurate 5v internal reference voltage, as opposed to the 1.1v option.
// This means commenting out "analogReference(INTERNAL);" if it is listed in the code,
// and making sure your multiplier for the analogRead() ports is prefixed with 5, not 1.1.
//declare variables
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 7, 8, 5, 6);
int backlight = 2;
int IRsens;
int tempC1;
int tempC2;
int tempF1;
int tempF2;
int phidgetsTempC;
int phidgetsTempF;
void setup()
{
Serial.begin(9600);
lcd.begin (19, 3); //20 x 4 HD44780 LCD. remember it starts with 0, not 1.
pinMode(2, OUTPUT);
}
void loop(){
int span = 75; // take x samples from sensor, to get accurate reading
int tempC1 = 0;
int tempC2 = 0;
int tempF1 = 0;
int tempF2 = 0;
int IRsens = 0;
int phidgetsTempC = 0;
int phidgetsTempF = 0;
for (int i =0; i < span; i++)
tempC1 = (5 * (analogRead(0) * 100.00)/1024.00); //read the value from the sensor
tempC2 = (5 * (analogRead(1) * 100.00)/1024.00); //read the value from the sensor
phidgetsTempC = ((analogRead(2)/4.2) - 50); //Phidgets 1114 temp sensor
IRsens = (analogRead(5)); // LDR on Analog5, for setting backlight on/off
tempF1 = (((tempC1*9)/5)+32);
tempF2 = (((tempC2*9)/5)+32);
phidgetsTempF = (((phidgetsTempC*9)/5)+32);
if (IRsens > 160)
{
digitalWrite(backlight, HIGH);
}
else
{
digitalWrite(backlight, LOW);
}
lcd.setCursor(0,0);
lcd.print("Digital Thermometer");
lcd.setCursor(0,1);
lcd.print(" Inside Temp: ");
lcd.print((tempF1+tempF2)/2); //LM35 sensors on Analog0 and 1
lcd.print(" F ");
lcd.setCursor(0,2);
lcd.print(" Outside Temp: ");
lcd.print(phidgetsTempF); //Phidgets sensor, on Analog2
//lcd.print(analogRead(2));
lcd.print(" F ");
delay(3000); //wait 3000ms before updating the LCD Display
}