Thermistor
A thermistor is a thermal resistor - a resistor that changes its resistance with temperature. Technically, all resistors are thermistors - their resistance changes slightly with temperature - but the change is usually very small and difficult to measure. Thermistors are made so that the resistance changes drastically with temperature so that it can be 100 ohms or more of change per degree!
There are two kinds of thermistors, NTC (negative temperature coefficient) and PTC (positive temperature coefficient). In general, you will see NTC sensors used for temperature measurement. PTC's are often used as resettable fuses - an increase in temperature increases the resistance which means that as more current passes thru them, they heat up and 'choke back' the current, quite handy for protectingcircuits!
from the ELEGOO superkit documentation
Calculating the Temperature
From the Elegoo instructions we are given this relationship for voltage to temperature calculation:
int tempReading = analogRead(tempPin); // read the analog signal at the 10K resistor
double tempK = log(10000.0 * ((1024.0 / tempReading -1))); //convert using the log scale
tempK = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * tempK * tempK )) //convert to temperature in K
* tempK );
float tempC = tempK - 273.15; //conversion to C
float tempF = (tempC * 9.0)/ 5.0 + 32.0;// conversion to F
We will implement this in Arduino code
Arduino Code
void setup() { // put your setup code here, to run once: Serial.begin(9600); Serial.print ("hello"); } void loop() { // put your main code here, to run repeatedly: Serial.println ("loop"); int tempPin = A0; int tempReading = analogRead(tempPin); // read the analog signal at the 10K resistor double tempK = log(10000.0 * ((1024.0 / tempReading - 1))); //convert using the log scale tempK = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * tempK * tempK )) //convert to temperature in K * tempK ); float tempC = tempK - 273.15; //conversion to C float tempF = (tempC * 9.0) / 5.0 + 32.0; // conversion to F Serial.print ("temperature = "); Serial.print (tempF); Serial.println (" degrees F"); delay(200); }