Ich möchte den Füllstand unseres Sicherschachtes mit einem Drucksensor überwachen.
Dieser hat als Ausgang 4-20 mA
Diese habe ich über einen Strom Spannungswandler einem ADS1115 zugeführt.
Diesen dann über I2C an den ESP-12F übergeben.
Siehe dazu auch bei Simon
Nachem ja noch weitere A/D Wandler frei sind und ich noch einige PT1000Fühler im Keller liegen habe, messe doch auch gleich noch 2 Temperaturen.
Es haut alles hin nur die berechneten Temperaturwerte in Grad C stimmen hinten und vorne nicht.
Die Schaltung sieht wie folgt aus
3,3V——-XXXXXXX—+—–Fühler——–GND 1 kOhm ! PT1000 ! Eingang vom ADC1115 Fühler1 A1, Fühler2 A2
ESP Home sieht wie folgt aus
esphome:
name: esphome-web-8cf6a5
friendly_name: Füllstand ESP-12F ESP8266
min_version: 2025.9.0
name_add_mac_suffix: false
esp8266:
board: esp12e
# 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
captive_portal:
# i2c Bus auf D1 und D2 konfigurieren
i2c:
sda: GPIO4 #entspricht D2 bei NodeMCU
scl: GPIO5 #entspricht D1 bei NodeMCU
scan: True
id: bus_a
# ADC einrichten, ADDR-Pin ist auf VCC gelegt, daher Adresse 0x49
ads1115:
- address: 0x49
id: ads1115_49
# ADC Kanal A0 zur Messwerterfassung
sensor:
- platform: ads1115
multiplexer: 'A0_GND'
gain: 4.096
name: "Wasserstand Zisterne cm"
id: levelraw
update_interval: 10s
unit_of_measurement: cm
accuracy_decimals: 1
icon: "mdi:car-coolant-level"
# Messwerte glätten:
filters:
- sliding_window_moving_average:
window_size: 20
send_every: 20
# Spannungen nach Messreihe in Füllhöhe umrechnen
- calibrate_linear:
- 0.0 -> 0.0
- 0.3 -> 10
- 0.69 -> 20
- 1.0 -> 30
- 1.35 -> 40
- 1.75 -> 50
- 2.03 -> 60
- 2.42 -> 70
- 2.7 -> 80
- 3.1 -> 90
# ==========================
# PT1000 Sensor 1 (A1)
# ==========================
- platform: ads1115
multiplexer: 'A1_GND'
gain: 6.144
name: "PT1000-1 Spannung"
id: pt1000_voltage_1
update_interval: 2s
- platform: resistance
sensor: pt1000_voltage_1
configuration: DOWNSTREAM
resistor: 1000.0 # Shunt-Widerstand in Ohm
name: "PT1000-1 Widerstand"
id: pt1000_resistance_1
- platform: template
name: "PT1000-1 Temperatur"
unit_of_measurement: "°C"
accuracy_decimals: 2
update_interval: 2s
lambda: |-
float R = id(pt1000_resistance_1).state;
if (!(isfinite(R)) || R <= 0) return NAN;
float alpha = 3.85e-3; // linearer Temperaturkoeffizient PT1000
float R0 = 1000.0;
float temp = (R / R0 - 1.0) / alpha;
if (temp < -100.0 || temp > 300.0) return NAN;
return temp;
# ==========================
# PT1000 Sensor 2 (A2)
# ==========================
- platform: ads1115
multiplexer: 'A2_GND'
gain: 6.144
name: "PT1000-2 Spannung"
id: pt1000_voltage_2
update_interval: 2s
- platform: resistance
sensor: pt1000_voltage_2
configuration: DOWNSTREAM
resistor: 1000.0
name: "PT1000-2 Widerstand"
id: pt1000_resistance_2
- platform: template
name: "PT1000-2 Temperatur"
unit_of_measurement: "°C"
accuracy_decimals: 2
update_interval: 2s
lambda: |-
float R = id(pt1000_resistance_2).state;
if (!(isfinite(R)) || R <= 0) return NAN;
float alpha = 3.85e-3;
float R0 = 1000.0;
float temp = (R / R0 - 1.0) / alpha;
if (temp < -100.0 || temp > 300.0) return NAN;
return temp;
binary_sensor:
- platform: gpio
pin:
number: GPIO12
mode: INPUT_PULLUP
inverted: true
name: "Hauswasserkraftwerk läuft"
filters:
- delayed_on: 10ms
- delayed_off: 10ms
- platform: gpio
pin:
number: GPIO13
mode: INPUT_PULLUP
inverted: False
name: "Füllstand Dekobrunnen MAX erreicht"
filters:
- delayed_on: 10ms
- delayed_off: 10ms
- platform: gpio
pin:
number: GPIO14
mode: INPUT_PULLUP
inverted: False
name: "Füllstand Dekobrunnen MIN erreicht"
filters:
- delayed_on: 10ms
- delayed_off: 10ms
Als Daten erhalte ich folgendes:
[16:41:26.978][D][sensor:131]: ‘PT1000-1 Spannung’: Sending state 1.53338 V with 3 decimals of accuracy
[16:41:26.979][D][resistance:042]: ‘PT1000-1 Widerstand’ - Resistance 868.0Ω
[16:41:26.987][D][sensor:131]: ‘PT1000-1 Widerstand’: Sending state 867.96863 Ω with 1 decimals of accuracy
[16:41:28.065][D][ads1115.sensor:017]: ‘PT1000-2 Spannung’: Got Voltage=1.533750V
[16:41:28.081][D][sensor:131]: ‘PT1000-2 Spannung’: Sending state 1.53375 V with 3 decimals of accuracy
[16:41:28.081][D][resistance:042]: ‘PT1000-2 Widerstand’ - Resistance 868.4Ω
[16:41:28.093][D][sensor:131]: ‘PT1000-2 Widerstand’: Sending state 868.36530 Ω with 1 decimals of accuracy
[16:41:28.098][D][sensor:131]: ‘PT1000-2 Temperatur’: Sending state -34.19083 °C with 2 decimals of accuracy
[16:41:28.780][D][sensor:131]: ‘PT1000-1 Temperatur’: Sending state -34.29387 °C with 2 decimals f accuracy
Ich habe schon wie ein Weltmeister gegoogelt, aber ohne Erfolg.
Die Berechnung von der Temperatur hat mir ChatGPT so ausgegeben.
Die richtige Temperatur wäre im Moment wo ich die Daten bekommen habe cs 19.8 Grad C
Kann mir jemand einen Tip oder Lösung geben, um wieder ein Problem zu lösen.
Vielen Dank Klaus