resistance_to_temp

 avatar
unknown
plain_text
5 months ago
395 B
3
Indexable
def resistance_to_temp(resistance):
    """Convert resistance to temperature using the Steinhart-Hart equation."""
    # Steinhart-Hart coefficients
    A = 1.129241e-3
    B = 2.341077e-4
    C = 8.775468e-8

    log_r = np.log(resistance)
    temp_kelvin = 1 / (A + B * log_r + C * log_r**3)

    # Convert from Kelvin to Celsius
    temp_celsius = temp_kelvin - 273.15
    return temp_celsius
Editor is loading...
Leave a Comment