NTC Thermistor Driver
API reference
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
ntc_conversion.hpp File Reference

Mathematical conversion functions for NTC thermistor temperature. More...

#include <cmath>
#include <cstdint>
Include dependency graph for ntc_conversion.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  NTC
 
namespace  NTC::Constants
 

Functions

bool NTC::ConvertResistanceToTemperatureBeta (float resistance_ohms, float resistance_at_25c, float beta_value, float *temperature_celsius) noexcept
 Convert resistance to temperature using beta parameter.
 
bool NTC::ConvertTemperatureToResistanceBeta (float temperature_celsius, float resistance_at_25c, float beta_value, float *resistance_ohms) noexcept
 Convert temperature to resistance using beta parameter.
 
bool NTC::ConvertResistanceToTemperatureSteinhartHart (float resistance_ohms, float coeff_a, float coeff_b, float coeff_c, float *temperature_celsius) noexcept
 Convert resistance to temperature using Steinhart-Hart equation.
 
bool NTC::ConvertTemperatureToResistanceSteinhartHart (float temperature_celsius, float coeff_a, float coeff_b, float coeff_c, float *resistance_ohms) noexcept
 Convert temperature to resistance using Steinhart-Hart equation.
 
bool NTC::ConvertResistanceToTemperatureDefault (float resistance_ohms, float *temperature_celsius) noexcept
 Convert resistance to temperature using default Steinhart-Hart coefficients.
 
bool NTC::ConvertTemperatureToResistanceDefault (float temperature_celsius, float *resistance_ohms) noexcept
 Convert temperature to resistance using default Steinhart-Hart coefficients.
 
bool NTC::CalculateThermistorResistance (float voltage_thermistor, float reference_voltage, float series_resistance, float *resistance_ohms) noexcept
 Calculate thermistor resistance from voltage divider.
 
bool NTC::CalculateThermistorVoltage (float resistance_ohms, float reference_voltage, float series_resistance, float *voltage_thermistor) noexcept
 Calculate voltage across thermistor from resistance.
 
bool NTC::CalculateVoltageDividerRatio (float resistance_ohms, float series_resistance, float *ratio) noexcept
 Calculate voltage divider ratio.
 
bool NTC::ValidateResistance (float resistance_ohms, float min_resistance, float max_resistance) noexcept
 Validate resistance value.
 
bool NTC::ValidateTemperature (float temperature_celsius, float min_temperature, float max_temperature) noexcept
 Validate temperature value.
 
bool NTC::ValidateVoltage (float voltage_volts, float min_voltage, float max_voltage) noexcept
 Validate voltage value.
 
bool NTC::ValidateBetaValue (float beta_value) noexcept
 Validate beta value.
 
bool NTC::ValidateSteinhartHartCoefficients (float coeff_a, float coeff_b, float coeff_c) noexcept
 Validate Steinhart-Hart coefficients.
 
bool NTC::CalculateBetaValue (float temp1_celsius, float resistance1_ohms, float temp2_celsius, float resistance2_ohms, float *beta_value) noexcept
 Calculate beta value from two temperature-resistance pairs.
 
bool NTC::CalculateSteinhartHartCoefficients (float temp1_celsius, float resistance1_ohms, float temp2_celsius, float resistance2_ohms, float temp3_celsius, float resistance3_ohms, float *coeff_a, float *coeff_b, float *coeff_c) noexcept
 Calculate Steinhart-Hart coefficients from three temperature-resistance pairs.
 
bool NTC::CalculateTemperatureAccuracy (float resistance_ohms, float resistance_at_25c, float beta_value, float resistance_tolerance, float beta_tolerance, float *accuracy_celsius) noexcept
 Worst-case temperature error from the R25 and B tolerances.
 
bool NTC::CalculateTemperatureAccuracy (float resistance_ohms, float resistance_tolerance, float beta_tolerance, float *accuracy_celsius) noexcept
 Temperature error estimate for the default part (R25 = 10 kOhm, B = 3435 K)
 
bool NTC::CalculateOptimalSeriesResistance (float thermistor_resistance_at_25c, float beta_value, float min_temperature, float max_temperature, float *optimal_resistance) noexcept
 Calculate optimal series resistance for voltage divider.
 
bool NTC::CalculateOptimalSeriesResistance (float thermistor_resistance_at_25c, float min_temperature, float max_temperature, float *optimal_resistance) noexcept
 Optimal series resistance assuming B = 3435 K.
 

Variables

constexpr float NTC::Constants::ABSOLUTE_ZERO_CELSIUS_ = -273.15F
 Absolute zero in Celsius.
 
constexpr float NTC::Constants::KELVIN_OFFSET_
 Celsius to Kelvin conversion offset.
 
constexpr float NTC::Constants::REFERENCE_TEMPERATURE_C_
 Reference temperature (25°C)
 
constexpr float NTC::Constants::STEINHART_HART_A_
 Steinhart-Hart coefficient A (1/K)
 
constexpr float NTC::Constants::STEINHART_HART_B_
 Steinhart-Hart coefficient B (1/K)
 
constexpr float NTC::Constants::STEINHART_HART_C_
 Steinhart-Hart coefficient C (1/K)
 
constexpr float NTC::Constants::MIN_RESISTANCE_OHMS_
 Minimum valid resistance (ohms)
 
constexpr float NTC::Constants::MAX_RESISTANCE_OHMS_
 Maximum valid resistance (ohms)
 
constexpr float NTC::Constants::MIN_TEMPERATURE_CELSIUS_
 Minimum valid temperature (°C)
 
constexpr float NTC::Constants::MAX_TEMPERATURE_CELSIUS_
 Maximum valid temperature (°C)
 
constexpr float NTC::Constants::MIN_BETA_VALUE_ = 1000.0F
 Minimum valid beta value (K)
 
constexpr float NTC::Constants::MAX_BETA_VALUE_ = 5000.0F
 Maximum valid beta value (K)
 
constexpr float NTC::Constants::EPSILON_FLOAT_ = 1e-6F
 Float comparison epsilon.
 
constexpr float NTC::Constants::EPSILON_DOUBLE_ = 1e-12F
 Double precision epsilon.
 
constexpr float NTC::Constants::ONE_FLOAT_ = 1.0F
 One as float.
 
constexpr float NTC::Constants::ZERO_FLOAT_ = 0.0F
 Zero as float.
 
constexpr uint32_t NTC::Constants::MILLISECONDS_PER_SECOND_
 Milliseconds per second.
 
constexpr float NTC::Constants::CELSIUS_TO_FAHRENHEIT_MULTIPLIER_
 Celsius to Fahrenheit multiplier.
 
constexpr float NTC::Constants::FAHRENHEIT_OFFSET_ = 32.0F
 Fahrenheit offset.
 
constexpr float NTC::Constants::FAHRENHEIT_TO_CELSIUS_MULTIPLIER_
 Fahrenheit to Celsius multiplier.
 

Detailed Description

Mathematical conversion functions for NTC thermistor temperature.