Skip to content
Snippets Groups Projects
Commit e07f2cea authored by Jan Grewe's avatar Jan Grewe
Browse files

add STS35

parent fbc152d9
No related branches found
No related tags found
No related merge requests found
Pipeline #884 passed
......@@ -14,7 +14,6 @@ packages:
esp32: !include packages/esp32.yaml
time: !include packages/time_schedule.yaml
bme280: !include packages/bme280.yaml
yieryi2178: !include packages/yieryi3178.yaml
scd40: !include packages/scd40.yaml
mlx90614: !include packages/mlx90614.yaml
gp8403: !include packages/gp8403.yaml
......@@ -24,3 +23,7 @@ packages:
fan_scripts: !include packages/fan_scripts.yaml
light_power: !include packages/light_power.yaml
light_settings: !include packages/light_settings.yaml
ads1115: !include packages/ads1115.yaml
ec: !include packages/ec.yaml
ph: !include packages/ph.yaml
sts35: !include packages/sts35.yaml
substitutions:
ec_k: '0.992'
ec_k: '0.97090'
# ec_ref & ec_res2: https://github.com/DFRobot/DFRobot_EC/blob/master/DFRobot_EC.cpp#L28 // https://www.dfrobot.com/forum/topic/28708
ec_ref: '200.0'
ec_res2: '820.0'
......@@ -18,7 +18,7 @@ sensor:
gain: 4.096 # max: 3.4V
update_interval: 5s
accuracy_decimals: 5
<<: !include filter.yaml
#<<: !include filter.yaml
- platform: template
name: "EC: K Value"
unit_of_measurement: "K"
......@@ -32,10 +32,9 @@ sensor:
accuracy_decimals: 3
update_interval: 5s
lambda: |-
float water_temperature = 20.0;
float ec_raw = id(analog_ec).state / ${ec_res2} / ${ec_ref} * 1000.0 * 1000.0;
float ec = ec_raw * id(ec_k);
return ec / (1 + (0.0185 * (water_temperature - 25))); // return with temperature correction
return ec / (1 + (0.0185 * (id(water_temperature).state - 25))); // return with temperature correction
button:
- platform: template
......@@ -43,13 +42,12 @@ button:
on_press:
- then:
- lambda: |-
float water_temperature = 20.0;
float buffer_solution = -1;
if (id(ec).state > 0.9 && id(ec).state < 1.9) { // recognize 1.413us/cm buffer solution
ESP_LOGI("ec", "Calibrating EC with 1.413 mS/cm solution");
buffer_solution = 1.413 * (1.0 + 0.0185 * (water_temperature - 25.0));
buffer_solution = 1.413 * (1.0 + 0.0185 * (id(water_temperature).state - 25.0));
} else if (id(ec).state > 9 && id(ec).state < 16.8) { // recognize 12.88ms/cm buffer solution
buffer_solution = 12.88 * (1.0 + 0.0185 * (water_temperature - 25.0));
buffer_solution = 12.88 * (1.0 + 0.0185 * (id(water_temperature).state - 25.0));
ESP_LOGI("ec", "Calibrating EC with 12.88 mS/cm solution");
} else {
ESP_LOGI("ec", "Not calibrating EC, probe not in 1.413 or 12.88 mS/cm solution");
......
substitutions:
ph400_raw: '2.068'
ph686_raw: '1.574'
ph700_raw: '1.555'
ph918_raw: '1.215'
ph400_raw: '2.06785'
ph686_raw: '1.57897'
ph700_raw: '1.54883'
ph918_raw: '1.21447'
globals:
- id: ph400_raw # raw V value from probe using pH 4.0 calibration solution.
......@@ -30,7 +30,7 @@ sensor:
gain: 4.096 # max: 3.0V
update_interval: 5s
accuracy_decimals: 5
<<: !include filter.yaml
#<<: !include filter.yaml
- platform: template
name: "pH: 4.00 Calibration Value"
unit_of_measurement: "V"
......
sensor:
- platform: sts3x
id: water_temperature
name: "Water: Temperature"
address: 0x4a
update_interval: 5s
accuracy_decimals: 2
<<: !include filter.yaml
prometheus:
relabel:
water_temperature:
id: temperature_water
name: "Water: Temperature"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment