🌡 Using NTC Thermistor for Temperature Measurement with simple ESP32-C3 Arduino Library
Intro
In one of previous article I described my experience of designing and ordering aluminum board (LED PANEL). One of the feature of this board is small onboard 0402 NTC TS temperature sensors for precise measurement of the board operating temperature at different power.
![]() | 🕯 Aluminum Board 1L JLCPCB LED Panel (PCB + PCBA) |
Let's see how to connect onboard NTC thermistor to SoC ESP32 to measureLED PANEL temperature while it work.
Connection Diagram
| Note: capacitor 0.1uF-1uF between ADC input and ground is strongly recommended. |
| Note: Choose R_UP by taking into account maximum operating current (in my case 0.1mA) and supply voltage (in my case 3.3V). Pull up resistor in my case it's 20kOhm. Also prefer 1% or higher tolerance (0.1%) if possible. |
Board
Note: NTC connected using twisted wire. Note: 20kOhm achieved by two 10kOhm in serial |
Arduino Board and Configurations
![]() | ![]() |
Adding Library
1) Since original library deleted, here is reserve copy for downloading:
1) GitHub (original repo): https://github.com/suoapvs/NTC_Thermistor 2) Mirror (directly from server): NTC_Thermistor.zip |
2) Unzip folder NTC_Thermistor into standard path (change USERNAME to your):
C:\Users\<strong>USERNAME</strong>\Documents\Arduino\libraries
3) Or press Sketch -> Include library -> Add .ZIP Library and choose download achieve with library:
![]() | ![]() |
Code
I'm using NCP15XH103F03RC NTC TS from Murata. Several values on B-Coefficient for different ranges are present in datasheet, so I chosen 25/50 °C B3380K.
NTC Thermistor (TS)
Change defines in code according to your sensor and pin:
#define SENSOR_PIN 1 /* NTC_ADC */ #define REFERENCE_RESISTANCE 20000 /* R_UP */ #define NOMINAL_RESISTANCE 10000 /* R_NTC */ #define NOMINAL_TEMPERATURE 25 #define B_VALUE 3380 #define ESP32_ANALOG_RESOLUTION 4095 #define ESP32_ADC_VREF_MV 3300
Full Code (Sketch)
/* NTC Thermistor for ESP32 higher accuracy results Reads a temperature from the NTC 3950 thermistor and displays it in the default Serial. ESP32 devices are 12-bit ADC devices so the defuault is 4095 here. https://github.com/bobwolff68/NTC_Thermistor Created by Bob Wolff from Yuri's original - 2024 Released into the public domain. */ #include <Thermistor.h> #include <NTC_Thermistor.h> #define SENSOR_PIN 1 /* NTC_ADC */ #define REFERENCE_RESISTANCE 20000 /* R_UP */ #define NOMINAL_RESISTANCE 10000 /*R_NTC */ #define NOMINAL_TEMPERATURE 25 #define B_VALUE 3380 #define ESP32_ANALOG_RESOLUTION 4095 #define ESP32_ADC_VREF_MV 3300 Thermistor* thermistor; // the setup function runs once when you press reset or power the board void setup() { Serial.begin(115200); thermistor = new NTC_Thermistor_ESP32( SENSOR_PIN, REFERENCE_RESISTANCE, NOMINAL_RESISTANCE, NOMINAL_TEMPERATURE, B_VALUE, ESP32_ADC_VREF_MV, ESP32_ANALOG_RESOLUTION ); } // the loop function runs over and over again forever void loop() { // Reads temperature const double celsius = thermistor->readCelsius(); const double kelvin = thermistor->readKelvin(); const double fahrenheit = thermistor->readFahrenheit(); // Output of information Serial.print("Temperature: "); Serial.print(celsius); Serial.print(" °C, "); Serial.print(kelvin); Serial.print(" K, "); Serial.print(fahrenheit); Serial.println(" F"); delay(500); // optionally, only to delay the output of information in the example. }
Compare Results
I added voltage read function to compare measured value from multimeter and measured by the ESP32-C3 ADC:
Multimeter | ESP32-C3 ADC |
![]() | ![]() |
Quick Temperature Test
Serial Print | Multimeter Thermocouple |
![]() | ![]() |
![]() | ![]() |
Big Temperature Test
| IN WORK 🐱 |
Repository
1) GitHub: https://github.com/Egoruch/NTC-ESP32C3-ARDUINO
2) Mirror (directly from server): NTC-ESP32C3-ARDUINO.zip
⭐ Advices
- Use stable reference voltage like: 1.25V, 2.048V
- Use switch to power NTC TS, only when do measurement (just MCU pin since low power)
Conclusions
- Using internal ESP32-xx ADC without capacitor very bad idea
- Library showed very close value in compare to the multimeters' thermocouple measurements
- Pay attention at the NTC TS maximum current and choose appropriate R_UP to prevent self-heating affection
- I would say we achieved ±1°C
- Comments












