Documentation ¶
Overview ¶
Package thermistor is for temperature sensing using a thermistor such as the NTC 3950.
Datasheet: https://www.farnell.com/datasheets/33552.pdf
This code is an interpretation of Adafruit Thermistor module in Python: https://github.com/adafruit/Adafruit_CircuitPython_Thermistor
It uses the Steinhart–Hart equation to calculate the temperature based on the resistance: https://en.wikipedia.org/wiki/Steinhart%E2%80%93Hart_equation
To use with other thermistors adjust the BCoefficient and NominalTemperature values to match the specific thermistor you wish to use.
sensor.NominalTemperature = 25 sensor.BCoefficient = 3950
Set the SeriesResistor and NominalResistance based on the microcontroller voltage and circuit that you have in use. Set HighSide based on if the thermistor is connected from the ADC pin to the powered side (true) or to ground (false).
sensor.SeriesResistor = 10000 sensor.NominalResistance = 10000 sensor.HighSide = true
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct { SeriesResistor uint32 NominalResistance uint32 NominalTemperature uint32 BCoefficient uint32 HighSide bool // contains filtered or unexported fields }
Device holds the ADC pin and the needed settings for calculating the temperature based on the resistance.
func (*Device) Configure ¶
func (d *Device) Configure()
Configure configures the ADC pin used for the thermistor.
func (*Device) ReadTemperature ¶
ReadTemperature returns the temperature in celsius milli degrees (ºC/1000)