Projects / Pico chip temperature logger

Pico chip temperature logger

Beginner1.7 hGuided buildReviewed

Build it step by step

0 of 6 done
  1. PICO

    Plug in the Pico

    Open Thonny.

  2. PICO

    Paste the program

    Save it as main.py on the Pico.

  3. PICO

    Run it

    A line prints each second.

  4. PICO

    Rest a warm fingertip on the chip

    The value rises.

  5. PICO

    Remove your finger

    It falls back.

  6. PICO

    Compare with a room thermometer

    Note the difference.

In short

How do you build a pico chip temperature logger?

A Pico reads its own internal temperature sensor with the ADC and prints a line each second, so you can watch the chip warm up under your fingertip. You need Raspberry Pi Pico H and Breadboard 830 Tie Points. It takes 6 steps and about 100 minutes.

Level
Beginner
Time
About 100 min
Parts
2

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Pico USB socketComputer USB portPower and the serial printout
No other wiringThe sensor is inside the chipNothing to connect

Code

The RP2040 chip has a temperature sensor built in. It is a diode whose voltage falls by about 1.7 millivolts for every degree the chip warms, and it is wired to the fifth ADC input. The program reads that input, averages sixteen reads, turns the count into volts and applies the formula from the chip datasheet: 27 degrees minus the voltage above 0.706 volts divided by 0.001721. The result is the temperature of the chip and not of the room, so it sits above room temperature, and it rises when the processor works hard or when you rest a warm fingertip on it. The sensor is not calibrated, so absolute values can be a few degrees out, and the reading is indicative only. It is useful for watching trends and for learning how an ADC turns a voltage into a number, which is the same job as for any outside sensor.

import time
from machine import ADC

sensor = ADC(4)                                  # channel 4 is the on-chip temperature sensor
CONVERSION = 3.3 / 65535                         # 16-bit reading to volts

def read_celsius():
    total = 0
    for _ in range(16):
        total += sensor.read_u16()               # average 16 reads to calm the noise
    volts = (total / 16) * CONVERSION
    return 27 - (volts - 0.706) / 0.001721       # formula from the RP2040 datasheet

while True:
    print("Chip temperature: {:.1f} C".format(read_celsius()))
    time.sleep(1)

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Idle at your deskA few degrees above the room
Fingertip on the chipReading rises
Finger removedReading falls over a minute
AveragingReadings change smoothly
OutputOne line per second

If it does not work

Nothing prints

Run the program from Thonny and look at the shell.

Reading is far from the room temperature

The chip runs warmer, and the sensor is uncalibrated.

NameError

Check the import line for ADC.

Value jumps about

Keep the Pico away from drafts and use the averaging.

Program does not start on power-up

Save it on the Pico as main.py.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the pico chip temperature logger?

Raspberry Pi Pico H and Breadboard 830 Tie Points.

How long does the pico chip temperature logger take to build?

About 100 minutes for a beginner maker, in 6 steps.

How do I know the pico chip temperature logger works?

Idle at your desk: A few degrees above the room. Fingertip on the chip: Reading rises. Finger removed: Reading falls over a minute.

Nothing prints: what should I check?

Run the program from Thonny and look at the shell.

Reading is far from the room temperature: what should I check?

The chip runs warmer, and the sensor is uncalibrated.

NameError: what should I check?

Check the import line for ADC.

Value jumps about: what should I check?

Keep the Pico away from drafts and use the averaging.