From 03d2621a4690621f4a6c30151a0705dfa008580c Mon Sep 17 00:00:00 2001 From: 3D <3d@n3rd3d.com> Date: Thu, 22 Dec 2022 21:44:28 +0100 Subject: [PATCH] update popcorn maker --- functions | 2 +- .../templates/config/esphome_popcorn.yaml | 101 +++++++++++++++--- 2 files changed, 87 insertions(+), 16 deletions(-) diff --git a/functions b/functions index e8a04941..900377e4 160000 --- a/functions +++ b/functions @@ -1 +1 @@ -Subproject commit e8a049414bca2b14b158444dac1b94c2ca90d9be +Subproject commit 900377e4f72486f6699ecf736f96adfbc04e92da diff --git a/intern/docker_esphome/templates/config/esphome_popcorn.yaml b/intern/docker_esphome/templates/config/esphome_popcorn.yaml index 465104cb..d37d57b5 100644 --- a/intern/docker_esphome/templates/config/esphome_popcorn.yaml +++ b/intern/docker_esphome/templates/config/esphome_popcorn.yaml @@ -13,9 +13,18 @@ spi: - miso_pin: GPIO19 - mosi_pin: GPIO23 - clk_pin: GPIO18 + - mosi_pin: GPIO23 + clk_pin: GPIO18 + id: spi_display + + - miso_pin: GPIO13 + clk_pin: GPIO14 + id: spi_temp + +i2c: + sda: GPIO1 + scl: GPIO22 + scan: True climate: - platform: pid @@ -25,9 +34,9 @@ climate: default_target_temperature: 264 heat_output: pot_heater control_parameters: - kp: 0.0 - ki: 0.0 - kd: 0.0 + kp: 0.49460 + ki: 0.00487 + kd: 12.56301 visual: min_temperature: 0 max_temperature: 275 @@ -40,11 +49,12 @@ button: - climate.pid.autotune: pid_heater sensor: - - platform: max31855 + - platform: max6675 name: "Pot Temperature" + spi_id: spi_temp + cs_pin: GPIO27 id: pot_sensor - cs_pin: GPIO15 - update_interval: 30s + update_interval: 1s - platform: pid name: "PID Heater Result" type: RESULT @@ -60,14 +70,44 @@ sensor: - platform: pid name: "PID HEAT Result" type: HEAT + - platform: bme280 + temperature: + name: "Temp" + oversampling: 16x + filters: + - sliding_window_moving_average: + window_size: 3 + send_every: 3 + send_first_at: 3 + pressure: + name: "Pressure" + oversampling: 16x + accuracy_decimals: 2 + filters: + - sliding_window_moving_average: + window_size: 3 + send_every: 3 + send_first_at: 3 + humidity: + name: "Humidity" + oversampling: 16x + accuracy_decimals: 2 + filters: + - sliding_window_moving_average: + window_size: 3 + send_every: 3 + send_first_at: 3 + address: 0x76 + update_interval: 5s + iir_filter: 16x output: - platform: slow_pwm - pin: GPIO0 + pin: GPIO33 id: pot_heater period: 15s - platform: ledc - pin: GPIO4 + pin: GPIO3 id: gpio_4_backlight_pwm binary_sensor: @@ -121,21 +161,25 @@ color: display: - platform: ili9341 model: TFT 2.4 + spi_id: spi_display cs_pin: GPIO5 dc_pin: GPIO16 reset_pin: GPIO17 rotation: 90° lambda: |- - it.printf(160,120,id(temp),TextAlign::CENTER,"%.1f°C",id(pid_heater).current_temperature); + it.printf(160,120,id(temp),TextAlign::CENTER,"%.0f°C",id(pid_heater).current_temperature); if ((id(pid_heater).action) == 0) { it.printf(0,10,id(text),TextAlign::TOP_LEFT,"PID: OFF"); } + else if ((id(pid_heater).action) == 3) { + it.printf(0,10,id(text),TextAlign::TOP_LEFT,"PID: HEATING"); + } else if ((id(pid_heater).action) == 4) { it.printf(0,10,id(text),TextAlign::TOP_LEFT,"PID: IDLE"); } else { - it.printf(0,10,id(text),TextAlign::TOP_LEFT,"PID: ERROR"); + it.printf(0,10,id(text),TextAlign::TOP_LEFT,"PID: ERROR %d",id(pid_heater).action); }; it.printf(0,230,id(text),TextAlign::BOTTOM_LEFT,"Target: %.1f°C",id(pid_heater).target_temperature); @@ -150,19 +194,46 @@ light: name: "ILI9341 Display Backlight" id: back_light restore_mode: ALWAYS_ON + - platform: fastled_spi + rgb_order: BRG + chipset: WS2801 + id: status_led + clock_pin: GPIO25 + data_pin: GPIO26 + num_leds: 3 + name: "NeoPixel Light" + effects: + - addressable_scan: + - addressable_scan: + name: Scan Effect With Custom Values + move_interval: 500ms + scan_width: 1 + - pulse: + - pulse: + name: "Fast Pulse" + transition_length: 0.5s + update_interval: 0.5s + - pulse: + name: "Slow Pulse" + # transition_length: 1s # defaults to 1s + update_interval: 2s text_sensor: - platform: template name: "PID State" id: pid_state + internal: True lambda: |- if ((id(pid_heater).action) == 0) { return {"OFF"}; } + else if ((id(pid_heater).action) == 3) { + return {"HEATING"}; + } else if ((id(pid_heater).action) == 4) { return {"IDLE"}; } else { - return {"NaN"}; + return {"ERROR see Display"}; } - update_interval: 5s + update_interval: 5s \ No newline at end of file -- GitLab