Skip to content

The Built-in Temperature Sensor

Beginning of the lesson

The Built-in Temperature Sensor

Here is a surprise that delights almost every beginner: your Raspberry Pi Pico can already tell you how warm it is without you wiring up a single extra component. Hidden inside the RP2040 chip is a tiny temperature sensor, quietly built into the silicon at the factory. You just have to know how to ask it.

In this lesson you will read that sensor, turn the raw number it gives back into a real temperature in degrees Celsius, understand exactly why the magic conversion formula looks the way it does, and then build a working serial thermometer that prints the temperature every second. Along the way you will learn where this sensor is genuinely useful and where it will happily lie to you by a few degrees.

What you will learn
  • What the RP2040 internal temperature sensor is and the physics of why it works.
  • That it lives on a special hidden ADC channel, channel 4, and how to open it with ADC(4).
  • How read_u16() gives a number from 0 to 65535, and how to turn that into a voltage.
  • The famous conversion formula 27 - (voltage - 0.706)/0.001721, explained term by term with real numbers.
  • How accurate it really is: that it measures the chip's temperature, drifts with chip activity, and is only good to a few degrees.
  • How to build a serial thermometer with clean rounding, units, and a Celsius-to-Fahrenheit conversion.
  • How to log a series of readings over time into a Python list.
  • How to troubleshoot readings that are too high, and how to calm down noisy, jumpy values by averaging.

1. A thermometer baked into the chip

Most sensors are separate parts you buy and wire up: a light sensor, a distance sensor, a humidity sensor. The temperature sensor we use in this lesson is different — it is already inside the RP2040, the main chip on your Pico. Nothing to buy, nothing to plug in, no breadboard. It is there the moment you power the board on.

Continue this lesson on YourAIZone

The full lesson has the complete explanation, worked examples, common mistakes, tests with instant checking and an AI tutor. Start right away as a guest, or create an account to keep your progress.

In the full lesson

  • The complete explanation
  • Worked examples
  • Common mistakes and how to avoid them
  • Test questions: 15
  • AI tutor that answers questions about the topic
  • Progress tracking for students, parents and teachers