I have an Arduino Diecimila and a bunch of old Phidgets 1114 Temperature Sensors.
I want to be able to get a somewhat steady / accurate temperature from these sensors inside my arduino sketches.
The formula from phidgets for the 1114 is tempC = (SensorValue / 4) - 50.
My understanding is that Phidgets have an 8 bit ADC and Arduino has a 10bit ADC.
Also read an old post here describing the use of a formula more like this tempC = (SensorValue * 0.0625) - 50. Due to the 10bit dac needing to divide by 4 again to get this result on a 10bit ADC.
Using the analoginoutserial example I've come up with this:
const int analogInPin = A5; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to
int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)
float temperature = 0.0;
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 255);
// change the analog out value:
analogWrite(analogOutPin, outputValue);
// print the results to the serial monitor:
Serial.print("sensor = " );
Serial.print(sensorValue);
Serial.print("\t Temperature = ");
temperature = ((float)sensorValue/4) - 50.0;
Serial.println(temperature);
// wait 10 milliseconds before the next loop
// for the analog-to-digital converter to settle
// after the last reading:
delay(10);
}
This yields serial monitor output like so:
sensor = 303 Temperature = 25.75
sensor = 305 Temperature = 26.25
sensor = 306 Temperature = 26.50
sensor = 307 Temperature = 26.75
sensor = 303 Temperature = 25.75
sensor = 310 Temperature = 27.50
sensor = 308 Temperature = 27.00
sensor = 305 Temperature = 26.25
sensor = 306 Temperature = 26.50
sensor = 307 Temperature = 26.75
sensor = 303 Temperature = 25.75
sensor = 304 Temperature = 26.00
sensor = 302 Temperature = 25.50
sensor = 305 Temperature = 26.25
sensor = 304 Temperature = 26.00
sensor = 305 Temperature = 26.25
sensor = 307 Temperature = 26.75
sensor = 303 Temperature = 25.75
sensor = 305 Temperature = 26.25
sensor = 306 Temperature = 26.50
Which shows the temperature is about 2-3 degrees C higher than it presently is, I have a separate temp gauge here showing 24.5C
I've tried using the * 0.0625 and that just brings the value to -30, -31 range...