1k
The KY-013 Analog Temperature Sensor Module uses a thermistor to measure ambient temperature based on the resistance of the device.
- The temperature sensor is a NTC thermistor
- Multi-point temperature measurement Measures temperatures: -55°C / +125°C
- Accuracy: + / – 0.5°C
Connection
Connect board’s power line (middle) and ground (-) to 5V and GND respectively. Connect signal (S) to pin A0 of the Arduino.
KY-013 | Arduino |
S | A0 |
middle | 5V |
– | GND |
Code
[codesyntax lang=”cpp”]
#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() {
Serial.begin(9600);
}
void loop() {
Serial.print(Thermister(analogRead(0))); //read pin A0
Serial.println("c");
delay(500);
}
[/codesyntax]
Links
37 in 1 box Sensor Kit For Arduino Starters brand in stock