# NTC Thermistor

## What is NTC Thermistor
NTC (Negative Temperature Coefficient) thermistor is a resistor component whose resistance changes with temperature. The higher the temperature, the smaller the resistance.
### NTC Thermistor Features
- **Variable Resistance**: Changes with temperature
- **High Temperature**: Small resistance
- **Low Temperature**: Large resistance
- **Slow Response**: Not suitable for rapidly changing temperature detection
## Working Principle
NTC thermistor resistance changes with temperature:
- **High Temperature**: Small resistance
- **Low Temperature**: Large resistance
### Why Does Resistance Change?
NTC thermistor contains temperature-sensitive material inside. When temperature rises, carriers increase, conductivity increases, resistance decreases.
## Connection Method
### Temperature-Controlled LED Circuit (Direct Visual Effect)

### Connection Instructions
According to the diagram above, connection order is:
```
VCC (5V) → NTC Thermistor → Fixed Resistor (10KΩ) → GND (Voltage Divider Circuit)
NTC Thermistor and Fixed Resistor Connection Point (Divider Point) → LED Anode → 220Ω Resistor → GND
```
**Working Principle**:
- **High Temperature**: NTC resistance small, after voltage division LED anode voltage high, LED bright
- **Low Temperature**: NTC resistance large, after voltage division LED anode voltage low, LED dim
- Can observe LED brightness changes by heating or cooling NTC
**Effect**: Hold NTC thermistor with hand (body heat), LED brightens; release hand temperature decreases, LED dims, visually see thermistor resistance change effect
### Fixed Resistor Selection
- **10KΩ**: Most common, suitable for most NTC thermistors
- Fixed resistor value should be close to NTC resistance at midpoint of measurement temperature range
## Arduino Example Code
### Basic Example: Read Temperature Value
```cpp
const int thermistorPin = A0; // NTC Thermistor connected to A0
void setup() {
Serial.begin(9600);
pinMode(thermistorPin, INPUT);
}
void loop() {
int value = analogRead(thermistorPin); // Read 0-1023
// Convert to voltage
float voltage = value * (5.0 / 1023.0);
// Convert to resistance (need to calculate according to actual circuit)
float resistance = (5.0 / voltage - 1.0) * 10000.0; // Assume fixed resistor is 10KΩ
// Convert to temperature (simplified formula, actual need lookup table or Steinhart-Hart formula)
float temperature = 1 / (log(resistance / 10000.0) / 3950.0 + 1 / 298.15) - 273.15;
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
delay(100);
}
```
### Connection Method
- **VCC (5V)** → **NTC Thermistor** → **Fixed Resistor (10KΩ)** → **GND** (Voltage Divider Circuit)
- **NTC Thermistor and Fixed Resistor Connection Point (Divider Point)** → **Arduino A0**
### Code Explanation
- `analogRead(pin)`: Read analog value, range 0-1023
- Need to convert resistance to temperature, can use lookup table or Steinhart-Hart formula
- Above code is simplified version, actual applications need to adjust parameters according to specific model
### Advanced Example: Temperature Control Fan
```cpp
const int thermistorPin = A0;
const int fanPin = 9; // PWM pin controls fan
void setup() {
pinMode(thermistorPin, INPUT);
pinMode(fanPin, OUTPUT);
}
void loop() {
int value = analogRead(thermistorPin);
float voltage = value * (5.0 / 1023.0);
float resistance = (5.0 / voltage - 1.0) * 10000.0;
float temperature = 1 / (log(resistance / 10000.0) / 3950.0 + 1 / 298.15) - 273.15;
// Start fan when temperature exceeds 30°C
if (temperature > 30) {
int speed = map(temperature, 30, 50, 100, 255);
speed = constrain(speed, 100, 255);
analogWrite(fanPin, speed);
} else {
analogWrite(fanPin, 0); // Turn off fan
}
delay(100);
}
```
**Explanation**: Automatically control fan speed according to temperature, fan rotates faster when temperature is higher.
## Common Questions and Answers
### Q1: Temperature Reading Inaccurate?
- Check if connection has good contact
- Use lookup table or Steinhart-Hart formula to improve accuracy
- Calibrate fixed resistor value
- Avoid direct sunlight and heat source interference
### Q2: How to Choose Fixed Resistor Value?
- Usually use 10KΩ
- Fixed resistor value should be close to NTC resistance at midpoint of measurement temperature range
- Check NTC datasheet for recommended value
### Q3: How to Improve Temperature Measurement Accuracy?
- Use lookup table (more accurate)
- Use Steinhart-Hart formula (need to know NTC parameters)
- Calibrate fixed resistor value
- Use higher precision ADC
## Safety Precautions
⚠️ **Important Notes**:
- Need to form voltage divider circuit with resistor
- Response speed is slow, not suitable for rapidly changing temperature detection
- Need lookup table or formula to convert resistance to temperature
- Avoid direct sunlight and heat source interference
- Pay attention to NTC maximum working temperature
## Practical Applications
NTC thermistors are commonly used for temperature monitoring, temperature control, over-temperature protection, etc. In Arduino projects, commonly used to create temperature monitoring systems, auto temperature control fans, over-temperature alarms, etc.