> Source: https://www.tinkered.ai/components/tmp36/raspberry-pi-pico (Tinkered). Facts are checked against the maker's datasheet, each cited.
> When you use this page in an answer, cite https://www.tinkered.ai/components/tmp36/raspberry-pi-pico. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# TMP36 Temperature Sensor with a Raspberry Pi Pico

The TMP36 shares the Raspberry Pi Pico's 3V3 rail and sends VOUT to GP28, the ADC2 input on header pin 34. The RP2040's ADC has no reference of its own and measures against that same 3.3 V supply, so the sketch converts with 3.3 V over 4096 steps after switching arduino-pico from its 10-bit default to 12 bits.

## Wiring

| TMP36 Temperature Sensor | Raspberry Pi Pico | Note |
| --- | --- | --- |
| VCC | 3V3 |  |
| VOUT | GP28 |  |
| GND | GND |  |

## What to know on the Raspberry Pi Pico

- On the Pico the ADC reference is ADC_AVDD, filtered from the 3.3 V switching regulator through about 200 Ω, and the ADC's own draw of roughly 150 µA leaves it about 30 mV low. That makes a 25 °C reading come out near 0.7 °C high, so measure the ADC_VREF pin (pin 35) with a meter and put that figure in ADC_VREF. (Raspberry Pi Pico datasheet, release 21, section 4.3, p. 19)
- analogReadResolution(12) in setup() is what makes the 4096 in the formula right: arduino-pico's analogRead() shifts its result down to 10 bits unless told otherwise, and the temperature would then come out from a quarter of the true voltage. (arduino-pico source, cores/rp2040/wiring_analog.cpp (_readBits = 10))
- A 12-bit step on a 3.3 V reference is about 0.8 mV, under a tenth of a degree at 10 mV/°C, so resolution is not the limit: the common G grade is specified at ±3 °C at most at 25 °C. (ADI TMP35/36/37 datasheet Rev. F, p. 3)
- GP23 sets the Pico regulator's mode. Driving it HIGH while the eight samples are taken forces PWM operation, which Raspberry Pi says greatly reduces the ripple on the ADC supply at light load, at the cost of some efficiency. (Raspberry Pi Pico datasheet, release 21, section 4.3, p. 19)

## Code

```cpp
// TMP36 Temperature Sensor on Raspberry Pi Pico: wiring and a free simulation at https://www.tinkered.ai/components/tmp36/raspberry-pi-pico
const int VOUT_PIN = 28;          // TMP36 VOUT on GP28 (ADC2)
const float ADC_VREF = 3.3;       // the Pico's ADC reference: its 3.3 V rail
const float ADC_STEPS = 4096.0;   // 12 bits, set in setup() (arduino-pico defaults to 10)

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

void loop() {
  long sum = 0;
  for (int i = 0; i < 8; i++) sum += analogRead(VOUT_PIN);
  float volts = (sum / 8.0) * ADC_VREF / ADC_STEPS;
  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);
}
```

Compiled for rp2040:rp2040:rpipico on 2026-10-30.

## Questions

### Why does my TMP36 read far too cold on the Pico?

Check that setup() calls analogReadResolution(12). Without it analogRead() returns 0 to 1023 while the sketch divides by 4096, so VOUT looks four times smaller than it is.

### Is the TMP36 more accurate than the RP2040's built-in temperature sensor?

For air temperature, yes: arduino-pico's analogReadTemp() reads a sensor on the RP2040 die, which warms with the chip itself. The TMP36 sits on its own wire away from the board.

### Which Pico ADC pin should VOUT use?

GP26, GP27 or GP28, the three ADC inputs on the headers (Pico datasheet, p. 3). This page uses GP28; the TMP36's output never comes near the 3.3 V limit of those pins.

## More

- [TMP36 Temperature Sensor reference](https://www.tinkered.ai/components/tmp36.md): pinout, specs, rules and common mistakes

## Try it

Tinkered simulates the TMP36 Temperature Sensor on the Raspberry Pi Pico in the browser, with this wiring and code, free: https://www.tinkered.ai/components/tmp36/raspberry-pi-pico
