Introduction: How to Use the TMP36 Temp Sensor - Arduino Tutorial
The TMP35/TMP36/TMP37 are low voltage, precision centigrade temperature sensors. They provide a voltage output that is linearly proportional to the Celsius (centigrade) temperature. The TMP35/ TMP36/TMP37 do not require any external calibration to provide typical accuracies of ±1°C at +25°C and ±2°C over the −40°C to +125°C temperature range.
In this tutorial you will learn how to use the TMP36 sensor with Arduino uno. The room temperature will be printed to serial monitor.
Before we start let's see more information about this sensor.
Step 1: About TMP36 Sensor
Features:
- Low Voltage Operation (+2.7 V to+5.5 V)
- Calibrated Directly in °C
- 10 mV/8°C Scale Factor (20 mV/8°C on TMP37)
- ±2°C Accuracy OverTemperature (typ)
- ±0.5°C Linearity (typ)
- Stable with Large Capacitive Loads
- Specified -40 °C to +125 °C, Operation to +150 °C
- Less than 50 µA Quiescent Current
- Shutdown Current 0.5 µA max
You can see the TMP36 pinout in the image above.
Find more info here: datasheet
Step 2: What You Will Need
For this project you will need:
- Arduino uno
- Breadboard
- TMP36 temp sensor
Step 3: The Circuit
The connections are pretty easy, see the image above with the breadboard circuit schematic.
Make sure to watch sensor from front side:
- Connect the 5V pin to 5 Volts (5V)
- Connect the SIGNAL pin to analog pin 0
- Connect the GND pin to ground (GND)
Step 4: The Code
Here's the code, embedded using codebender!
We will use code from SparkFun Inventor's Kit - SIK Guide, Example sketch 07. The code is pretty self-explanatory, and the comments do a better job than me explaining how it works.
Try downloading the codebender plugin and clicking on the Run on Arduino button to program your Arduino board with this sketch. And that's it, you've programmed your Arduino with this sketch. Press connect button below to start serial communication and receive temperature from sensor.
Step 5: Well Done!
You have successfully completed one more Arduino "How to" tutorial and you learned how to use the TMP36 temperature sensor with Arduino.
I hope you liked this, let me know in the comments.
There will be more of them, so make sure to click Follow button!
7 Comments
3 years ago
Just one question; I am planning to use this sensor to measure the temperature of water and when it boils, turn off the stove. (I will not leave it alone, obviously. There will be supervision!) How practical would this one be? I would rate myself competent with the coding side and about average at the physical circut side. Also, do you think an arduino uno starter kit servo would be strong enough for the knob?
Thanks,
Jonn
6 years ago
Putting a 10 picofarad capacitor from the middle terminal to ground should siphon off any transient rf that you're picking up... mine settled down when I did that.
Reply 5 years ago
The datasheet for the TMP3x says a 0.1uF cap across the device power with very short leads (i.e. right at the TMP36) is best to stop it from rectifying transients (like RF etc.) and distorting the output. The TMP3x can drive quite a high capacitive load, so a cap on the output is ok but would be even better with a 750Ohm resistor before it to make a low pass filter :-)
Datasheet:
http://www.analog.com/media/en/technical-documentation/data-sheets/TMP35_36_37.pdf
6 years ago
After you've got it working you can condense it down to a single calculation (of course losing all the valuable documentation and debugging ability that you gain from doing it line by line). For farenheit I did this:
round(((((analogRead(tempin)*3.3)/4095.0)-0.5)*100.00)*1.8)+32.0)
7 years ago
Hello,
I am brand new to Arduino Uno and the world of electronics in general. I bought the Arduino starter kit a little while back, and I decided to go through the ten projects outlined in the booklet that came with the kit. One of the projects is called the "Love-o-meter" which sends variable voltages to LEDs based on the TMP36's readings. A prerequisite to the whole project is knowing the baseline room temperature, and since I don't have a thermometer, I thought I'd simply use the sensor itself to give me that information. So I found this instructable and followed the directions, plugged in the code and voila it was giving me temperatures...except that they seemed to be about 20 degrees cooler than what the room feels like. (I just discovered that my AC unit has a thermostat that is reading 72 degrees Farenheit when the temp sensor was spitting out an average of 58 degrees Farenheit.) Any help in understanding this discrepancy would be greatly appreciated! I just want to learn from what I have just discovered.
Best,
Tom
Reply 6 years ago
You can try using a different source of power for your project. I have had issues with the sensor reading incorrect values when I am powering the Arduino from certain USB devices and wall power supplies.
Reply 6 years ago
I just did a test, and got temperature values about 6 degrees Fahrenheit lower powering the Arduino from a 9v a wall power supply versus from my laptop's USB ports.