Phipps Electronics

Order within the next 

FREE SHIPPING OVER $199

50,000+ ORDERS

WORLDWIDE SHIPPING

SSL SECURED

Using the Temperature Sensor Module KY-013 with Arduino

Contents

Introduction

In this tutorial, we will learn about the KY-013 module, what is an NTC Thermistor and we will build a simple project to read ambient temperature using the KY-001 module and an Arduino.

Temperature Sensor Module KY-013

The KY-013 Module will be our main component for this tutorial. This module has an NTC Thermistor and mounted on a breakout board with a 10K-ohm resistor. Figure 1 shows the module as seen in fritzing.

Figure 1: KY-013 Temperature Sensor Module

Pinout

The KY-013 module has three pins.

Component PinArduino Uno board Pin
(-)GND
middle+5V
SSignal

What is an NTC Thermistor?

An NTC Thermistor is a Negative Temperature Coefficient resistor. This means that the resistance is inversely proportional to temperature. The resistance increases when temperature decreases and vice-versa.

Project - Arduino Analog Ambient Thermometer

After learning about the KY-013 module and the NTC Thermistor, it is now time to build a project using the module. Our project will read the resistance value from the KY-013 module. The value obtained will then be used to calculate the temperature and display it on the serial monitor.

Components

For this project, we need the following components:

  • Arduino Uno board (1 pc.)
  • KY-013 Temperature Sensor Module (1 pc.)
  • Jumper wires

Wiring Diagram

Figure 2 shows the connection between the Arduino Uno and the KY-013 Temperature Sensor Module.

The KY-013 module pins are connected to the Arduino Uno board as follows:

Component PinArduino Uno board Pin
(-)GND
middle+5V
SA0

The Code

Below is the Arduino sketch for our project. I have added comments to explain important parts of the code. Save the code as KY-013.ino and upload it to your Arduino board.

				
					// Arduino and KY-013 tutorial
void setup() {
  Serial.begin(9600);   // initialize serial interface with baud 9600bps
}
void loop() {
  // Read value from module connected at pin A0
  int V_input = analogRead(A0);
  // calculate thermometer resistance by comparing it to the modules onboard 10K-ohm resistor
  float R_ohms = 10000 * (1023.0 / (float)V_input - 1.0);
  // calculate temperature in Celsius
  float temp_C = (1.0 / (0.001129148 + (0.000234125*log(R_ohms)) + 0.0000000876741*log(R_ohms)*log(R_ohms)*log(R_ohms)))-273.15;
  // output result to serial
  Serial.print("Temperature (degC): ");
  Serial.println(temp_C);
}
				
			

Project Test

Apply power to your Arduino Uno board and open the Serial Monitor in the Arduino IDE. Arduino calculates the temperature based on the reading from the KY-013 module connected to pin A0 and displays the result on the serial monitor every second.

SUBSCRIBE FOR NEW POST ALERTS

Subscribe to be the first to know when we publish a new article!
List Subscriptions(Required)

POPULAR POSTS

Scroll to Top