Let´s see the code that can be use OPEN-SMART NTC Thermistor with module. This module contains resistor that should be between VCC nad SIG connectors.
Datasheet that is linked to This termistor and module (important values are highlighted):

  • Working voltage: 2.2 ~ 12VDC
  • Working current: 0.5mA (max)
  • Measuring range: -30 ~ 120 ℃
  • Measuring Accuracy: ±2% (4 ℃ ~ 50 ℃), ±3% (-15 ℃ ~ 80 ℃)
  • B value: 3950 K
  • R25: 10K ohm
  • Sampling resistor parameters: 10k ohm, 0.1%, 10ppm
  • Sensor connector: XH2.54-2P
  • Lead length: 1m
  • Adapter output connector: standard electronic brick interface, 2.54mm-3P header
  • Great for Arduino, MCU project

We must define few values, you can change just THERMISTORPIN depend of your circuit:
// PIN OF SIGNAL
#define THERMISTORPIN A0
// resistance of termistor at 25 degrees C
#define THERMISTORNOMINAL 10000
#define TEMPERATURENOMINAL 25
// Accuracy - Higher number is bigger
#define NUMSAMPLES 10
// Beta coefficient from datasheet
#define BCOEFFICIENT 3950
// the value of the R1 resistor
#define SERIESRESISTOR 10000
//prepare pole
uint16_t samples[NUMSAMPLES];

Setup void contains just console extension
void setup(void) {
Serial.begin(9600);
}

Rest of code calculate temperature from average resistance
void loop(void) {
uint8_t i;
float average;
// saving values from input to pole
for (i=0; i< NUMSAMPLES; i++) {
samples[i] = analogRead(THERMISTORPIN);
delay(10);
}
// average value of input
average = 0;
for (i=0; i< NUMSAMPLES; i++) {
average += samples[i];
}
average /= NUMSAMPLES;
//resistance
average = 1023 / average - 1;
average = SERIESRESISTOR / average;
//resistence to temperature
float temperature;
temperature = average / THERMISTORNOMINAL;
temperature = log(temperature);
temperature /= BCOEFFICIENT;
temperature += 1.0 / (TEMPERATURENOMINAL + 273.15);
temperature = 1.0 / temperature;
temperature -= 273.15; // convert to C
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println("°C");
delay(2000);
}

Download sketch
OPEN-SMART_NTC_Thermistor_with_Adapter_Module_K6

 

%d bloggers like this: