ESPHome calculating ntc/adc wrong?!

Hi all,
I think I’m losing my mind.

I had a test circuit with an ESP32 and a 10kOhm NTC that worked fine. So I had a PCB made to attach a couple more NTCs, confirmed with the old configuration that it still worked and started adapting the code for more sensors (of course I didn’t make a backup…).
Now the ESP32 reads the correct voltage, calculates the correct resistance and reports a temperature that’s not even remotely close to correct. I don’t understand what is going on.

I have verified the voltage and resistance with a multimeter and manually calculating it gives me the expected value of ~21 °C. Reference resistor is also actually 10kOhm.

Here is my current configuration:

esphome:
  name: esphome-web-6662b4
  friendly_name: ESP32 Thermometer Warmwasser
  min_version: 2025.9.0
  name_add_mac_suffix: false

esp32:
  variant: esp32
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.1.205
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.1.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0
  # Enable fallback hotspot (captive portal) in case wifi connection fails
captive_portal:

switch:
  - platform: gpio
    pin: GPIO32
    id: ntc_vcc_5
   
interval:
  - interval: 1s
    then:
    - switch.turn_on: ntc_vcc_5
    - component.update: ntc_5
    - switch.turn_off: ntc_vcc_5

sensor:
  - platform: ntc
    sensor: ntc_5
    calibration:
      b_constant: 3590
      reference_temperature: 25°C
      reference_resistance: 10kOhm
    name: NTC Temperature 5

  # Example source sensors:
  - platform: resistance
    id: ntc_r_5
    sensor: ntc_5
    configuration: DOWNSTREAM
    resistor: 10kOhm
    name: Resistance Sensor 5

# ADC sensors
  - platform: adc
    id: ntc_5
    pin: GPIO33
    attenuation: auto
    update_interval: 1s
    filters:
    - sliding_window_moving_average:
        window_size: 60
        send_every: 30
        send_first_at: 30

Help? :frowning:

Once again I wish I could just slap down some C-code.

What’s the point here?

That’s to avoid self-heating. Taken from the official documentation: NTC Sensor - ESPHome - Smart Home Made Simple
1s interval is of course only for testing, so you don’t have to wait forever.

But it shows the same behavior with constantly activated pins.

should be sensor: ntc_r_5

sensor should be using ntc_r_5

2 Likes

Aww man… now I feel really dumb. Thanks a lot to you two for catching that.

Guess I shouldn’t be fiddeling with ESPHome after 10 pm in the future.

1 Like

Still better than 2am… :wink: