Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1285

Python • TemperatureSensor class in picozero library reads high?

$
0
0
I've installed picozero into Thonny for a Pico W.

The temperature sensor value is accessed as

Code:

temperature = pico_temp_sensor.temp
The value returned for temperature is around 33 at room temperature (23 C).

The picozero libarary includes a conversion routine:

Code:

def pico_temp_conversion(voltage):    # Formula for calculating temp from voltage for the onboard temperature sensor    return 27 - (voltage - 0.706)/0.001721
It is instantiated in the picozero library as

Code:

pico_temp_sensor = TemperatureSensor(4, True, 0.5, pico_temp_conversion)
I'm trying to understand why the temperature sensor is returning this value that seems high. Is the sensor an "on-chip" temperature that is normally about 10 degrees higher than ambient?

Statistics: Posted by timg11 — Wed Dec 27, 2023 4:42 pm



Viewing all articles
Browse latest Browse all 1285

Trending Articles