KY-013 ANALOG TEMPERATURE SENSOR MODULE - RoboticX

The KY-013 Ana­log Tem­per­a­ture Sen­sor mod­ule can mea­sure ambi­ent tem­per­a­ture based on the resis­tance of the ther­mis­tor on the board.

Com­pat­i­ble with pop­u­lar elec­tron­ics plat­forms like Arduino and ESP32.

KY-013 SPECIFICATIONS

This mod­ule con­sist of a NTC ther­mis­tor, a 10 kΩ resis­tor, and 3 male head­er pins. The ther­mis­tor resis­tance varies accord­ing to its sur­round­ing tem­per­a­ture. The val­ue of resis­tance can be used to cal­cu­late the actu­al tem­per­a­ture.

Oper­at­ing Volt­age5V
Tem­per­a­ture mea­sure­ment range-55°C to 125°C [-67°F to 257°F]
Mea­sure­ment Accu­ra­cy±0.5°C

CONNECTION DIAGRAM

Con­nect mod­ule pow­er line (mid­dle) and ground (-) to 5V and GND on the Arduino respec­tive­ly. Con­nect the mod­ule sig­nal pin (S) to pin A0 on the Arduino.

Some KY-013 have a dif­fer­ent pin arrange­ment. Please check your board before con­nect­ing.

KY-013Arduino
SA0
mid­dle5V
GND
Arduino KY-013 analog temperature sensor module connection diagram

KY-013 ARDUINO CODE

The fol­low­ing Arduino Sketch will derive the tem­per­a­ture from the ther­mis­tor using the Stein­hart-Hart equa­tion. The code will return tem­per­a­ture in Cel­cius, uncom­ment line 17 to get tem­per­a­ture in faren­heit

Arduino int ThermistorPin = A0; int Vo; float R1 = 10000; // value of R1 on board float logR2, R2, T; float c1 = 0.001129148, c2 = 0.000234125, c3 = 0.0000000876741; //steinhart-hart coeficients for thermistor void setup() { Serial.begin(9600); } void loop() { Vo = analogRead(ThermistorPin); R2 = R1 * (1023.0 / (float)Vo - 1.0); //calculate resistance on thermistor logR2 = log(R2); T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2)); // temperature in Kelvin T = T - 273.15; //convert Kelvin to Celcius // T = (T * 9.0)/ 5.0 + 32.0; //convert Celcius to Farenheit Serial.print("Temperature: "); Serial.print(T); Serial.println(" C"); delay(500);
12345678910111213141516171819intTher­mis­tor­Pin=A0;intVo;floatR1=10000;// val­ue of R1 on boardfloatlogR2,R2,T;floatc1=0.001129148,c2=0.000234125,c3=0.0000000876741;//stein­hart-hart coe­fi­cients for ther­mis­torvoidset­up(){Ser­i­al.begin(9600);}voidloop(){Vo=analo­gRead(Ther­mis­tor­Pin);R2=R1*(1023.0/(float)Vo-1.0);//calculate resis­tance on ther­mis­torlogR2=log(R2);T=(1.0/(c1+c2*logR2+c3*logR2*logR2*logR2));// tem­per­a­ture in KelvinT=T-273.15;//convert Kelvin to Cel­cius// T = (T * 9.0)/ 5.0 + 32.0; //convert Cel­cius to Faren­heitSer­i­al.print(“Tem­per­a­ture: ”);Ser­i­al.print(T);Ser­i­al.print­ln(“ C”);delay(500);

DOWNLOADS

  • Fritz­ing Part: KY-013 Ana­log tem­per­a­ture sen­sor mod­ule.
  • Fritz­ing Offi­cial Site.

Tag » Arduino Ky-013 Temperature Sensor Module