NTC Thermistor with Esphome

I have integrated a esp8266 with Esphome with name mystudy.
I have connected a NTC thermistor that is about 8.9K @ 30Deg C. So I assume it is a 10 K thermistor @ 25 Deg C. The thermistor is added in series with a 10 K resistor, with thermistor downstream of the resistor. The Junction of the combine is connected to A0. The top pf resistor is connected to 3.3 V.
The mystudy.yaml file is as below

esphome:
  name: mystudy
  platform: ESP8266
  board:  d1

wifi:
  ssid: "SSID1-2.4G"
  password: "7571908313@"

  
  ap:
    ssid: "Mystudy Fallback Hotspot"
    password: "8csfgeTMT3UB"

captive_portal:


logger:


api:

ota:

###
switch:
  - platform: gpio
    id: kitchen_pump
    name: "led"
    pin:
       number: D9
       inverted: True
  
  - platform: gpio
    id: ntc_vcc
    name: "ntc_vcc"
    pin:
       number: D0
       inverted: False   
       
sensor:
  - platform: ntc
    sensor: resistance_sensor
    calibration:
      b_constant: 3950
      reference_temperature: 25°C
      reference_resistance: 10kOhm
    name: NTC Temperature

  

  - platform: resistance
    id: resistance_sensor
    sensor: source_sensor
    configuration: DOWNSTREAM
    resistor: 10kOhm
    name: Resistance Sensor
  - platform: adc
    id: source_sensor
    pin: A0  

The temperaure shown in my dashboard is 70 Deg C where as it should be 29.8 Deg C.

What have I missed.

1 Like

I dont know why hyphen(-) appears as a bullet.

Because you did not format your pasted code correctly. Read point 11 here then edit your post: How to help us help you - or How to ask a good question

thanks @tom_l, I edited my first post.

How did you obtain the b constant of your thermistor?

I had tested this thermistor with Arduino IDE on the Wemos D1 board and with same calibration assumptions i.e RTh =10K and b= 3950,the temperature on the serial monitor was 30.5 Deg C.

I want to add another question that has emerged.
With what voltage the resistor / thermistor divider is to be powered
A. Vcc(5V) or
B. 3.3 V ?

In either case input to A0 will always be < 3.3V but temperature returned is different.
This is intriguing…

The docs say 3.3V under the self heating mitigation paragraph:

To do this, replace the 3.3V side of the voltage divider

With 3.3V at the top of the 10K and thermistor to ground, what equation is to be used to get reasonably accurate temperature?

https://www.petervis.com/electronics%20guides/calculators/thermistor/thermistor.html

Got correct valu of temperature from my NTC sensor. Read in an article at Randomnerd tutorials that the adc is divided by 3 on board the esp8266 dev boards. I am using a Wemos D1R1 board . Used a filter under adc for multiplication by 3.
Now temperature matches another gauge that I have.

Actually divided by 3.3.

Thanks@tom_l.
Now I think I will need to add a offset to the filter. Would that be a correct approach?

This is my yaml file that is uploaded to esp8266 Wemos DR1

esphome:
  name: playground
  platform: ESP8266
  board: d1

wifi:
  ssid: "soinsmesh"
  password: "3!Syerhacc3!KS"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Playground Fallback Hotspot"
    password: "PY8h1v2eIIyg"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:


switch:
  -  platform: gpio
     id: builtIn_led
     name: "Built In Led"
     pin:
       number:  D9
       inverted:  True
#######
sensor:
  -  platform:  ntc
     sensor:  resistance_sensor
     name:  NTC Temperature B Constant
     calibration:
      b_constant: 3950
      reference_temperature: 25°C
      reference_resistance: 9.9kOhm
      
               
     
  -  platform:  resistance
     id:  resistance_sensor
     sensor:  source_sensor
     configuration:  DOWNSTREAM
     resistor:  9.830kOhm
     reference_voltage:  3.3V
     name:  Resistance Sensor
     
  -  platform:  adc
     id:  source_sensor
     filters:
       -  offset:  -0.042
       -  multiply: 3.3
     pin:  A0
     update_interval:  60s
     

The temperature displayed by this sensor is always same as in another temp device that I have.

2 Likes

How is this rig working for you? I plant to use something similar for my grill, for the meat temperature.

Would you please give me a hand on this? This is my code:

sensor:

  -  platform:  ntc
     sensor:  resistance_sensor
     name:  NTC Temperature B Constant
     calibration:
      b_constant: 3950
      reference_temperature: 25°C
      reference_resistance: 100kOhm
      
               
     
  -  platform:  resistance
     id:  resistance_sensor
     sensor:  source_sensor
     configuration:  DOWNSTREAM
     resistor:  1kOhm
     reference_voltage:  5V
     name:  Resistance Sensor
     
  -  platform:  adc
     id:  source_sensor
     name: ADC Value
     filters:
       -  offset:  -0.042
       -  multiply: 3.3
     pin:  A0
     update_interval:  5s
  

These are my results.

themocouple

Any ideas why the NTC Temp B Constant shows ‘unknown’? Could you please post a picture or diagram of your rig? Thanks!

Thanks for this snippet! The filter makes it working for me :slight_smile:

@laca75tn Under the platform resistance
resistor: 1 K0hm

This must be the same as mentioned under the calibration which is 100K0hm
Check this out

Cheers

@laca75tn Under the platform resistance
resistor: 1 K0hm

This must be the same as mentioned under the calibration which is 100K0hm
Check this out

Cheers

1 Like

@laca75tn Please excuse me and disregard my prev relies to your post.
The NTC thermistor is connected with a resistor thus making it a potential divider. Since a meat thermistor is 100K you can use 100K resistor. This point is connected to adc of esp8266.
Which resistor have you used?
BTW pl excuse, I have been busy with other things not been on this forum.
Regards
Karanbir

2 Likes