NTC_temperature_sensor Library

NTC_temperature_sensor Basic library for all microcontrollers and board that reads a NTC thermistor from an analog pin. that Provides a NTC temperature sensor reading in Celsius, Fahrenheit.

Connect to the any analog (ADC)  Pin of a Microcontroller at 1st pin thermistor ,  and the 2nd pin of thermistor at VCC, then a pull-down resistor (R0)  from (ADC or 1st pin thermistor ) into ground. Now we are ready to measure the temperature. In this equation (R0) is  pull-down value (10k) and (R1) is  thermistor value (10k).

In this library Calculations relies on Steinhart–Hart equation:


How to define ADC pin in MikroStudio for NTC_temperature_sensor library.
/*value 10k but resistance by multimeter = 7300 (it is auto changing by temperature or environment) */
#define NTC_PIN 2                  /* ADC Channel 2 */           
#define B_coefficient 2891.40      /* B coefficient of NTC Thermistor*/
#define Ref_temperature 25.00      /*Adjust this value for prefect result, ref value less then Current temperature °C*/
#define Series_Resistance 10000.00 /* Series_Resistance 10k */ 
Following functions can be used by this library.
void Init_NTC_temp()              // for initializing from HW_INI()
float NTC_temp_read(bool F_or_C)  // for reading temperature deg_C = 1 | deg_F = 0
1. float temp1 = NTC_temp_read(deg_C); // for reading temperature in °C (Celsius)
2. float temp2 = NTC_temp_read(deg_F); // for reading temperature in °F (Fahrenheit)
Basic circuit.
NTC temperature sensor library
Thermistor circuit
Author: Admin

Leave a Reply