NTC Temperature Sensor With Arduino




I am a computer engineer specializing in electronics and infrastructure, always seek to acquire a...

A thermistor is a type of resistor whose resistance is dependent on temperature end have a electric resistance value for each absolute temperature.

Widely used to control temperature in electronics devices such as alarms, thermometers, "clocks", electronic circuit temperature compensation, heat sinks, air conditioning. There are two basic types of thermistors: a PTC thermistor (Positive Temperature coeficient) which substantially increases its electrical resistance with increased temperature, and the thermistor NTC (Negative Temperature coeficient), which substantially lowers its electrical resistance with increased temperature. The thermistor is not electrically polarized. The most common thermistor in electronics store is the NTC type, so I will be using this for the application.

The major problem NTC thermistor is the calibration, that is, to establish a function between electrical resistance and temperature. The variation in its electrical resistance with temperature is non-linear it may be seen as an exponential function according to equation Steinhart-Hart (wiki).

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Explaining the Equation

As the thermistor brings me some information on the data sheet can use the Beta parametter of the Steinhart-Hart equation to get the temperature reading on the sensor.

This can be solved for the temperature:

R (Rout) = read resistance in the sensor
β = defines the temperature differential to calibrate the sensor using the initial temperature and final temperature T1, T2 and their resistances. R∞ = models the exponential function. It seems a little hard, but all the values we need are tabulated only fitting the micro controller to do the calculations and deliver the read temperature. Defining values (temperatures in Celsius C) To calibrate the sensor is used at the temperatures T1 (initial) = 0 ° C, T2 (end) = 100 °, T0 = 25 ° C this and ambient operating temperature, such T1 and T2 temperatures have been set to the environment to be used, since T0 is the thermistor resistance value by default 10Kohm, the RT1 and RT2 of valore are in Datasheat sensor.

Step 2: Assembly, Test and Arduino Code

The code this commented, but follows some observations

The code shows the value of the temperature in Celsius (C) and Fahrenheit (F) put all the calculations are made with the temperature in Kelvin (K). not being recommended to calculate the value in C or F, so in the beginning of the code I insert the K values

TempK the variable returns the value of the temperature in K shortly after calculating. TempC converts K to C

((* TempC 9) / 5 + 32); this code converts C to F

The LCD panel will not be explained because it was just to show the operation of the sensor, if used the common wiring scheme and code.

I hope you can help those in need, these sensors are extremely cheap and simple connection can be used in various applications, accuracy and estimated at 0.2 °.
This and my first instructables excuse some mistakes.

First Time Author Contest 2016

Participated in the
First Time Author Contest 2016

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    11 Discussions


    2 years ago

    Thank you so much for sharing! I was having major problems with my thermistor because I didn't have the proper Arduino code that uses the Steinhart-Hart function. Now it shows a much more reasonable temperature! Still needs calibration, but at least it wasn't 400 degrees F in my apartment.

    3 replies

    Reply 2 years ago

    My only problem is that the code as is makes the output go DOWN in temperature as I increase the temperature on my thermistor. Not sure why.


    Reply 1 year ago

    The follow modification worked for myself and corrected the direction of the values.

    Vout=Vin*((float)(rawtemp)/1024.0); // calc for ntc


    TempK=(beta/log(Rout/Rinf)); // calc for temperature



    Reply 2 years ago

    I swapped RT2 and RT1 so the resistance was higher in T2 than in T1. I should calibrate it but I don't have my multimeter on hand at the moment.


    1 year ago on Step 2

    I was trying to replicate this project but i can't seem to find the similar fileds mentioned in the datasheet here (https://www.digikey.com/product-detail/en/murata-electronics-north-america/NXRT15XH103FA5B030/490-16930-ND/7595837)

    float T1=273.15; // [K] in datasheet 0º C
    float T2=373.15; // [K] in datasheet 100° C
    float RT1=35563; // [ohms] resistence in T1
    float RT2=549; // [ohms] resistence in T2
    float beta=0.0; // initial parameters [K]
    float Rinf=0.0; // initial parameters [ohm]
    float TempK=0.0; // variable output
    float TempC=0.0; // variable output

    1 reply

    Reply 1 year ago

    if the datashit does not come with the calibration table, you have to calibrate manually, on the link I checked that at 25 ° C it has 10k ohm, you need to lower the temperature to 0 ° C and measure the resistance and then rise up to 100 ° 80 °) and measure the resistance, you will have the same basic information in the table, but a little more difficult.


    Question 1 year ago on Step 2

    HI There thanks for sharing,

    Which NTC did you buy? can you provide a name or the link? i wanna buy it from Digikey or RS.


    1 answer

    Answer 1 year ago

    is a B57164K from EPICOS, came in a kit I bought at a store in Brazil, out of business now.. You do not need to use this NTC in specific, you can find any other model and apply the concepts of the temperature equation that should work.

    Teymur Mehtiyev

    2 years ago

    hi, i have problem which is that, code work for ptc not ntc, how can i solve this ? by the way i am not using lcd , i want to see in serial monitor. please help me/


    2 years ago

    Works perfectly. Thanks for sharing.


    3 years ago

    Great info! Thanks for sharing your first instructable :)