Introduction: NTC Temperature Sensor With Arduino
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).
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.
Attachments

Participated in the
First Time Author Contest 2016
14 Comments
2 years ago
Hi Thanks sharing this tutorial it helps me a lot, @wellinton31.
I hope you can answer my doubt, where did you find Rinf and Beta equations? or how did you find those variables?
Reply 2 years ago
I use β parameter equation, maybe this link can help you, https://en.m.wikipedia.org/wiki/Thermistor
The thermistor who i bought came it a reference code and your manufactur so i can find your data sheet and get the temperature variables. Whoever if you don't need much precision in your temperatures reading, is possible use the same parameters i use if you have a a 10kohm ntc
Reply 2 years ago
Many thanks for your answer, I was able to calibrate the termistor that I used, in my case I used the SB59 NTC.
You explain was great and the equation that you shared, but I have the big doubt about how were you able to get "Beta (β)" equation.
T equation is clear, also Rinf equation but, β nop I can't got it
Wiki shows this:
6 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.
Reply 6 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 5 years ago
The follow modification worked for myself and corrected the direction of the values.
Vout=Vin*((float)(rawtemp)/1024.0); // calc for ntc
Rout=(Rt*Vout*(Vin-Vout));
TempK=(beta/log(Rout/Rinf)); // calc for temperature
TempC=TempK-273.15;
Reply 6 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.
5 years 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
Reply 5 years 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 5 years 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.
Thanks
Answer 5 years 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.
5 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/
6 years ago
Works perfectly. Thanks for sharing.
7 years ago
Great info! Thanks for sharing your first instructable :)