| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
tutorials:learn:sensors:tmp36.html [2010/10/07 19:33] 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 96: | Line 96: | ||
| ==== Project examples ==== | ==== Project examples ==== | ||
| - | <object width="425" height="344"><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?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 \\ | + | |
| + | {{ youtube>7A7coLAUyfQ }} | ||
| + | Remote temperature sensor | ||
| + | |||
| + | {{ youtube>bVGvE4jnxWM }} | ||
| + | Video editor that uses biofeedback (body temperature) | ||
| + | |||
| + | {{ 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 \\ | ||
| ==== Reading the analog temperature data ==== | ==== Reading the analog temperature data ==== | ||
| Line 155: | 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 163: | 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 219: | 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 228: | 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); | ||