Arduino Digital Temperature Sensor

In this tutorial you will learn how to connect Arduino with digital temperature sensor, what is Elegoo Sensor Module, and how to create Arduino based digital thermometer.

What is NTC Thermistor?

An NTC thermistor is a type of resistor that changes its resistance with temperature. It is used in temperature sensors, and is often used in conjunction with a digital temperature sensor.


The NTC thermistor has a negative temperature coefficient, meaning that the resistance decreases as the temperature increases. This means that when the NTC thermistor is heated up, it will have less resistance and more current will flow through it. Typical applications for NTC thermistors are in a temperature sensor, the control circuit for a refrigerator or heating element, or the control circuit for an oven. It’s used as a sensing element to provide it to the controller to regulate the temperature.

NTC voltage divider

The basic circuit for temperature measurement is a voltage divider. The resulting voltage can be connected directly to the Arduino analog port of the Arduino as shown below:dasd

The circuit consists of two resistors, one with a fixed value and the other with a variable value. The variable resistor is called the thermistor and it has a resistance that changes depending on the temperature. When the temperature changes, its resistance changes, which results in changing the voltage at the Analog pin A0.

NTC voltage divider
NTC voltage divider

Elegoo Digital Temperature Sensor

 The Elegoo Temperature sensor module uses an NTC thermistor.

Elegoo Digital Temperature Sensor Pinout
Elegoo Digital Temperature Sensor Pinout

Its output signal A0 provides an analog voltage corresponding the temperature value. Its output signal at D0 switches high when the preset (adjustable by the blue trimmer) temperature is reached.

 Elegoo Digital Temperature Sensor pin Configuration

  • Pin DO: Digital output
  • Pin +: Vcc (3.3V or 5V)
  • Pin G: GND
  • Pin AO: Analog output

How to Connect Arduino with Elegoo temperature sensor module ?

Connecting Arduino with elegoo temperature sensor is by connecting pin Vcc to5V on Arduino, G toGND, and AO to A0 or other Arduino’s analog ports.

Elegoo temperature sensor module with Arduino
Elegoo temperature sensor module with Arduino

Arduino based digital temperature sensor

There is many types of temperature sensors we can use with Arduino such as this tutorial LM35 or this DHT11 sensor. Anyway, in this tutorial we are going to show you some more details about NTC thermistor and their calculations.

What is Steinhart–Hart Equation

Steinhart-Hart Equation is mathematical expression for resistance temperature relationship of NTC thermistors and NTC prob. The equation is:

Steinhart-Hart Equation
Steinhart-Hart Equation. Source:

Where T corresponds to temperature in degrees Kelvin, and the coefficients A, B, and C are as follows:

First, measure the thermistor at three different temperatures. The temperatures should be evenly spaced at least 10 degrees apart. Use the three temperatures to solve these equations using these steps:

  • Use the three temperatures to solve these equations using these steps:
Steinhart-Hart Equations parameters
Steinhart-Hart Equations parameters. Source:
  • Then solving the coefficients of Steinhart-Hart Equation as follows. Knowing A, B and C for a thermistor allows you to use the Steinhart and Hart equation in Equation 1 above.
Solving Steinhart-Hart Equation coefficients
Solving Steinhart-Hart Equation coefficients. Source:
  • We have cited the above equation just for your reference. Now, it’s time for practical implementation.

Arduino thermistor code

The Arduino sketch below reads the NTC value (output signal A0of Temperature Sensor Module). And converts the ADC value to temperature according to Steinhart-Hart Equation, and finally prints out the results on the serial monitor.

#define NTC_PIN A0
#define SERIES_RES 10000
#define NOMINAL_RES 10000
#define NOMINAL_TEMP 25
#define BCOEFFICIENT 3950

void setup()
void loop()
  float valAdc, res, steinhartTemp;
  // Read ADC value
  valAdc = analogRead(NTC_PIN);
  // convert value to resistance
  res = SERIES_RES /((1023 / valAdc) - 1);

  steinhartTemp =  (1.0 / ((log(res / NOMINAL_RES)/BCOEFFICIENT) + 1.0 / (NOMINAL_TEMP + 273.15))) - 273.15;
  Serial.print("Resistance in Ohm = ");
  Serial.print("Temperature in °C = ");

Do you want to learn more about sensors? Check out these articles below:

Interfacing HC-SR04 Ultrasonic Sensor With Arduino

Interfacing Force Sensing Resistor (FSR) with Arduino

Interfacing TTP223B Capacitive Touch Sensor with Arduino

DHT11 Humidity and Temperature Sensor with Arduino

LDR  photoresistor with Arduino


Scroll to Top