Retrofitting Hayward pool thermistor using ESPHome to integrate into HA

Can’t be bad if it works but it defies the principle of adc…

I’d like to learn…why does it defy the principles ? How would you wire it ?

Thanks @karansoi !

Hi Mviamin, I have a different type of thermistor than the one you have. I think for what I have to work, I will have to figure out the B value, can you share your spreadsheet that you used to log the temperature ranges? I cannot figure out what the formula is for the B value.
Thanks!

There you go, you can grab it here : https://1drv.ms/x/s!AjHjrlYmLKmnoJ98ROeZH0J6v5Xo4g?e=dDH6GI

Disclaimer, it’s been a year, and I do not remember everything I did at the time, other than what I described on the post above in this thread.

Let me know if you have any questions on the spreadsheet and am happy to dive back into it and refresh my memory.

1 Like

Thanks for share your spreadsheet, sorry, but how i get the ADC Top value? tkz

Hi @KaduPortugal, check my post as of May 19th (#10) on top of this thread. Empirically…have not found a better way. But it’s not too bad.

I finally got this to work. Albeit through trial and error with a resistor. I have the same thermistors and would like the temp read-out on HA to be in “F” versus “V” on the dashboard. Is this possible?

image

Edit: Figured it out had to add “unit_of_measurement: “°F””

Just incase anyone comes looking:

The B value for these thermistors at b25/85 = 3977k (based on requesting various data sheets from 3rd party manufacturers that make thermistors that are 1:1 swaps for Hayward official thermistors.

1 Like

totally stealing this with pride. thanks!

1 Like

i tried using the simplified Stenheirt formula but i was not getting consistent results. Instead, i collected a bunch of values from this:

- lambda: return 10000 / (1023/x-1);

And then i did some curve fitting. My final lambda formula ended up like this:

- lambda: |-
          float R;
          R = 10000 / (1023/x-1);
          return (17.214 * R) - 9.1398;

i’m within 1°F with this approach. i suppose i could have ignore the “R” portion altogether and just curve-fitted raw values from the sensor. Still, hope this helps someone. Thanks

It seems that after monitoring for a week or so, I finally got the pool sensors (520272) working using an ESP32 and ADS1115 ADC. ADS A0 and ADS A1 are the 520272 sensors compared to a DHT sensor on the ESP32. They’re all within 1°F.

You can see ADS A1 is “smoother” than A0 due to the averaging you’ll see below.

For anyone still following this thread:
These are the sensors: 520272 10kohm sensors
ADS1115: ADS1115
Sensor Datasheet: 520272 Datasheet
Wiring “hint” that finally worked for me: “red” wire on sensor should go to ground. “white” wire should go to ADC pin. this pin should also have a 10kohm resistor to VCC.
Here’s the relevant code in ESPHome:

## I used an "interval" to only supply VCC to the sensors when i'm reading them.
## This way they dont heat-up unnecessarily from having VCC all the time
interval:
  - interval: 60s
    then:
      - switch.turn_on: sensor_vcc
      - component.update: esp32_test_ads_a0_sensor
      - component.update: esp32_test_ads_a1_sensor
      - switch.turn_off: sensor_vcc

i2c:
  sda: GPIO21
  scl: GPIO22
  scan: true
  id: i2c_bus_a
  setup_priority: -100

ads1115:
  - address: 0x48
    i2c_id: i2c_bus_a
    setup_priority: -100

sensor:
  ## this is ADS A0 without averaging
  - platform: ads1115
    id: esp32_test_ads_a0_sensor
    name: "ESP32 Test ADS A0 Sensor"
    multiplexer: 'A0_GND'
    gain: 4.096
    update_interval: never # see interval section
  ## this is ADS A1 with averaging
  - platform: ads1115
    id: esp32_test_ads_a1_sensor
    name: "ESP32 Test ADS A1 Sensor"
    multiplexer: 'A1_GND'
    gain: 4.096
    update_interval: never # see interval section
    filters:
      ## my attempt to smooth out the voltage readings.  it helps vs not averaging (see control sensor above)
      - median:
          window_size: 5
          send_every: 1
          send_first_at: 1

  - platform: resistance
    id: esp32_test_ads_a0_resistance
    name: "ESP32 Test ADS A0 Resistance"
    sensor: esp32_test_ads_a0_sensor
    configuration: DOWNSTREAM
    resistor: 10.03kOhm # I measured the actual resistance of the sensor instead of using default 10kOhm
    reference_voltage: 3.3V
  - platform: ntc
    id: esp32_test_ads_a0_temperature
    name: "ESP32 Test ADS A0 Temperature"
    sensor: esp32_test_ads_a0_resistance
    calibration:
      b_constant: 3977 #3950 (original); 3977 (B25/85 datasheet); 3995 (B25/100 datasheet)
      reference_temperature: 25°C #24.5°C #25°C 
      reference_resistance: 10kOhm #10.32kOhm #10kOhm ## early attempts at redefining reference.  i just stuck with default (25C/10kohm)

  - platform: resistance
    id: esp32_test_ads_a1_resistance
    name: "ESP32 Test ADS A1 Resistance"
    sensor: esp32_test_ads_a1_sensor
    configuration: DOWNSTREAM
    resistor: 10.08kOhm # i measured the actual resistance of the sensor instead of using default 10kOhm
    reference_voltage: 3.3V
  - platform: ntc
    id: esp32_test_ads_a1_temperature
    name: "ESP32 Test ADS A1 Temperature"
    sensor: esp32_test_ads_a1_resistance
    calibration:
      b_constant: 3977 #3950 (original); 3977 (B25/85 datasheet); 3995 (B25/100 datasheet)
      reference_temperature: 25°C
      reference_resistance: 10kOhm
      ## early attempts at manual calibration.  i stuck with default 25C/10kohm
      #- 5.252kOhm -> 40.167°C
      #- 10.32kOhm -> 24.5°C
      #- 15.27kOhm -> 15.778°C

switch:
  ## this switch controls VCC to sensors
  - platform: gpio
    id: sensor_vcc
    name: "Sensor VCC"
    pin: GPIO23
    restore_mode: ALWAYS_OFF
    #internal: true

I’m hoping this proves useful to someone, and maybe someone can tweak further. Good luck!

Thanks for all the great info’s here.
I’m about to do the same thing on my hayward gas pool heater.

The thermistor hayward is using is a 3 wire thermistor:

Any of you know if I can connect it directly to a esp32 like here?

or should I go trough a ADS1115 before going to the esp.
If that’s the case, anyone know the correct pinout between all that?

Thanks in advance.