Categories
arduino

Arduino and KTY81-210

You have a lot of possibilities to measure the temperature with an arduino. One simple solution is the usage of a KTY81 silicon temperature sensors.
Arduino describes on the playground the usage of KTY81-110. If you have an other type, you need to recalculate the temperature.


(Vcc 5+)--+-->2.7k--+-->kty81-210-->(GND)
          |         |
          +->100nF--+-----> ADC2 (Analog Port 2)

Here is my code to use KTY81-210 with the arduino:

// resistor value of voltage divider in ohm
float resistor = 2700;

void setup() {
  Serial.begin(9600); 
}

void loop() {  
  float temp = kty(2); 
  Serial.print("Temperature: ");
  Serial.println(temp,1); 
  delay (5000);  
}

float kty(unsigned int port) {
   float sensorValue = analogRead(port);  
   float resistance = sensorValue / (1023-sensorValue) * resistor;
   // resistor values from kty81-210 data sheet, written as polynomial trend line
   return -1.332e-11 * pow(resistance,4) + 6.621e-8 * pow(resistance,3) - 0.0002 * pow(resistance,2) + 0.2947 * resistance - 230.55;  
}