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

Both sides previous revision Previous revision
Next revision
Previous revision
tutorials:learn:sensors:tmp36.html [2010/10/07 19:37]
daigo
tutorials:learn:sensors:tmp36.html [2016/01/28 18:05] (current)
Line 24: Line 24:
  
  
-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.+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.
  
  
Line 163: 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 171: 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 227: 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 236: 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);​
/home/ladyada/public_html/wiki/data/attic/tutorials/learn/sensors/tmp36.html.1286480229.txt.gz · Last modified: 2016/01/28 18:05 (external edit)