TMP36 Temperature Sensor Features
The TMP36 sensor is used to measure temperature from -40°C to +125°C and its tolerance threshold is +150°C. This sensor is calibrated directly on Celsius and its accuracy is 2°C. This sensor has an analog output. The output voltage changes linearly as the temperature changew. For example, the sensor output voltage is 0.75 volts at 25°C and 2.7 volts at 125°C.
This sensor can be used in environmental control systems, thermal protection, fire alarms, CPU thermal management, etc.
You can download the datasheet of this module here.
TMP36 Temperature Sensor Datasheet
TMP36 Temperature Sensor Pinout
This Module has 3 pins:
- VCC: Power supply – 2.7-5.5 V
- GND: Ground
- OUT: Analog output signal
You can see the pinout of this module in the image below.
Required Materials
Hardware Components
Software Apps
Interfacing TMP36 Temperature Sensor with Arduino
Step 1: Circuit
The following circuit shows how you should connect Arduino to TMP36 module. Connect wires accordingly.
Step 2: Code
Upload the following code to Arduino.
/*
TMP36-Temperature -Sensor
made on 07 Nov 2020
by Amir Mohammad Shojaee @ Electropeak
Home
*/
int out_sen=A0 ;
int x;
void setup(){
Serial.begin(9600);
}
void loop(){
x=analogRead(out_sen);//read sensor pin
float voltage=x*5.0;
voltage /=1024.0;
float tem=(voltage-0.5)*100.0; //convert voltage data to temperature
Serial.print("Temperature: ");
Serial.print(tem);
Serial.println(" °C ");
delay(1000);
}
First, we save the analog input. Next we convert it to the range of 0 to 5. Then according to the voltage changes graph with respect to the temperature in the datasheet, we convert the measured voltage into temperature in degrees Celsius. We display the output data in Celsius in Serial Monitor.
You can see the output of the Serial Monitor in the figure below. The ambient temperature is approximately 25.2°C.