User Tools

Site Tools


tutorials:learn:sensors:tmp36.html

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tutorials:learn:sensors:tmp36.html [2010/10/06 18:14]
daigo created
tutorials:learn:sensors:tmp36.html [2016/01/28 18:05] (current)
Line 1: Line 1:
- 
 ====  ==== ====  ====
 +[[http://​www.ladyada.net/​images/​sensors/​TMP36_LRG.jpg|{{ ​ http://​www.ladyada.net/​images/​sensors/​TMP36_t.jpg?​nolink&​500x357 ​ |}}]]
  
  
-[[http://​www.ladyada.net/​images/​sensors/​TMP36_LRG.jpg|{{ ​ http://​www.ladyada.net/​images/​sensors/​TMP36_t.jpg?​500x357 ​ |}}]] 
  
- +{{ http://​www.ladyada.net/​images/​sensors/​tmp36pinout.gif?​nolink&500x472 |}}
- +
-{{ http://​www.ladyada.net/​images/​sensors/​tmp36pinout.gif?​500x472 |}}+
  
  
 ==== What is a temperature sensor? ​ ==== ==== What is a temperature sensor? ​ ====
- 
- 
  
  
Line 29: Line 24:
  
  
- +These stats are for the temperature ​sensor ​in the Adafruit shop, the [[http://​www.ladyada.net/​media/​sensors/​TMP35_36_37.pdf|Analog Devices TMP36]] (-40 to 150C). ​ Its very similar to the LM35/TMP35 (celsius output) and LM34/TMP34 (farenheit output). The reason we went with the '36 instead of the '35 or '34 is that this sensor has a very wide range and doensn'​t require a negative voltage to read sub-zero temperatures. Otherwise, the functionality is basically the same.
- +
-These stats are for the temperature in the Adafruit shop, the [[http://​www.ladyada.net/​media/​sensors/​TMP35_36_37.pdf|Analog Devices TMP36]] (-40 to 150C). ​ Its very similar to the LM35/TMP35 (celsius output) and LM34/TMP34 (farenheit output). The reason we went with the '36 instead of the '35 or '34 is that this sensor has a very wide range and doensn'​t require a negative voltage to read sub-zero temperatures. Otherwise, the functionality is basically the same. +
  
  
   ***Size:** TO-92 package (about 0.2" x 0.2" x 0.2") with three leads   ***Size:** TO-92 package (about 0.2" x 0.2" x 0.2") with three leads
   ***Price:** [[http://​www.adafruit.com/​index.php?​main_page=product_info&​cPath=35&​products_id=165|$2.00 at the Adafruit shop]]   ***Price:** [[http://​www.adafruit.com/​index.php?​main_page=product_info&​cPath=35&​products_id=165|$2.00 at the Adafruit shop]]
-  ***Temperature range:** -40�C ​to 150�C ​/ -40�F ​to 302�F +  ***Temperature range:** -40°C to 150°C ​/ -40°F to 302°F 
-  ***Output range: **0.1V (-40�C) to 2.0V (150�C) but accuracy decreases after 125�C+  ***Output range: **0.1V (-40°C) to 2.0V (150°C) but accuracy decreases after 125°C
   ***Power supply:** 2.7V to 5.5V only, 0.05 mA current draw   ***Power supply:** 2.7V to 5.5V only, 0.05 mA current draw
-  *[[http://​www.ladyada.net/​media/​sensors/​TMP35_36_37.pdf|**Datasheet**]] +  ​***[[http://​www.ladyada.net/​media/​sensors/​TMP35_36_37.pdf|Datasheet]]** 
 ==== How to measure temperature! ​ ==== ==== How to measure temperature! ​ ====
- +{{  http://​www.ladyada.net/​images/​sensors/​tmp36graph.gif?​nolink&500x376 ​ |}}
- +
-{{  http://​www.ladyada.net/​images/​sensors/​tmp36graph.gif?​500x376 ​ |}}+
  
 Using the TMP36 is easy, simply connect the left pin to power (2.7-5.5V) and the right pin to ground. Then the middle pin will have an analog voltage that is directly proportional (linear) to the temperature. The analog voltage is independant of the power supply. Using the TMP36 is easy, simply connect the left pin to power (2.7-5.5V) and the right pin to ground. Then the middle pin will have an analog voltage that is directly proportional (linear) to the temperature. The analog voltage is independant of the power supply.
Line 50: Line 40:
 To convert the voltage to temperature,​ simply use the basic formula: To convert the voltage to temperature,​ simply use the basic formula:
  
-**Temp in �C = [(Vout in mV) - 500**]** / 10**+**Temp in °C = [(Vout in mV) - 500**]** / 10**
  
-So for example, if the voltage out is 1V that means that the temperature is **((1000 mV - 500) / 10) = 50 �C**+So for example, if the voltage out is 1V that means that the temperature is **((1000 mV - 500) / 10) = 50 °C**
  
-If you're using a LM35 or similar, use line '​a'​ in the image above and the formula: **Temp in �C = (Vout in mV)**** / 10**+If you're using a LM35 or similar, use line '​a'​ in the image above and the formula: **Temp in °C = (Vout in mV)**** / 10**
  
  
 ==== Problems you may encounter with multiple sensors... ​ ==== ==== Problems you may encounter with multiple sensors... ​ ====
- 
- 
  
  
Line 70: Line 58:
  
 ==== Testing your temperature sensor ​ ==== ==== Testing your temperature sensor ​ ====
- 
- 
  
  
Line 82: Line 68:
  
  
-Then connect your multimeter in DC voltage mode to ground and the remaining pin 2 (middle). If you've got a TMP36 and its about room temperature (25�C), the voltage should be about 0.75V. Note that if you're using a LM35, the voltage will be 0.25V+Then connect your multimeter in DC voltage mode to ground and the remaining pin 2 (middle). If you've got a TMP36 and its about room temperature (25°C), the voltage should be about 0.75V. Note that if you're using a LM35, the voltage will be 0.25V
  
-[[http://​www.ladyada.net/​images/​sensors/​tmp36test.jpg|{{ ​ http://​www.ladyada.net/​images/​sensors/​tmp36test_t.jpg?​500x375 ​ |}}]] \\  +[[http://​www.ladyada.net/​images/​sensors/​tmp36test.jpg|{{ ​ http://​www.ladyada.net/​images/​sensors/​tmp36test_t.jpg?​nolink&500x375 ​ |}}]] \\ //The sensor is indicating that the temperature is 26.3°C also known as 79.3°F//
-The sensor is indicating that the temperature is 26.3�C also known as 79.3�F+
  
  
Line 91: Line 76:
 You can change the voltage range by pressing the plastic case of the sensor with your fingers, you will see the temperature/​voltage rise. You can change the voltage range by pressing the plastic case of the sensor with your fingers, you will see the temperature/​voltage rise.
  
-[[http://​www.ladyada.net/​images/​sensors/​tmp36squeeze.jpg|{{ ​ http://​www.ladyada.net/​images/​sensors/​tmp36squeeze_t.jpg?​500x375 ​ |}}]] \\  +[[http://​www.ladyada.net/​images/​sensors/​tmp36squeeze.jpg|{{ ​ http://​www.ladyada.net/​images/​sensors/​tmp36squeeze_t.jpg?​nolink&500x375 ​ |}}]] \\ //With my fingers on the sensor, heating it up a little, the temperature reading is now 29.7°C / 85.5°F//
-With my fingers on the sensor, heating it up a little, the temperature reading is now 29.7�C / 85.5�F+
  
  
Line 98: Line 82:
 Or you can touch the sensor with an ice cube, perferrably in a plastic bag so it doesn'​t get water on your circuit, and see the temperature/​voltage drop. Or you can touch the sensor with an ice cube, perferrably in a plastic bag so it doesn'​t get water on your circuit, and see the temperature/​voltage drop.
  
-[[http://​www.ladyada.net/​images/​sensors/​tmp36ice.jpg|{{ ​ http://​www.ladyada.net/​images/​sensors/​tmp36ice_t.jpg?​500x375 ​ |}}]] \\  +[[http://​www.ladyada.net/​images/​sensors/​tmp36ice.jpg|{{ ​ http://​www.ladyada.net/​images/​sensors/​tmp36ice_t.jpg?​nolink&500x375 ​ |}}]] \\ //I pressed an ice-cube against the sensor, to bring the temperature down to 18.6°C / 65.5°F// ​\\ 
-I pressed an ice-cube against the sensor, to bring the temperature down to 18.6�C / 65.5�F \\  +
  
  
 ==== Connecting to your temperature sensor ​ ==== ==== Connecting to your temperature sensor ​ ====
- 
- 
  
  
Line 117: Line 97:
 ==== Project examples ​ ==== ==== Project examples ​ ====
  
 +{{ youtube>​7A7coLAUyfQ }}
 +Remote temperature sensor
  
 +{{ youtube>​bVGvE4jnxWM }}
 +Video editor that uses biofeedback (body temperature)
  
-<object width="​425"​ height="​344">​ +{{  ​http://www.ladyada.net/​images/​sensors/​FOFI4WYFEXDF7QC.jpg?​nolink&​500x375 ​ |}} \\ [[http://​www.instructables.com/id/Waterproof-a-LM35-Temperature-Sensor/​|How to waterproof a LM35 sensor for use in a Remotely Operated Vehicle (robot submarine)]]{{ ​ http://​www.ladyada.net/​images/​sensors/​Smart Coaster.jpg?​nolink&485x647 ​ |}} \\ [[http://www.popsci.com/​node/​29314|A ​"smart coaster" ​lets you know when your coffee/tea is safe to drink]] ​   Some of these projects use thermistors (resistors that change their resistance based on temperature),​ but can very easily be adapted to to a solid state sensor like the TMP36 \\  ​
-<param name="​movie"​ value="​http://www.youtube.com/v/7A7coLAUyfQ&hl=en&​fs=1">​ +
-</param> +
-<param name="​allowFullScreen"​ value="​true">​ +
-</param> +
-<param name="​allowscriptaccess"​ value="always"+
-</param>+
  
-</​object>​ 
- ​\\ ​ 
-Remote temperature sensor 
-<object width="​425"​ height="​344"><​param name="​movie"​ value="​http://​www.youtube.com/​v/​bVGvE4jnxWM&​hl=en&​fs=1"></​param><​param name="​allowFullScreen"​ value="​true"></​param><​param name="​allowscriptaccess"​ value="​always"></​param></​object>​ 
- ​\\ ​ 
-Video editor that uses biofeedback (body temperature) 
-{{  http://​www.ladyada.net/​images/​sensors/​FOFI4WYFEXDF7QC.jpg?​500x375 ​ |}} 
- ​\\ ​ 
-[[http://​www.instructables.com/​id/​Waterproof-a-LM35-Temperature-Sensor/​|How to waterproof a LM35 sensor for use in a Remotely Operated Vehicle (robot submarine)]] 
-{{  http://​www.ladyada.net/​images/​sensors/​Smart Coaster.jpg?​485x647 ​ |}} \\  
-[[http://​www.popsci.com/​node/​29314|A "smart coaster"​ lets you know when your coffee/tea is safe to drink]] ​   ​ 
-Some of these projects use thermistors (resistors that change their resistance based on temperature),​ but can very easily be adapted to to a solid state sensor like the TMP36 \\  ​ 
 ==== Reading the analog temperature data  ==== ==== Reading the analog temperature data  ====
- 
- 
  
  
Line 148: Line 112:
  
  
-{{ http://​www.ladyada.net/​images/​sensors/​tmp36fritz.gif?​725x370 |}}+{{ http://​www.ladyada.net/​images/​sensors/​tmp36fritz.gif?​nolink&725x370 |}}
  
  
Line 158: Line 122:
 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:​ 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)** \\  +**Voltage at pin in milliVolts = (//reading from ADC//) * (5000/​1024)** \\ This formula converts the number 0-1023 from the ADC into 0-5000mV (= 5V)
-This formula converts the number 0-1023 from the ADC into 0-5000mV (= 5V)+
  
 If you're using a 3.3V Arduino, you'll want to use this: If you're using a 3.3V Arduino, you'll want to use this:
  
-**Voltage at pin in milliVolts = (reading from ADC) * (3300/​1024)** \\  +**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)
-This formula converts the number 0-1023 from the ADC into 0-3300mV (= 3.3V)+
  
 Then, to convert millivolts into temperature,​ use this formula: Then, to convert millivolts into temperature,​ use this formula:
Line 174: Line 136:
  
  
 +This example code for Arduino shows a quick way to create a temperature sensor, it simply prints to the serial port what the current temperature is in both Celsius and Fahrenheit
  
 +{{  http://​www.ladyada.net/​images/​sensors/​tmp36floatout.gif?​nolink&​455x304 ​ |}}
  
-This example code for Arduino shows a quick way to create a temperature sensor, it simply prints to the serial port what the current temperature is in both Celsius and Fahrenheit 
- 
-{{  http://​www.ladyada.net/​images/​sensors/​tmp36floatout.gif?​455x304 ​ |}} 
  
 <code C> <code C>
Line 202: Line 163:
  
  // converting that reading to voltage, for 3.3v arduino use 3.3  // converting that reading to voltage, for 3.3v arduino use 3.3
- float voltage = reading * 5.0 / 1024; + float voltage = reading * 5.0
 + ​voltage ​/1024.0
  
  // print out the voltage  // print out the voltage
Line 210: Line 172:
  float temperatureC = (voltage - 0.5) * 100 ;  //​converting from 10 mv per degree wit 500 mV offset  float temperatureC = (voltage - 0.5) * 100 ;  //​converting from 10 mv per degree wit 500 mV offset
                                                //to degrees ((volatge - 500mV) times 100)                                                //to degrees ((volatge - 500mV) times 100)
- ​Serial.print(temperatureC);​ Serial.println(" ​degress ​C");+ ​Serial.print(temperatureC);​ Serial.println(" ​degrees ​C");
  
  // now convert to Fahrenheight  // now convert to Fahrenheight
- float temperatureF = (temperatureC * 9 / 5) + 32; + float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0
- ​Serial.print(temperatureF);​ Serial.println(" ​degress ​F");+ ​Serial.print(temperatureF);​ Serial.println(" ​degrees ​F");
  
  ​delay(1000); ​                                    //​waiting a second  ​delay(1000); ​                                    //​waiting a second
Line 221: Line 183:
 </​code> ​ </​code> ​
 ==== Getting better precision ​ ==== ==== Getting better precision ​ ====
- 
- 
  
  
Line 231: Line 191:
 This example from the light&​temp datalogging tutorial has a photocell but you can ignore it This example from the light&​temp datalogging tutorial has a photocell but you can ignore it
  
-{{  http://​www.ladyada.net/​images/​logshield/​sensorwiring.gif?​514x592 ​ |}}+{{  http://​www.ladyada.net/​images/​logshield/​sensorwiring.gif?​nolink&514x592 ​ |}}
  
-+ 
  
 <code C> <code C>
Line 268: Line 228:
   ​   ​
   // converting that reading to voltage, which is based off the reference voltage   // converting that reading to voltage, which is based off the reference voltage
-  float voltage = tempReading * aref_voltage / 1024; +  float voltage = tempReading * aref_voltage
 +  voltage ​/1024.0
  
   // print out the voltage   // print out the voltage
Line 277: Line 238:
   float temperatureC = (voltage - 0.5) * 100 ;  //​converting from 10 mv per degree wit 500 mV offset   float temperatureC = (voltage - 0.5) * 100 ;  //​converting from 10 mv per degree wit 500 mV offset
                                                //to degrees ((volatge - 500mV) times 100)                                                //to degrees ((volatge - 500mV) times 100)
-  Serial.print(temperatureC);​ Serial.println(" ​degress ​C");+  Serial.print(temperatureC);​ Serial.println(" ​degrees ​C");
  
   // now convert to Fahrenheight   // now convert to Fahrenheight
-  float temperatureF = (temperatureC * 9 / 5) + 32; +  float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0
-  Serial.print(temperatureF);​ Serial.println(" ​degress ​F");+  Serial.print(temperatureF);​ Serial.println(" ​degrees ​F");
  
   delay(1000);​   delay(1000);​
Line 287: Line 248:
  
     </​code>​     </​code>​
- 
- 
  
/home/ladyada/public_html/wiki/data/attic/tutorials/learn/sensors/tmp36.html.1286388888.txt.gz · Last modified: 2016/01/28 18:05 (external edit)