The effect of the environment on any electrical device can be countered by firstly getting it right, attaching heavy contact points and then submerging everything else in epoxy, clear or dark
I'd love to see you apply this to cellphone design! ;D
The effect of the environment on any electrical device can be countered by firstly getting it right, attaching heavy contact points and then submerging everything else in epoxy, clear or dark
I'd love to see you apply this to cellphone design! ;D
I am using a Duemilanova to process temperatures from multiple sensors.
I chose the tmp36 at $2 each from LadyAda. The raw output from the AtoDs is variable as another writer suggested - plus/minus 2 degC, but an exponential smoother with a "time constant" of 100 samples reveals the useful accuracy of the TMP36 - to calibrate, I wrapped three sensors together in aluminum foil to keep the temp constant for all three sensors, which shows the inherent accuracy of my three sensors as +0.32 degC, -0.65 degC and +0.10 degC.
The TMP36 needs a 3 wire hookup it's true: but a 50 ft hank of 4-conductor telephone solid wire is like $2 or so, and that's easy to handle.
Because my prime interest is differential temperatures around room temperature, and switching in fans from a warmer attic, or a cooler basement or outside; and running an attic exhaust fan when necessary, it was easy to provide a calibration constant for each sensor so they track within about 40 millidegreesC or better.
Here's the front end code
//TMP36 Pin Variables
/*
Serial.begin(9600); //Start the serial connection with the computer
//to view the result open the serial monitor
delay(500);
}
void loop() // continuous loop
{
int reading0 = analogRead(sensorPin0);
int reading1 = analogRead(sensorPin1);
int reading2 = analogRead(sensorPin2);
int reading3 = analogRead(sensorPin3);
// convert that 0-1023 reading to a voltage
float voltage0 = reading0 * 4.900 / 1024;
float voltage1 = reading1 * 4.900 / 1024;
float voltage2 = reading2 * 4.900 / 1024;
float voltage3 = reading3 * 4.900 / 1024;
// print out the voltage at sensor0
Serial.print(voltage0); Serial.println("Sensor0 volts");
// now print out the temperature
float temperature0C = (voltage0 - 0.5) * 100 + calConst0 ; //converting from 10 mv per degree with 500 mV offset
//and sensor correction to degrees ((voltage - 500mV) times 100)
float tempout0 = 0.010 * temperature0C + 0.990 * smoothTemp0 ; //exp smooth over 100 samples
Serial.print(tempout0); Serial.println(" Sensor 0 degrees C");
float temperature1C = (voltage1 - 0.5) * 100 + calConst1 ; //converting from 10 mv per degree with 500 mV offset
//to degrees ((voltage - 500mV) times 100)
float tempout1 = 0.010 * temperature1C + 0.990 * smoothTemp1 ; //exp smooth over 100 samples
Serial.print(tempout1); Serial.println(" Sensor 1 degrees C");
float temperature2C = (voltage2 - 0.5) * 100 + calConst2 ; //converting from 10 mv per degree wit 500 mV offset
//to degrees ((voltage - 500mV) times 100)
float tempout2 = 0.010 * temperature2C + 0.990 * smoothTemp2 ; //exp smooth over 100 samples
Serial.print(tempout2); Serial.println(" Sensor 2 degrees C");
float temperature3C = (voltage3 - 0.5) * 100 + calConst3 ; //converting from 10 mv per degree wit 500 mV offset
//to degrees ((voltage - 500mV) times 100)
float tempout3 = 0.010 * temperature3C + 0.990 * smoothTemp3 ; //exp smooth over 100 samples
Serial.print(tempout3); Serial.println(" Sensor 3 degrees C");
// now convert to Fahrenheit
float temperatureF = (temperature0C * 9 / 5) + 32;
Serial.print(temperatureF); Serial.println(" Sensor 0 degrees F");
Serial.println(" *** ") ;
smoothTemp0 = tempout0 ; // update smoothing integrators for next pass
smoothTemp1 = tempout1 ;
smoothTemp2 = tempout2 ;
smoothTemp3 = tempout3 ;
delay(5000); //waiting 5 second
}
Regards
Brian Whatcott Altus OK
Well.... let me blow some dust off this. Came in via site search for TMP36.
@AWOL - FUNNY!!
@Brian - I got here searching for a solution to averaging samples. THANKS!!!
The code was most informative. Gonna go stare at it for a few hours more.. ![]()