> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/wokwi/wokwi-docs/llms.txt
> Use this file to discover all available pages before exploring further.

# NTC Temperature Sensor

> Analog temperature sensor - NTC thermistor

Analog temperature sensor: NTC (negative temperature coefficient) thermistor.

## Pin names

<ParamField path="VCC" type="Power">
  Positive power supply
</ParamField>

<ParamField path="OUT" type="Analog Output">
  Output signal (analog)
</ParamField>

<ParamField path="GND" type="Ground">
  Ground
</ParamField>

## Attributes

<ParamField path="temperature" type="string" default="24">
  Initial temperature value (celsius)
</ParamField>

<ParamField path="beta" type="string" default="3950">
  The beta coefficient of the thermistor
</ParamField>

## Reading the temperature

The temperature sensor module includes a 10K NTC thermistor in series with a 10K resistor.

This setup produces a voltage that depends on the temperature. You can read this voltage by
connecting the OUT pin of the thermistor to an analog input pin and then using the
`analogRead()` function.

Use the following code to convert the return value of `analogRead()` into a temperature value (in celsius):

```cpp theme={null}
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
int analogValue = analogRead(A0);
float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
```

## Simulator examples

* [NTC Thermistor Basic Example](https://wokwi.com/projects/299330254810382858)
