We are dealing with the TMP36 from Analog Devices - here is the datasheet.
First, we clarify the questions of whether a sensor can also be tested without a device. First of all: yes ;-)Then we look at the method of how to convert the voltage into the temperature.
Apply 2.7-5.5V to the left leg via batteries or another power source. Connect the right leg to GND (2-4 AA batteries work fantastic). The writing on the sensor is facing you. The semicircular circle lies on the floor.
The voltage is measured over the middle leg: use a multimeter and connect GND with GND and use the red reading head of the multimeter to read the voltage on the middle leg.
My comfortable room temperature is apparently 0.718 volts.
You can safely touch the sensor with your fingers or hold it under a heat-emitting lamp: the voltage value changes immediately.
And how can we convert the voltage into a temperature?If you're using a 5V Arduino, and connecting the sensor directly into an Analog pin, you can use these formulas to turn the 10-bit analog reading into a temperature:
Voltage at pin in milliVolts = (reading from ADC) * (5000/1024)This formula converts the number 0-1023 from the ADC into 0-5000mV (= 5V)
//getting the voltage reading from the temperature sensor
int reading = analogRead(sensorPin);
// converting that reading to voltage, for 3.3v arduino use 3.3
float voltage = reading * 5.0;
voltage /= 1024.0;
// print out the voltage
Serial.print(voltage); Serial.println(" volts");
If you're using a 3.3V Arduino, you'll want to use this:
Voltage at pin in milliVolts = (reading from ADC) * (3300/1024)This formula converts the number 0-1023 from the ADC into 0-3300mV (= 3.3V)
Then, to convert millivolts into temperature, use this formula:
Centigrade temperature = [(analog voltage in mV) - 500] / 10
// now print out the temperature
float temperatureC = (voltage - 0.5) * 100 ; //converting from 10 mv per degree with 500 mV offset
//to degrees ((voltage - 500mV) times 100)
Serial.print(temperatureC); Serial.println(" degrees C");
Don't be confused: whether you calculate 0.5 x 100 or 500/10 leads to the same result.
The results can be viewed on the serial monitor of the Arduino IDE with 9600 baud.
You can find more information here at Adafruit.
Comments