This example shows how to use the thermistor
component to compute the
temperature from a temperature sensitive resistor (thermistor) - specifically
negative temperature coefficient (NTC) thermistors.
The first part of the example does not need any hardware and simply shows how to use the component to compute the temperature from the resistance of the thermistor. The second part of the example shows how to use the component with an ESP32 to compute the temperature from the voltage divider formed by the thermistor and a fixed resistor.
To run this example, you need:
The example is configured so that the NTC is the top resistor in a voltage divider, with the 10k resistor on the bottom. The voltage divider is connected to the ADC1 channel 0 input of the ESP32.
Build the project and flash it to the board, then run monitor tool to view serial output:
Plaintext
idf.py -p PORT flash monitor
(Replace PORT with the name of the serial port to use.)
(To exit the serial monitor, type Ctrl-]
.)
See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
To create a project from this example, run:
idf.py create-project-from-example "espp/thermistor=1.0.6:example"