Arduino KY-013 Temperature sensor module

Buy the 37 in 1 kit at Amazon

Analog temperature sensor

First, the module introduces The module is based on the thermistor (resistance increases with the ambient temperature changes) works, a sense of real-time To know the temperature of the surrounding environment changes, we send the data to the Arduino analog IO, then come down as long as we go through Jane Single programming will be able to convert the sensor output data Celsius temperature values and displayed, it is still easy to use, It effectively, thereby widely used in gardening, home alarm systems and other devices. Second, the use And the general temperature sensor is the same, are three-line package, when we use the power cord connected OK signal output Into the end on the line, because the module output is an analog signal, we want to signal output terminal connected to the Arduino analog IO On sampling, so as to correctly read the temperature value; Up to this point generally know how to use it, then we need to know about how it is the next temperature measurement?

Specifications

  • The temperature sensor is a NTC thermistor
  • Multi-point temperature measurement Measures temperatures: -55°C / +125°C
  • Accuracy: + / – 0.5°C

Hardware devices

  • Arduino controller × 1
  • USB data cable × 1
  • the analog temperature sensor module × 1

We must have the above things can test to see if an original is a simple thermal how to help us measure the temperature.

Schematic

  • Arduino pin analoog A5 –> module S (Signal)
  • Arduino pin GND – module –
  • Arduino pin 5+ –> middel pin 5V

This code don’t give the right values, in a room that was kind of ok it gave a tempature of 10 C. That isn’t right so the calculation in the code should be checked.

Example code

#include <math.h>
 
int sensorPin = A5; // select the input pin for the potentiometer
 
double Thermistor(int RawADC) {
  double Temp;
  Temp = log(10000.0*((1024.0/RawADC-1))); 
  Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
  Temp = Temp - 273.15;            // Convert Kelvin to Celcius
   //Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
   return Temp;
}
 
void setup() {
 Serial.begin(9600);
}
 
void loop() {
 int readVal=analogRead(sensorPin);
 double temp =  Thermistor(readVal);
 
 Serial.println(temp);  // display tempature
 //Serial.println(readVal);  // display tempature
 
 delay(500);
}