Hi all,
I have a humidity control system using a pump and humidity sensor. To control humidity I have a SHT31 sensing and providing a value to a PID climate platform (will probably be replaced by a bang-bang controller due to difficulties in tuning and probably overkill for this purpose). This then outputs to a Slow PWM to cycle the motor.
What I’m seeing is the Slow PWM platform reset it’s period before the set time has elapsed (currently set to 800s). This is causing humidity overshoots. To confirm this I have it output to the log and can see it sometimes restarting the cycle well before before the set period has elapsed.
Am I using this incorrectly? Or is this unexpected behavior? Is it possible I’m using too much of the stack with my filters? The correct value is always displayed for humidity and temperature.
Cheers
My Logs:
[10:26:34][D][main:308]: Changed state
[10:26:34][D][main:064]: Pump Stopped off action
[10:26:44][D][main:308]: Changed state
[10:26:44][D][main:050]: Pump Start
[10:26:45][D][main:308]: Changed state
[10:26:45][D][main:064]: Pump Stopped off action
[10:26:45][D][main:058]: Pump Stopped
[10:27:00][D][main:308]: Changed state
[10:27:00][D][main:050]: Pump Start
[10:27:00][D][main:058]: Pump Stopped
[10:27:09][D][main:308]: Changed state
[10:27:09][D][main:064]: Pump Stopped off action
[10:27:15][D][main:308]: Changed state
[10:27:15][D][main:050]: Pump Start
[10:27:16][D][main:058]: Pump Stopped
[10:27:21][D][main:308]: Changed state
[10:27:21][D][main:064]: Pump Stopped off action
And my code:
esphome:
name: controller
on_boot:
priority: -100
# ...
then:
- logger.log: "Bootup"
esp8266:
board: esp01_1m
# Enable logging
logger:
logs:
sht3xd: ERROR
pid: ERROR
climate: ERROR
sensor: ERROR
# Enable Home Assistant API
api:
i2c:
- id: bus_a
sda: GPIO4
scl: GPIO5
scan: false
output:
- platform: gpio
pin: GPIO12
id: pump
- platform: slow_pwm
id: pwm_pump
period: 800s
restart_cycle_on_state_change: false
turn_on_action:
- lambda: |-
auto *out1 = id(pump);
out1->turn_on();
- logger.log: "Pump Start"
- delay: 0.7s
- output.turn_off: pump
- logger.log: "Pump Stopped"
turn_off_action:
- output.turn_off: pump
- logger.log: "Pump Stopped off action"
state_change_action:
- logger.log: "Changed state"
climate:
- platform: pid
id: incubator_humidity_pid
name: "PID Humidity Controller"
sensor: humidity
default_target_temperature: 45
heat_output: pwm_pump
control_parameters:
kp: 0.49460
ki: 0.00487
kd: 6.56301
visual:
min_temperature: 40
max_temperature: 80
temperature_step: 1
sensor:
- platform: sht3xd
i2c_id: bus_a
address: 0x44
update_interval: 35ms
temperature:
id: temp
name: "Temperature"
filters:
- median:
window_size: 414
send_every: 414
send_first_at: 414
accuracy_decimals: 3
humidity:
id: humidity
name: "Humidity"
accuracy_decimals: 3
filters:
- median:
window_size: 414
send_every: 414
send_first_at: 414
- platform: pid
name: "PID Result"
type: RESULT
climate_id: humidity_pid
- platform: pid
name: "PID Output"
type: HEAT
climate_id: humidity_pid