Arduino with Thermistor: Learn How to measure temperature using an Arduino with an NTC thermistor. How to get readings using the Steinhart-Hart equation for Maximum Accuracy

Using an Arduino with thermistor is one of the cheapest ways you can measure temperature. All you need is a 10k thermistor (and a 10k resistor), and a microcontroller capable of reading an analogue voltage i.e. Any Arduino.

While they don't give the best accuracy (dependent on your circuit layout and curve fitting algorithm) you can get close to ±1°C or better, they are easy to setup for a good-enough reading and they do have good sensitivity and repeatability. They are widely used for devices such as 3dprinter hot end and bed temperature control and many other applications that require fairly good temperature control.

Note: Typical thermistors measure from -55°C ~ 150°C (consult your datasheet for exact figures). For a glass body thermistor ~300°C, some standard ones operate to 200°C.

Other chips that provide a defined accuracy are LM35 and DS18B20 (there are lots more).

Common thermistors are NTC types (Negative Temperature Coefficient) meaning that their resistance decreases as temperature increases (you can get PTC ones but they are less common - typically used as inrush current limiters).

The idea is that you want to measure the resistance of the thermistor but microcontrollers can only measure voltage (using the ADC). So, to turn the resistance into a voltage, that changes as the thermistor resistance changes, you use a voltage divider using a 10k resistor in series with the thermistor.

You read the center voltage of the voltage divider using your ADC.

Components: Arduino with Thermistor

  • Arduino (Uno, Nano, etc.).

  • 10kOhm NTC Thermistor.

  • Breadboard.

  • Jumper wires.

  • Resistor (10k Ohm recommended for most thermistors.

  • Capacitor (100nF).

Connections: Arduino with Thermistor

Using a solderless breadboard to place the components:

  1. Connect one leg of the thermistor to the A0 pin on your Arduino.  Connect the other leg of the Thermistor to ground.

  2. Connect one side of a 10k resistor to A0. Connect the other side of the 10k to 5V.

  3. Connect one leg of a 100nF capacitor to A0. Connect the other side of the capacitor to ground.

This creates a voltage divider so the Arduino can read the thermistor's changing resistance as a voltage value.

arduino with thermistor connection diagram
Created with Fritzing.

Example Sketch: for Arduino with Thermistor

Click in the code below to copy it to the clipboard.

// Copyright John Main:
// Free for use in non-commercial projects.


// Thermistor parameters
#define BETA 3950
#define R25 10000

void setup() {
  // Initialize serial port

void loop() {

  // Read thermistor voltage
  int reading = analogRead(THERMISTORPIN);

  // Convert voltage to resistance
  float resistance = thermistorResistance(reading);

  // Calculate temperature from resistance
  float temperature = thermistorTemperature(resistance);

  // Output temperature over serial
  Serial.print("THERMISTOR Temperature: ");


// Converts arduino analog reading to resistance
float thermistorResistance(int reading) {
  float ratio = (float)reading/1024.0;
  float resistance = 10000 * ratio/ (1-ratio);
  return resistance;

// Convert resistance to temperature using Steinhart-Hart equation
float thermistorTemperature(float R) {
  float T25 = 25+273.15; // Convert to Kelvin
  float T =  1 / ((1 / T25) + ((log(R / R25)) / BETA));
  float Tc = T - 273.15; // Converting kelvin to celsius
  return Tc;


This uses the thermistor's Steinhart–Hart equation to calculate temperature from its resistance.

Bonus Exclusive Content

One way of deciding if a thermistor is the correct part for your project is to compare the output to a known device. The following sketch shows you how to get the value of a DS18B20 as well as a thermistor, and display that on an SSD1306 I2C display.

arduino with thermistor ds18b20 ssd1306 connection diagram
Created with Fritzing.

With my setup the values track to within 1°C, and sometimes to 0.3°C for temperatures around room temperature. This allows you to see how well a thermistor performs in real life. One thing you should do is allow the DS18B20 to warm up for a while to get best results.

New connections:

The I2C connections are :
    A5 connects to SDA, (orange)
    A4 connects to SCL on the SSD1306. (white)

From the left the SSD2306 connections are GND, V8uCC, SCL, and SDA. Note you can get away without I2C pullups as the pins have internal pullups. For more devices attached to the I2C bus you may need external pullups.

The DS18B20 connects the data line to Arduino pin 4 for the 1-wire interface with a 1k pullup on that line.

You can set the DS18B20 pin and sample rate in the code currently set to 5 seconds.

Download the zip file for the above layout in this link


Steinhart Equation

The Steinhart-Hart equation models the relationship between temperature and resistance for thermistors. It expresses temperature T in kelvins as a function of the thermistor's resistance R in ohms. The equation takes the form of 1/T = A + B*ln(R) + C*(ln(R))^3, where A, B, and C are thermistor constants that are specific to each type of thermistor and are obtained through calibration. The Steinhart-Hart equation provides a precise mathematical formula to convert a thermistor's resistance reading into an accurate temperature measurement.

In most practical implementations the parameter C is often ignored. There are a few key reasons for this:

- Simplification - Ignoring C results in a simpler linearised equation that is easier to implement versus the full cubic equation providing reasonable accuracy for most applications.

- Accuracy tradeoff - Including C provides marginally better accuracy, but the improvement is small relative to the added complexity of implementing the cubic terms.

- Parameter fitting - It can be more difficult to accurately determine the value of C.

- Temperature range - The contribution of C becomes more significant at very high or low temperatures far outside the typical operating range of 0-100°C for most thermistors. Within this range the linear approximation is adequate.

While technically ignoring C results in a small loss of accuracy, the simplification is well worth it for most use cases that don't require laboratory-grade precision. In practice, A and B alone provide temperature measurements with an acceptable error margin.

For the equation used in the code A is 1/T25 and B is 1/BETA.

More details on thermistors

What is the Beta value?

On the documentation with the thermistors I bought we have:

NTC thermistor Temperature Sensor
5%/1% MF52A 3950K
3pcs 1% 10k

The MF52A is the thermistor type and the value 3950K is the Beta coefficient (or temperature sensitivity).  Beta values range from 2000 to 5000K and you must use the one that is specified for your thermistor to get accurate results (put the number into the code).

The Beta value indicates the steepness of the response

thermistor BETA graph+
[source NTC thermistors, general technical information (]

When you use the equation for calculating the resistance value you will be asked for the resistance at a set temperature on the datasheet this is the quoted resistance e.g for the above one it is 10k (the temperature is usually specified as 25°C).

Some key properties of the beta value:

  • It is specific to the type/composition of thermistor material
  • The standard beta value commonly used for thermistors is ~3950K
  • A higher beta value means a steeper slope in the resistance-temperature curve i.e. quicker reacting - but can be less accurate.
  • It must be precisely determined through sensor calibration for accurate temperature measurement

Reaction Speed: Arduino with thermistor

The reaction speed of a thermistor depends on several factors, but in general:
  • NTC thermistors react more quickly than PTC varieties. NTCs are most commonly used for temperature sensing applications.

  • Smaller thermistor bead size correlates to faster response time. Beads under 1mm react within seconds to temperature changes.

  • The thermistor's heat capacitance impacts response - larger/heavier beads store more heat and react more slowly than smaller beads.

  • Surrounding materials like insulating coatings or thermal paste can help conduct heat away from/to the bead quicker, speeding up reaction. Good thermal contact is ideal.

  • Higher beta/B value thermistors (more resistance change per degree) tend to react faster than lower B value types. But high B also means lower accuracy.

  • Most typical thermistors used with Arduino settle to within 0.5-1°C of the ambient temperature within 2-5 seconds under normal conditions.

Comparison of Thermistor vs LM35 vs DS18B20

Temperature Range

  • LM35: Range of -55°C to +150°C.
  • DS18B20 Range of -55°C to +125°C.
  • Thermistor: Range is dependent on the probe type and is typically between -50°C and 300°C⁵⁶⁷. However, the working temperature range for typical thermistors is between -50°C ~ 150°C (consult your datasheet for exact figures).


  • LM35: ±1°C max error (over complete temperature range).
  • DS18B20: ±0.5°C error typical (over complete temperature range), very accurate.
  • Thermistor: Accuracy depends on component and calibration, typically ±1°C ~ ±2°C error.


  • LM35: Outputs voltage linearly proportional to Celsius, 10mV/°C, resolution limited by ADC - this means it is noise free and simple to read using an standard Arduino ADC.
  • DS18B20: 12-bit resolution, 0.0625°C increments
  • Thermistor: Effective resolution depends on component and circuit, typically 0.1-1°C

Response Time:

  • LM35: Response time 5-10 seconds typical (TO-92) but for a metal can type (TO-46) it is 3 seconds.
  • DS18B20: Response time 750mS typical No thermal response time is specified!
  • Thermistor: 2-5 seconds typical for small beads.


  • LM35: Low cost, ~$1-2 each.
  • DS18B20: Moderate cost, ~$3-5 each due to digital interface.
  • Thermistor: Very low cost, <$1 for basic components.


  • LM35: Analog output, simple to use.
  • DS18B20: Digital 1-Wire protocol, microcontroller only.
  • Thermistor: Analog output, requires voltage divider/calculations.

There is a trade off between cost and accuracy with thermistors being the cheapest.

Written by John Main who has a degree in Electronic Engineering.

Note: Parts of this page were written using claude-instant as a research assistant.


Have your say about what you just read! Leave me a comment in the box below.

Don’t see the comments box? Log in to your Facebook account, give Facebook consent, then return to this page and refresh it.

Privacy Policy | Contact | About Me

Site Map | Terms of Use