Author Topic: NTC Thermistor Demo  (Read 445 times)

AndrewPratt

  • Newbie
  • *
  • Posts: 9
  • Location: Winnipeg, MB
    • View Profile
Re: NTC Thermistor Demo
« on: December 11, 2017, 04:23:01 pm »
So when I measure the 0 and 6 pin's and measure the voltage as I dip the probe in hot and cold water it does change as you'd expect it would.

This is the tempprobe code that I added to the project...

Class NTCTermistor
    Private beta As Integer
    Private R25 As Integer
    Public Sub New(betaIn As Integer, R25In As Integer)
        'set Beta value
        beta = betaIn
        'Set R25 resistance value
        R25 = R25In
    End Sub
    Public Function TemperatureFromResistance(resistance As Float) As Float
        'returns temperature in Kelvin from resistance of thermistor using Beta parameter equation
        Dim temp1 As Float = -1 * beta.ToFloat() / 298.15
        Dim temp2 As Float = resistance / (R25.ToFloat() * temp1.Exp())
        Return (beta / temp2.Log())
    End Function
    Public Function TemperatureFFromResistance(resistance As Float) As Float
        'returns temperature in Fahrenheit from resistance of thermistor
        Return (TemperatureFromResistance(resistance) * (9 / 5)) - 459.67
    End Function
    Public Function TemperatureCFromResistance(resistance As Float) As Float
        'returns temperature in Celcuis from resistance of thermistor
        Return TemperatureFromResistance(resistance) - 273.15
    End Function
End Class