Hello everyone,
this is my first experience with ESPHome so please be patience with me
I bought this combined sensor which allows me to read the water flow with Hall effect, which has also a temperature probe to measure the temperature of the water
As board I’m using this ESP32 (version: ESP-32-CP2102):
https://it.aliexpress.com/item/1005005396344075.html
because I read that for ADC reading, ESP8266 is not very reliable
This is the probe:
https://it.aliexpress.com/item/1005004651835855.html
My understanding is that I need to use a NTC sensor which read a resistance value and convert it to a °C temperature: NTC Sensor — ESPHome
Following this I created the circuit with the resistance:
From the item description, I found the specifications of the probe
Terminal 5 Temp. Sensor
(13) Connector: Housing XH2.5-3P
TEMPERATURE VS RESISTANCE TABLE
Resistance 50k Ohms at 25deg. C
B Value 3950K at 25/50 deg. C
Temp. Range:-40-+150℃
This is the circuit I made so far:
And this is the yaml code I uploaded:
- platform: adc
id: source_sensor
pin: GPIO34
name: "ADC Temperature"
attenuation: auto
update_interval: never
- platform: resistance
id: resistance_sensor
sensor: source_sensor
configuration: DOWNSTREAM
resistor: 50.9kOhm
name: Resistance Sensor
reference_voltage: 3.3V
- platform: ntc
sensor: resistance_sensor
calibration:
b_constant: 3950
reference_temperature: 25°C
reference_resistance: 50kOhm
name: Water Temperature
switch:
- platform: gpio
pin: GPIO32
id: ntc_vcc
interval:
- interval: 60s
then:
- switch.turn_on: ntc_vcc
- delay: 1s
- component.update: source_sensor
- delay: 1s
- component.update: source_sensor
- delay: 1s
- component.update: source_sensor
- delay: 1s
- switch.turn_off: ntc_vcc
While the code is working, the values that are given are too much apart for the same reading, check this example:
[08:53:20][D][switch:012]: 'ntc_vcc' Turning ON.
[08:53:20][D][switch:055]: 'ntc_vcc': Sending state ON
[08:53:21][D][sensor:094]: 'ADC Temperature': Sending state 1.81772 V with 2 decimals of accuracy
[08:53:21][D][resistance:039]: 'Resistance Sensor' - Resistance 62418.5Ω
[08:53:21][D][sensor:094]: 'Resistance Sensor': Sending state 62418.45703 Ω with 1 decimals of accuracy
[08:53:21][D][ntc:026]: 'Water Temperature' - Temperature: 20.1°C
[08:53:21][D][sensor:094]: 'Water Temperature': Sending state 20.08983 °C with 1 decimals of accuracy
[08:53:22][D][sensor:094]: 'ADC Temperature': Sending state 1.82594 V with 2 decimals of accuracy
[08:53:22][D][resistance:039]: 'Resistance Sensor' - Resistance 63051.0Ω
[08:53:22][D][sensor:094]: 'Resistance Sensor': Sending state 63050.96484 Ω with 1 decimals of accuracy
[08:53:22][D][ntc:026]: 'Water Temperature' - Temperature: 19.9°C
[08:53:22][D][sensor:094]: 'Water Temperature': Sending state 19.87050 °C with 1 decimals of accuracy
[08:53:23][D][sensor:094]: 'ADC Temperature': Sending state 1.74221 V with 2 decimals of accuracy
[08:53:23][D][resistance:039]: 'Resistance Sensor' - Resistance 56925.9Ω
[08:53:23][D][sensor:094]: 'Resistance Sensor': Sending state 56925.94141 Ω with 1 decimals of accuracy
[08:53:23][D][ntc:026]: 'Water Temperature' - Temperature: 22.1°C
[08:53:23][D][sensor:094]: 'Water Temperature': Sending state 22.10882 °C with 1 decimals of accuracy
[08:53:24][D][switch:016]: 'ntc_vcc' Turning OFF.
[08:53:24][D][switch:055]: 'ntc_vcc': Sending state OFF
3 readings with 1 seconds apart and I’m getting 20° and 22°
(and the actual room temperature, given by 2 other devices, is 18.4).
How can I get a reliable value when every reading has a span of 1-2° apart?
I have multiple example of reading, some times the first value is higher than the last one.
Thank you