From c8a19047b10481f52a0e9ebc9c378b5a2dc27175 Mon Sep 17 00:00:00 2001 From: Frank Wiebenga Date: Tue, 26 Jan 2021 12:56:38 -0600 Subject: [PATCH] Update temperature.py Add some comments from the RP2040 datasheet that helps new users understand where the constant number values came from. --- adc/temperature.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/adc/temperature.py b/adc/temperature.py index a62a23a..77b78ea 100644 --- a/adc/temperature.py +++ b/adc/temperature.py @@ -7,6 +7,8 @@ conversion_factor = 3.3 / (65535) while True: reading = sensor_temp.read_u16() * conversion_factor + # The temperature sensor measures the Vbe voltage of a biased bipolar diode, connected to the fifth ADC channel + # Typically, Vbe = 0.706V at 27 degrees C, with a slope of -1.721mV (0.001721) per degree. temperature = 27 - (reading - 0.706)/0.001721 print(temperature) utime.sleep(2)