TMP36 - Analog temperature sensor

TMP36 - Analog temperature sensor with its pin numbers.
Fig.: TMP36 - Analog temperature sensor with its pin numbers.

The TMP35/TMP36/TMP37 are low-voltage, precision Celsius temperature sensors. They provide a voltage output that is linear and proportional to the Celsius temperature. The TMP35/TMP36/TMP37 does not require external calibration to achieve typical accuracies of ±1°C at +25°C and ±2°C over the temperature range from -40°C to +125°C.

Features

📄 TMP36 datasheet (431 kB)

Used Components

Connections

TMP36-Pin Function Arduino Uno
1 VCC (+2.7V to +5.5V) 3.3V or 5V
2 Signal A0 (or other analog Pin)
3 GND (Ground) GND

Programming

#define TMP36_PIN A0
#define AREF_VOLTAGE 5.0   // depends if we´re using 3.3V or 5.0V for operating the TMP36

void setup() {
    Serial.begin(9600);
}

void loop() {
    unsigned int sensorValue;
    float voltage, degreesCelsius;

    sensorValue = analogRead(TMP36_PIN);
    voltage = getVoltage(sensorValue);
    degreesCelsius = getTemperature(voltage);

    Serial.print("SensorValue: ");
    Serial.print(sensorValue);
    Serial.print("; Voltage: ");
    Serial.print(voltage);
    Serial.print("V; Temperature: ");
    Serial.print(degreesCelsius);
    Serial.println("°C");

    delay(1000);
}

/**
 * Converts the 0 to 1023 value from analogRead() into a 0.0 to 5.0
 * value that is the true voltage being read at that pin.
 */
float getVoltage(int sensorValue) {
    return (sensorValue * AREF_VOLTAGE / 1024);
}

/**
 * Converting the voltage to degrees Celsius.
 * The formula comes from the datasheet of the TMP36
 */
float getTemperature(float voltage) {
    return (voltage - 0.5) * 100.0;
}
Last edited by Christian Grieger on 2025-05-12
X
  1. [top]
  2. Features
  3. Used Components
  4. Connections
  5. Programming