Driver
NTC thermistor driver¶
A C++20 driver for any NTC thermistor read through a resistor divider into an ADC input: it turns a raw code into milli-degrees Celsius with integers only.
The driver knows no part. A thermistor is data: a table of resistance and temperature rows, Steinhart-Hart
coefficients, or R25 and B for the beta equation, given in a Curve. The driver reads the divider node through a small
port class you write, finds the thermistor's resistance, and looks the temperature up on the curve. Open and short
circuits, a node outside the
ADC's range and a part outside its rated window are errors with their own names, and every reading carries a bound.
Measures : Temperature from the curve you declare, as milli-degrees Celsius
Interface : A voltage divider into one ADC channel; optionally a GPIO that powers the divider only while it is read
Arithmetic : Integers only: ohms, milli-degrees, millivolts, parts per million; no floating point, no library calls
What you get¶
- Any NTC, no change of code. A part is a
Curve; the driver ships two presets and the way to write your own. See Presets and Configuration. - Three ways to describe a part: a table of any 2 to 256 rows and any spacing, interpolated linearly in ln R,
Steinhart-Hart coefficients, or R25 and B.
tools/ntc_table.pymakes a table from any of them or from a vendor's list. See Conversion. - Faults by name:
OpenCircuit,ShortCircuit,BelowRange,AboveRange,Unstable,CodeOutOfScale. See Troubleshooting. - A bound on every reading from the tolerances you declare and one converter step.
-
Tested without hardware against a model that shares no code with the driver. See Testing and CI.
!!! warning "Not verified on hardware" The driver is host-tested against a model of the divider and fuzzed; it has not been run on a thermistor. The example preset (a TDK part) takes R25, B and the tolerances from the vendor's Rev.3 datasheet; its 39 table rows are a secondary listing, unverified because that sheet prints no table. Nothing generic depends on it. See Status and limitations.
Datasheet¶
| Document | Revision | Get it |
|---|---|---|
| Reference: Beta equation, Steinhart-Hart equation and the voltage divider (Public references n/a) | n/a, n/a | vendor page |
| Datasheet: Chip NTC Thermistor, NTCG series, NTCG163JF103FT1S (datasheet) (TDK none printed) | Rev.3, May 8, 2023 | PDF ยท vendor page |
Written against these revisions; the SHA-256 of each file is in docs/datasheets.yml. Where each part
of the driver is in the datasheet: Datasheet map.