- ✓ Understanding NTC thermistors (how they work, resistance-temperature relationship)
- ✓ Voltage divider circuit design and calculations
- ✓ Wiring NTC to ESP8266, ESP32, and Pico W
- ✓ The Steinhart-Hart equation and Beta parameter
- ✓ Configuring NTC in OceanRemote firmware
- ✓ Calibrating NTC readings with offset
- ✓ Troubleshooting common NTC issues
Introduction to NTC Thermistors
NTC stands for Negative Temperature Coefficient. Unlike digital sensors (DHT22, DS18B20), an NTC thermistor is an analog sensor. As temperature increases, its electrical resistance decreases (hence "negative coefficient").
| Parameter | Typical Value |
|---|---|
| Resistance at 25°C (R25) | 10kΩ ±1% or ±5% |
| Beta (β) value | 3435K, 3950K, or 4100K (typical) |
| Temperature Range | -55°C to +125°C |
| Accuracy | ±0.5°C to ±2°C (depends on quality) |
| Response Time | 5-15 seconds (in air), 1-2 seconds (in liquid) |
| Cost | $1-3 (very affordable) |
| Pros | Cheap, fast response, wide range, no library needed |
| Cons | Non-linear, requires calibration, needs voltage divider |
| Feature | NTC | DS18B20 | DHT22 |
|---|---|---|---|
| Interface | Analog (ADC) | Digital (1-Wire) | Digital (1-Wire) |
| Humidity? | ❌ No | ❌ No | ✅ Yes |
| Accuracy | ±0.5-2°C | ±0.5°C | ±0.5°C |
| Pull-up Required? | ❌ No | ✅ Yes (4.7kΩ) | ⚠️ Optional |
| Library Required? | ❌ No (just analogRead) | ✅ Yes | ✅ Yes |
| Cost | $1-3 | $2-4 | $4-6 |
| Best For | Budget projects, fast response | Accuracy, waterproof | Humidity monitoring |
Choose NTC when: you need a cheap temperature sensor, fast response time, or are comfortable with basic electronics (voltage divider). Perfect for: battery monitoring, motor temperature, ambient sensing, and breadboard prototyping.
Avoid NTC when: you need high accuracy (±0.2°C), don't want to calibrate, or need humidity data.
How NTC Works: The Science
An NTC thermistor's resistance changes with temperature following this approximate formula:
R(T) = R25 * exp( β * (1/T - 1/T25) ) Where: R(T) = Resistance at temperature T (Kelvin) R25 = Resistance at 25°C (typically 10,000Ω) β = Beta constant (material property, typically 3435-4100K) T = Temperature in Kelvin T25 = 298.15K (25°C in Kelvin) exp() = Exponential function
To get temperature from a measured resistance, we use the Steinhart-Hart equation:
1/T = A + B*ln(R) + C*(ln(R))³ Simplified for most applications: T = 1 / (A + B * ln(R) + C * (ln(R))³) Where A, B, C are calibration constants. For a standard 10kΩ NTC (β=3950): A = 1.129241e-3 B = 2.341077e-4 C = 8.77541e-8
| Temperature (°C) | Resistance (Ω) | ADC Reading (10-bit @3.3V) |
|---|---|---|
| -20°C | ≈ 120,000Ω | ≈ 250 |
| 0°C | ≈ 32,000Ω | ≈ 780 |
| 25°C | 10,000Ω | ≈ 1,650 |
| 50°C | ≈ 3,600Ω | ≈ 2,400 |
| 75°C | ≈ 1,500Ω | ≈ 2,900 |
| 100°C | ≈ 700Ω | ≈ 3,150 |
Note: ADC values assume 10-bit resolution (0-1023) and voltage divider with 10kΩ series resistor. ESP32/Pico W (12-bit) will have 4x higher values.
The Voltage Divider Circuit
Since microcontrollers can only measure voltage (not resistance), we need a voltage divider circuit to convert the NTC's changing resistance into a measurable voltage.
NTC Voltage Divider Circuit (Series Configuration):
3.3V
│
▼
┌───┐
│R1 │ ← NTC Thermistor (resistance changes with temperature)
└───┘
│
├──────► ADC Pin (Voltage measured here)
│
┌───┐
│R2 │ ← Fixed series resistor (typically 10kΩ)
└───┘
│
GND
Voltage at ADC: Vout = 3.3V * (R2 / (R_NTC + R2))
When temperature increases → R_NTC decreases → Vout increases
When temperature decreases → R_NTC increases → Vout decreases
Choosing the Series Resistor (R2)
For best accuracy, the series resistor should match the NTC's resistance at the temperature range you're measuring:
- Room temperature monitoring (15-35°C): Use 10kΩ (matches R25)
- Cold temperatures (-20 to 10°C): Use 22kΩ or 33kΩ
- Hot temperatures (50-100°C): Use 4.7kΩ or 3.3kΩ
- General purpose: 10kΩ works for most applications
For most OceanRemote users, use a 10kΩ series resistor with a 10kΩ NTC (β=3950). This gives good accuracy from 0°C to 70°C.
Wiring NTC to Your Board
Components Needed:
- 1x NTC 10kΩ Thermistor (or 100kΩ, adjust values accordingly)
- 1x 10kΩ resistor (fixed, 1% precision recommended)
- Jumper wires (male-female)
- Breadboard (optional)
Wiring to ESP8266 (D1 Mini)
| Component | ESP8266 Pin | Notes |
|---|---|---|
| NTC one lead | 3.3V | Power for voltage divider |
| NTC other lead | A0 (Analog input) | Connected with series resistor to GND |
| 10kΩ resistor | Between A0 and GND | Creates the voltage divider |
ESP8266 D1 Mini + NTC 10kΩ Wiring:
┌─────────────────────────────────────────────────────┐
│ │
│ ┌─────────┐ │
│ │ D1 Mini │ │
│ ├─────────┤ │
│ │ 3.3V ├───────┐ │
│ │ │ │ │
│ │ A0 ├───┐ │ ┌─────────┐ │
│ │ │ │ │ │ NTC │ │
│ │ GND ├───┼───┼──────┤ 10kΩ │ │
│ └─────────┘ │ │ └─────────┘ │
│ │ │ │
│ ┌┴───┴┐ │
│ │10kΩ │ ← Fixed resistor │
│ │ │ │
│ └──┬──┘ │
│ │ │
│ GND │
└─────────────────────────────────────────────────────┘
Wiring to ESP32
| Component | ESP32 Pin | Notes |
|---|---|---|
| NTC one lead | 3.3V | Power for voltage divider |
| NTC other lead | GPIO34 (ADC1_CH6) | Use input-only ADC pins (34-39) |
| 10kΩ resistor | Between GPIO34 and GND | Creates the voltage divider |
ESP32 has non-linear ADC near the extremes. For best accuracy, use GPIO36 (VP) or GPIO39 (VN) which have better linearity. Avoid GPIO34-35 if possible.
Wiring to Raspberry Pi Pico W
| Component | Pico W Pin | Notes |
|---|---|---|
| NTC one lead | 3.3V | Power for voltage divider |
| NTC other lead | GP26 (ADC0) | 12-bit ADC, pin 31 |
| 10kΩ resistor | Between GP26 and GND | Creates the voltage divider |
The Pico W has an excellent 12-bit ADC (0-4095) with good linearity. It's the best choice for NTC thermistors among OceanRemote-supported boards.
Testing Your NTC (Without OceanRemote)
Before using OceanRemote firmware, test your NTC with this simple sketch:
// NTC Thermistor Test Sketch
// For ESP8266 (A0), ESP32 (GPIO34), Pico W (GP26)
#ifdef ESP32
#define NTC_PIN 34
#define ADC_MAX 4095
#define ADC_VREF 3.3
#elif defined(ARDUINO_ARCH_RP2040)
#define NTC_PIN 26
#define ADC_MAX 4095
#define ADC_VREF 3.3
#else
#define NTC_PIN A0
#define ADC_MAX 1023
#define ADC_VREF 3.3
#endif
#define SERIES_RESISTOR 10000.0 // 10kΩ
#define NTC_R25 10000.0 // 10kΩ at 25°C
#define BETA 3950.0 // Beta constant
void setup() {
Serial.begin(115200);
Serial.println("NTC Thermistor Test Started");
}
void loop() {
int raw = analogRead(NTC_PIN);
float voltage = (raw * ADC_VREF) / ADC_MAX;
// Calculate NTC resistance from voltage divider
float ntc_resistance = (voltage * SERIES_RESISTOR) / (ADC_VREF - voltage);
// Steinhart-Hart calculation
float steinhart;
float logR = log(ntc_resistance);
float kelvin = 1.0 / (0.001129241 + 0.0002341077 * logR + 0.0000000877541 * logR * logR * logR);
float celsius = kelvin - 273.15;
Serial.print("ADC: ");
Serial.print(raw);
Serial.print(" | Voltage: ");
Serial.print(voltage, 3);
Serial.print("V | Resistance: ");
Serial.print(ntc_resistance);
Serial.print("Ω | Temperature: ");
Serial.print(celsius, 1);
Serial.println("°C");
delay(2000);
}
- At room temperature (~25°C), ADC should be around 1650 (10-bit) or 6600 (12-bit)
- Warming the NTC with your fingers should increase ADC reading
- Cooling the NTC (ice cube in a bag) should decrease ADC reading
- If ADC is 0 or 1023/4095, check your wiring
NTC Configuration in OceanRemote
When you select NTC in the device configuration, OceanRemote firmware uses the Steinhart-Hart equation with your specified parameters.
Parameters You Need to Provide:
| Parameter | Description | Typical Value |
|---|---|---|
| R25 (Ω) | Resistance at 25°C | 10000 (10kΩ) |
| Beta (β) | Material constant (in Kelvin) | 3435, 3950, or 4100 |
| Series Resistor (Ω) | Fixed resistor value | 10000 (10kΩ) |
- Most common NTCs use β = 3950 (generic 10kΩ from Amazon/eBay)
- Check datasheet if available
- If unknown, use 3950 and calibrate with offset
- You can calculate Beta using two known temperatures (ice water and boiling water)
How OceanRemote Calculates NTC Temperature
// OceanRemote NTC calculation (firmware snippet)
float readNTC() {
int raw = analogRead(NTC_PIN);
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
float voltage = (raw * 3.3) / 4095.0;
#else
float voltage = (raw * 3.3) / 1023.0;
#endif
// Calculate NTC resistance from voltage divider
float ntcResistance = (voltage * SERIES_RESISTOR) / (3.3 - voltage);
// Steinhart-Hart coefficients for β=3950
float logR = log(ntcResistance);
float kelvin = 1.0 / (0.001129241 + 0.0002341077 * logR + 0.0000000877541 * logR * logR * logR);
float celsius = kelvin - 273.15;
return celsius;
}
Calibrating Your NTC
NTC thermistors are less accurate than digital sensors out of the box. OceanRemote provides two calibration methods:
Method 1: Dashboard Offset (Simplest)
- Place a known-accurate thermometer next to your NTC
- Note the difference between readings
- In your OceanRemote dashboard, find your device's temperature card
- Enter the offset value in the "Calibration Offset (±°C)" field
Example: NTC reading: 24.2°C Actual temperature: 23.5°C Difference: -0.7°C Enter offset: -0.7 Result: 24.2 + (-0.7) = 23.5°C ✓
Method 2: Two-Point Calibration (More Accurate)
For critical applications, calibrate using two known temperatures:
- Ice point (0°C): Place NTC in ice water (crushed ice + distilled water)
- Room temperature (~25°C): Measure with a calibrated thermometer
- Calculate actual Beta value using the formula:
β = ln(R25/R0) / (1/T25 - 1/T0) Where: R25 = NTC resistance at room temp (measured) R0 = NTC resistance at 0°C (measured) T25 = 298.15K (room temp in Kelvin) T0 = 273.15K (0°C in Kelvin)
- Enter the calculated Beta in OceanRemote device configuration
For maximum accuracy, use a 3-point calibration (0°C, 25°C, 50°C) to calculate Steinhart-Hart coefficients A, B, and C. This is overkill for most hobby projects.
Troubleshooting NTC Issues
Problem: ADC reading is always 0 or max
- ADC = 0: Check connection between NTC and 3.3V. Also check GND connection of series resistor.
- ADC = 1023/4095: Series resistor may be disconnected or NTC is shorted. Check wiring.
- ESP32 specific: GPIO34-39 are input-only. Make sure you're not using them as outputs.
Problem: Temperature jumps erratically
- Check for loose connections on the breadboard
- Add a small capacitor (0.1μF) between ADC pin and GND to filter noise
- Use averaging in software (OceanRemote does 5-sample averaging)
- Avoid running ADC wires near power lines
Problem: Temperature readings are consistently off
- Use dashboard offset calibration (±5°C range)
- Verify your series resistor value (measure with multimeter)
- Verify NTC R25 value (measure at known 25°C)
- Try different Beta value (3435, 3950, 4100 are common)
Problem: Slow response to temperature changes
- NTC in air has thermal mass - this is normal (5-15 seconds)
- For faster response, use a smaller NTC (glass bead type)
- Ensure NTC is not covered by heat-shrink or epoxy (except waterproof versions)
- Forgetting the series resistor: Without it, you're reading 0V or 3.3V only
- Wrong resistor value: Using 1kΩ instead of 10kΩ gives very low ADC resolution
- Using 5V instead of 3.3V: ESP8266/ESP32/Pico W ADC max is 3.3V! Using 5V may damage the board.
- Assuming 25°C = 10kΩ exactly: NTCs have ±1-5% tolerance. Calibrate!
NTC Best Practices
- Use 1% Resistors: For the series resistor, use a 1% precision metal film resistor. The 5% carbon resistors add significant error.
- Keep Leads Short: Long wires act as antennas and pick up noise. Keep under 50cm for best results.
- Thermal Isolation: Keep the NTC away from heat sources (ESP8266/ESP32 gets warm!). Use extension wires.
- Waterproofing: For outdoor use, use epoxy-coated or stainless steel probe NTCs. Standard NTCs will corrode.
- Self-Heating: Keep current low (<1mA). OceanRemote's voltage divider uses ~0.3mA at 25°C, which is safe.
- ADC Averaging: OceanRemote averages 5 samples to reduce noise. This gives stable readings.
- Battery Temperature: Monitor LiPo batteries during charging (prevents fires)
- Motor Temperature: Detect overheating in pumps, fans, or motors
- Ambient Temperature: Room, garage, greenhouse monitoring
- Heat Sink Temperature: Monitor power transistors or voltage regulators
- Liquid Temperature: Waterproof NTCs work great in aquariums or pipes
- Compost Temperature: Monitor decomposition heat in compost bins
Common NTC Values Reference
| NTC Type | R25 | Beta (β) | Best Use |
|---|---|---|---|
| Generic 10kΩ | 10kΩ | 3950 | General purpose, room temp |
| Precision 10kΩ | 10kΩ ±1% | 3435 or 3950 | Medical, HVAC, accurate |
| 100kΩ Thermistor | 100kΩ | 4100 | Low power, battery projects |
| Waterproof Probe | 10kΩ or 100kΩ | 3950 | Liquids, outdoor, soil |
- β = 3435 - Often used for body temperature sensors (higher sensitivity near 37°C)
- β = 3950 - Most common, good for 0-70°C range
- β = 4100 - Better for high temperatures (50-150°C)
- β = 4700 - Very sensitive, used for narrow temperature ranges
Next Steps
Now that you understand NTC thermistors, continue with:
- Tutorial 19: Understanding the NTC Voltage Divider Circuit (in-depth)
- Tutorial 20: Calibrating Temperature Sensors with Offset
- Tutorial 21: Connecting Relays to Your Board
- Return to Tutorial 02: Generate firmware with NTC support!
Your NTC thermistor is now properly wired and tested. Generate new firmware with NTC selected, enter your R25, Beta, and Series Resistor values, and your dashboard will show temperature readings!
Pro tip: NTCs are analog sensors - they work on any board with an ADC. ESP8266 has 10-bit (0-1023), ESP32 and Pico W have 12-bit (0-4095) for 4x better resolution.