Analog Front-End

# ADC Resolution, LSB & NTC Thermistor Calculator

Convert raw ADC counts to pin voltage, scale resistor dividers, solve Beta NTC thermistor lookup points, and export a ready-to-run `suite.yaml` stimulus block.

ADC resolution (bits)8-bit (256 steps)10-bit (1,024 steps)12-bit (4,096 steps)14-bit (16,384 steps)16-bit (65,536 steps)24-bit (16,777,216 steps)

Reference voltage Vref (V)3.3 V STM32/RP2040, 5.0 V AVR, 2.048 V ADS1115

Raw ADC count (0..4095)

Divider R\_top (kOhm)

Divider R\_bottom (kOhm)

NTC target temperature (C)Beta model for low-side NTC with pull-up to Vref

NTC R25 (kOhm)

NTC Beta B25/85 (K)

NTC series pull-up (kOhm)

Quick presets:

1 LSB Step 0.8057 mV 4,096 total codes

Pin Voltage (ADC) 1.6504 V At count 2048 / 4095

Pre-Divider Input 3.301 V Scale x2.00 (10k / 10k)

NTC @ 200 C code 560 0.745 kOhm / 0.451 V

Code -> NTC Temp 114.4 C Implied by raw count 2048

CircuitTwin sensor-stimulus suite.yaml snippet

```
version: 1
board: arduino-mega2560
firmware: build/app.elf
tests:
  - name: ntc-adc-stimulus-and-open-circuit
    stimuli:
      - at_ms: 0
        target: mcu
        pin: ADC0
        voltage_v: 0.4513 # 200 C (0.745 kOhm, code 560)
      - at_ms: 500
        target: mcu
        pin: ADC0
        voltage_v: 3.300 # unplugged NTC open-circuit fault
    expect:
      console_contains: "THERMISTOR_OPEN_FAULT"
      exit_code: 0
```

## Key ADC and thermistor equations

Analog regressions often hide inside fixed-point integer scaling. Testing open-circuit and shorted-sensor voltages in CI catches thermal runaway bugs before a heater board ever powers up.

| Quantity      | Equation                                     | Firmware note                                                      |
| ------------- | -------------------------------------------- | ------------------------------------------------------------------ |
| 1 LSB         | Vref / 2^N                                   | 0.8057 mV/LSB on a 12-bit 3.3 V MCU ADC.                           |
| Divider scale | V\_in = V\_adc \* (R\_top + R\_bot) / R\_bot | Use 32-bit integer arithmetic before shifting to prevent overflow. |
| NTC Beta      | R(T) = R25 \* exp(B \* (1/T - 1/298.15))     | T in Kelvin; check ADC saturation bounds at -40 C and +300 C.      |

## Frequently asked questions

| Question                                                                | Answer                                                                                                                                                                                                                                        |
| ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Should ADC scaling divide by 2^N or (2^N - 1)?                          | Step width (1 LSB) is Vref / 2^N for an ideal N-bit SAR converter. Full-scale code 2^N - 1 maps to Vref - 1 LSB, though many firmware lookup tables approximate code / (2^N - 1) \* Vref to map max code directly to Vref.                    |
| Why do high-impedance resistor dividers distort STM32 SAR ADC readings? | The internal sampling capacitor must charge through the external source impedance during the configured sampling window. If R\_top \|\| R\_bottom exceeds 10 kOhm, lengthen ADC\_SMPR sample cycles or add a 10 nF filter capacitor at the pin. |
| How does firmware detect an unplugged NTC thermistor?                   | In a low-side NTC divider with a pull-up to Vref, an open wire drives the ADC input to full-scale code (e.g. 1023 on 10-bit AVR or 4095 on 12-bit STM32). A shorted probe pulls the pin to 0 counts.                                          |

[Twin: ADS1115 16-bit I2C ADC](https://circuittwin.ai/twins/ads1115) [Twin: HX711 24-bit Bridge ADC](https://circuittwin.ai/twins/hx711) [Board: Arduino Mega 2560 (Marlin RAMPS)](https://circuittwin.ai/boards/arduino-mega2560) [Guide: Marlin Thermal Runaway CI](https://circuittwin.ai/guides/marlin-firmware-testing-ci)

> ## Drive deterministic analog stimuli and open-sensor faults in CI
>
> Inject exact pin voltages and unplugged-thermistor faults into your compiled AVR or STM32 ELF with CircuitTwin.
>
> [Start now](https://app.circuittwin.ai/try) [Marlin CI testing guide](https://circuittwin.ai/guides/marlin-firmware-testing-ci) [Connect a coding agent](https://circuittwin.ai/docs/agents)
