- # TX08F103F3435ER circuit python analog temperature from thermistor 10K.
- import time
- import board
- import analogio
- def steinhart_temperature_C(r, Ro=10000.0, To=25.0, beta=3435.0): # mine 3435 K
- import math
- steinhart = math.log(r / Ro) / beta # log(R/Ro) / beta
- steinhart += 1.0 / (To + 273.15) # log(R/Ro) / beta + 1/To
- steinhart = (1.0 / steinhart) - 273.15 # Invert, convert to C
- return steinhart
- print("adafruit thermistor")
- thermistor = analogio.AnalogIn(board.GP26)
- while True:
- print("thermistor.value", thermistor.value)
- R = 10000 / (65535/thermistor.value - 1)
- print('Thermistor resistance: {} ohms'.format(R))
- steinHartC = steinhart_temperature_C(R)
- print("steinHartC",steinHartC)
- print("Temperature F:", steinHartC * 1.8 + 32)
- time.sleep(2)
Thermistor
Posted by Anonymous on Mon 27th Jun 2022 17:11
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.