### Thermistor
[Thermistor datasheet](https://www.vishay.com/docs/29049/ntcle100.pdf)
![pic](./thermistor_schem.jpg)
A thermistor is a device whose resistance varies as a function of temperature. It is typically used in a voltage divider circuit.
Below is the data from the datasheet. T as a function of R between 0 and 100 C.
![Thermistor](./Thermistor_data.png)
[Tutorial on using a thermistor](https://create.arduino.cc/projecthub/Marcazzan_M/how-easy-is-it-to-use-a-thermistor-e39321)
Our datasheet gives the formula for converting resistance to temperature in a slightly different way than this tutorial.
Here's the data and the fit, using the datasheet formula.
![](Thermistor_modeled.png)
Now we can confidently use this formula in the Arduino
Here is a Thermistor-reading Arduino code:
```
int ThermistorPin = A0;
int Vo;
float R1 = 10000;
float R2, T;
float A = 3.354e-03;
float B = 2.5698e-4;
void setup() {
Serial.begin(9600);
}
void loop() {
Vo = analogRead(ThermistorPin);
R2 = R1 * 1/(1023.0 / (float)Vo - 1.0); //Calculate resistance of thermistor from voltage divider math.
T = (1.0 / (A + B*log(R2/R1) )); // Calculate temperature using datasheet formula.
T = T - 273.15; //Convert from Kelvin to Celcius.
Serial.print("Temperature: ");
Serial.print(T);
Serial.println("C");
delay(500);
}
```