diff --git a/board_esp32-C3.yaml b/board_esp32-C3.yaml new file mode 100644 index 0000000..f7f4ef6 --- /dev/null +++ b/board_esp32-C3.yaml @@ -0,0 +1,67 @@ +esphome: + name: ${name} + on_boot: + priority: -200 + then: + - delay: ${onboot_valve_calibration_delay} #1min + - script.execute: valve_maintenance + + project: + name: "nliaudat.floor-heating-controller" + version: "${revision}.dev" + ###### only for ESP32-C3 boot loop fix + platformio_options: + board_build.f_flash: 40000000L + board_build.flash_mode: dio + board_build.flash_size: 4MB + +substitutions: + #board and compilation + board: esp32-c3-devkitm-1 #ESP C3 supermini : makergo_c3_supermini or nologo_esp32c3_super_mini or seeed_xiao_esp32c3 , esp32-c3-devkitm-1 + variant: esp32c3 + framework: esp-idf #arduino + + # https://www.sudo.is/docs/esphome/boards/esp32c3supermini/ + #Pin definition + sn74hc595_data_pin: GPIO21 + sn74hc595_clock_pin: GPIO10 + sn74hc595_latch_pin: GPIO20 + # sn74hc595_oe_pin: GPIO18 + adc_bemf_1_pin: GPIO0 + adc_bemf_2_pin: GPIO1 + adc_bemf_3_pin: GPIO3 + adc_bemf_4_pin: GPIO4 + onewire_pin: GPIO6 + +esp32: + board: ${board} + framework: + type: ${framework} #esp-idf #arduino + version: recommended #latest + sdkconfig_options: + CONFIG_COMPILER_OPTIMIZATION_SIZE: y + # Advanced tweaking options for ESP32-C3 + advanced: + ignore_efuse_mac_crc: false + +preferences: + flash_write_interval: 60min + + +ota: + - platform: esphome + +safe_mode: + + +# https://git.sudo.is/ben/infra/src/branch/main/roles/hass-esphome/files/packages/boards/esp32c3supermini.yaml + +# light: + # - platform: status_led + # name: "${name} Status LED" + # id: espc3_status_led + # icon: "mdi:alarm-light" + # pin: + # number: GPIO8 + # inverted: true + # restore_mode: ALWAYS_OFF \ No newline at end of file diff --git a/changelog.md b/changelog.md index 981146e..34df813 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,11 @@ # change log +## v117: +* Add ESP32C3 board support (esp32-c3-devkitm-1) +* Add board Pin definition in board_xx.yaml +* Separate logger config in logger.yaml +* Separate sn74hc595 config in sn74hc595.yaml +* sn74hc595 : remove OE pin not needed anymore by esphome (connected to GND) +* add onewire sample configuration ## v116: * Revert ADC multisampling - not working good ## v115: diff --git a/config.yaml b/config.yaml index 838cf6d..211cf94 100644 --- a/config.yaml +++ b/config.yaml @@ -9,12 +9,8 @@ substitutions: name: floor-heating-controller friendly_name: "Floor heating" - revision: "1.115" - - #board and compilation - board: nodemcu-32s - framework: esp-idf #arduino - + revision: "1.117" + #time TZ: "Europe/Zurich" #timezone reboot_days_of_week: "MON" @@ -436,8 +432,12 @@ packages: + + board: !include board_esp32.yaml + # board: !include board_esp32-C3.yaml + logger: !include logger.yaml + sn74hc595: !include sn74hc595.yaml wifi: !include wifi.yaml - board: !include board.yaml time: !include time.yaml script_calibrate_valves: !include script_calibrate_valves.yaml switch_others: !include switch_others.yaml @@ -445,6 +445,7 @@ packages: sensor_adc: !include sensor_adc.yaml sensor_temperature: !include sensor_temperature.yaml sensor_others: !include sensor_others.yaml + # onwire: !include onewire.yaml diff --git a/logger.yaml b/logger.yaml new file mode 100644 index 0000000..2583bbd --- /dev/null +++ b/logger.yaml @@ -0,0 +1,14 @@ +# Enable logging +logger: + level: DEBUG #NONE# ERROR #INFO #DEBUG #VERBOSE + #baud_rate: 0 #to disable logging via UART + logs: + adc: INFO + sensor: ERROR + binary_sensor: INFO + cover: INFO + switch: INFO + climate: INFO + endstop : DEBUG + text_sensor : ERROR + homeassistant.sensor: ERROR \ No newline at end of file diff --git a/onewire.yaml b/onewire.yaml new file mode 100644 index 0000000..d50f5f2 --- /dev/null +++ b/onewire.yaml @@ -0,0 +1,9 @@ +one_wire: + - platform: gpio + pin: ${onewire_pin} + +sensor: + - platform: dallas_temp + address: 0x1234567812345628 + name: temperature + update_interval: 120s \ No newline at end of file diff --git a/sensor_adc.yaml b/sensor_adc.yaml index ee464bf..cb0674c 100644 --- a/sensor_adc.yaml +++ b/sensor_adc.yaml @@ -5,7 +5,7 @@ sensor: ### new version with opamp ## in use the motor use 15-20 mV. At endstop, it raise to 50 mV - platform: adc - pin: GPIO36 + pin: ${adc_bemf_1_pin} #GPIO36 name: "BEMF 1" #CH1 + CH2 update_interval: 100ms # the start of motor need a lot of current (>480 mv), it must be averaged to not trigger the endstop. If 10ms, it always stop. The BEMF trigger must be approx 0.32mv attenuation : 0db @@ -19,7 +19,7 @@ sensor: id : BEMF_1_2_sensor_ADC - platform: adc - pin: GPIO39 + pin: ${adc_bemf_2_pin} #GPIO39 name: "BEMF 2" #CH3 + CH4 update_interval: 100ms attenuation : 0db @@ -34,7 +34,7 @@ sensor: id : BEMF_3_4_sensor_ADC - platform: adc - pin: GPIO34 + pin: ${adc_bemf_3_pin} #GPIO34 name: "BEMF 3" #CH5 + CH6 update_interval: 100ms attenuation : 0db @@ -48,7 +48,7 @@ sensor: id : BEMF_5_6_sensor_ADC - platform: adc - pin: GPIO35 + pin: ${adc_bemf_4_pin} #GPIO35 name: "BEMF 4" #CH7 + CH8 update_interval: 100ms attenuation : 0db diff --git a/sn74hc595.yaml b/sn74hc595.yaml new file mode 100644 index 0000000..8346982 --- /dev/null +++ b/sn74hc595.yaml @@ -0,0 +1,9 @@ +# SN74HC595 I/O Expander (shift register) to control L9110s chips +# https://esphome.io/components/sn74hc595.html +sn74hc595: + - id: 'sn74hc595_hub' + data_pin: ${sn74hc595_data_pin} #GPIO16 #Pin connected to SN74HC595 SER input + clock_pin: ${sn74hc595_clock_pin} #GPIO5 #Pin connected to SN74HC595 SRCLK pin + latch_pin: ${sn74hc595_latch_pin} #GPIO17 #Pin connected to SN74HC595 RCLK pin + #oe_pin: ${sn74hc595_oe_pin} #GPIO18 ### needed by esphome, but connected to GND (outputEnable is used only for pwm all the pin) + sr_count: 2 #Number of daisy-chained shift registers, up-to 4 \ No newline at end of file