KY-013 Analog Temperature Sensor Module


Analog Temperature Sensor module KY-013 for Arduino, measures ambient temperature based on resistance of the thermistor.



KY-013 Specifications

The KY-013 Analog Temperature Sensor module consist of a NTC thermistor and a 10 kΩ resistor. The resistance of the thermistor varies with surrounding temperature, we'll use the Steinhart–Hart equation to derive precise temperature of the thermistor.

Operating Voltage5V
Temperature measurement range-55°C to 125°C [-67°F to 257°F]
Measurement Accuracy±0.5°C


KY-013 Connection Diagram

Connect board's power line (middle) and ground (-) to 5V and GND respectively. Connect signal (S) to pin A0 on the Arduino.

S A0
middle 5V

Some KY-013 boards are labeled incorrectly,  if you are getting inverted readings (temperature drops when sensor is heated) try swapping signal (S) and ground (-).

Arduino KY-013 analog temperature sensor module connection diagramclick to enlarge

KY-013 Example Code

The following Arduino Sketch will derive the temperature of the thermistor using the Steinhart-Hart equation implemented in the function Thermister.

#include <math.h>

double Thermister(int RawADC) {
	double Temp;
	Temp = log(((10240000/RawADC) - 10000));
	Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
	Temp = Temp - 273.15; // Convert Kelvin to Celcius
	return Temp;

void setup() {

void loop() {
	Serial.print(Thermister(analogRead(0))); //read pin A0


Leave a Reply

5 Comment threads
3 Thread replies
Most reacted comment
Hottest comment thread
6 Comment authors
l00ViktorlzjwhuKenneth L. AndersonJohan Recent comment authors

It’s probably trivial (I’m a total noob), but could you explain the first line of the Thermister function:
Temp = log(((10240000/RawADC) – 10000));
The way I see it, RawADC is a electric tension measure going from 0 to 1023. Therefore, the resistance R in the Steinhart–Hart equation should be proportional to it according to Ohm’s law. I don’t get why you divide by it.


If the equation on line 5 is to be used (1024 should better be 1023.0), the Vcc and ground connections need to be switched to get the correct thermistor resistance values (i.e., ground connected to the middle pin). After some experimentation, I realized that the A B C values on line 6 are meant for a 10K thermistor. I am not sure if the original KY-013 uses a 10K thermistor. The unit I got from the KUMAN kit uses a 100K thermistor, therefore the confusion (the KUMAN program is also seriously wrong, in multiple places…). If your board also uses… Read more »


Thank you so much! I have the same kit and the same unnamed thermistor. Your post saved me after hours of bashing my head over negative readings!


The equation on line 5 for the log of thermistor resistance is wrong !!!!!
Should be Temp = log( 10000/(1023.0/RawADC-1) );
The A B C values given on line 6 are all off too.
Please update the ABC values

Kenneth L. Anderson
Kenneth L. Anderson

” if you are getting inverted readings (temperature drops when sensor is heated) try swapping signal (S) and ground (-).” That is a mis-statement. These boards commonly are built with the (-) pin needing to be connected to the positive supply volts and the middle pin to the negative, or reference volts. If the S pin, as you suggest, becomes connected to one or the other excitation supply pins, the circuit ends up no longer being a voltage divider; that is, the two resistive components are no longer in series with each other between the reference and the excitation voltage.… Read more »

Daniel Salazar Dominguez
Daniel Salazar Dominguez

hi, iam using arduino IDE 1.8.5 and I get in the monitor serie a result of nanc (I believe the translation is “not a number” c) whats the problem?


A division by zero is the problem. You are receiving zero from pin A0.