TMP36 Temperature Sensor with an ESP32 DevKit V1
A low-voltage analog temperature sensor with a 0.5 V offset, so it reads below freezing on a single supply.

On the ESP32 DevKit V1 the TMP36 takes its power from 3V3, well inside its 2.7 V to 5.5 V supply range, and its VOUT goes to GPIO33, an ADC1 input that keeps sampling while Wi-Fi is on. The sketch reads that pin with analogReadMilliVolts() instead of scaling raw counts, because the ESP32's 12-bit ADC is not linear and the calibration ESP-IDF finds in the chip's eFuses corrects it.
Wiring the TMP36 Temperature Sensor to the ESP32 DevKit V1
Pin by pin.
| TMP36 Temperature Sensor | ESP32 DevKit V1 |
|---|---|
| VCC | 3V3 |
| VOUT | GPIO33 (D33) |
| GND | GND |
What to know on the ESP32 DevKit V1
- GPIO33 is ADC1_CH5. The ADC2 pins are shared with the Wi-Fi driver and stop giving readings once it starts, so a thermometer that reports over the network belongs on GPIO32 to GPIO39.Espressif ESP32 Series Datasheet v5.3, pp. 14, 46; ESP-IDF Programming Guide, ADC Oneshot Mode Driver
- The sketch puts GPIO33 at 11 dB attenuation, which arduino-esp32 rates from 150 mV to 2450 mV on the ESP32. The TMP36 gives 100 mV at -40 °C and 1.75 V at 125 °C, so only readings colder than about -35 °C fall under that floor.arduino-esp32 2.0.17 ADC API documentation, analogSetAttenuation(); ADI TMP35/36/37 datasheet Rev. F, pp. 3, 8
- analogReadMilliVolts() follows the attenuation set on the pin, so ADC_6db (150 mV to 1750 mV) is a valid swap if you want finer steps: it still covers -35 °C to 125 °C, and the (V - 0.5) x 100 conversion stays the same.arduino-esp32 2.0.17, cores/esp32/esp32-hal-adc.c, __analogReadMilliVolts(); ADI TMP35/36/37 datasheet Rev. F, p. 8
- Espressif gives the ADC a differential nonlinearity of up to ±7 LSB and recommends filtering or averaging several samples, which is why the loop adds eight millivolt readings before converting.Espressif ESP32 Series Datasheet v5.3, p. 43
- The sensor's output can supply only 50 µA, so GPIO33 should be the only thing on VOUT; ADI's decoupling is a 0.1 µF ceramic from +VS to GND right at the sensor.ADI TMP35/36/37 datasheet Rev. F, pp. 3, 10
TMP36 Temperature Sensor code for the ESP32 DevKit V1
Compiled for esp32:esp32:esp32 on 2026-10-30.
// TMP36 Temperature Sensor on ESP32 DevKit V1: wiring and a free simulation at https://www.tinkered.ai/components/tmp36/esp32
const int VOUT_PIN = 33; // TMP36 VOUT on GPIO33 (ADC1)
void setup() {
Serial.begin(9600);
analogSetPinAttenuation(VOUT_PIN, ADC_11db); // 11 dB, the widest range: Espressif rates it accurate to about 2.45 V
}
void loop() {
// analogReadMilliVolts() applies the chip's own ADC calibration: the ESP32's
// 12-bit analogRead() is not linear, so raw counts * 3.3 / 4095 reads off
uint32_t mv = 0;
for (int i = 0; i < 8; i++) mv += analogReadMilliVolts(VOUT_PIN);
float volts = mv / 8.0 / 1000.0;
float tempC = (volts - 0.5) * 100.0; // 0.5 V at 0 °C, 10 mV per °C
float tempF = tempC * 9.0 / 5.0 + 32.0;
Serial.print("Temperature: ");
Serial.print(tempC, 1);
Serial.print(" C ");
Serial.print(tempF, 1);
Serial.println(" F");
delay(1000);
}
TMP36 Temperature Sensor on the ESP32 DevKit V1: questions
Why is my TMP36 reading wrong on the ESP32 with analogRead()?
Raw counts times 3.3 / 4095 assume a linear ADC with a 3.3 V full scale, and the ESP32 has neither at 11 dB. Use analogReadMilliVolts() as the sketch does, then subtract 500 mV and divide by 10 mV per degree.
Which ESP32 pins can read a TMP36?
Any ADC1 pin, GPIO32 to GPIO39 (ESP32 datasheet, p. 46). GPIO33 is used here; avoid ADC2 pins if the project uses Wi-Fi (ESP-IDF ADC documentation).
Can the TMP36 be powered from 5 V on an ESP32 board?
It tolerates 5 V and its output does not depend on the supply (ADI datasheet, pp. 3, 8), so VOUT stays under 2 V either way. 3V3 is simply the shorter wire and keeps every signal at the ESP32's own level.
Keep going
This guide as plain Markdown. /components/tmp36/esp32.md