tanky321 / HVAC_Monitor

30 stars 3 forks source link

In building this project, I found a couple of minor issues with the code. Likely due to library and ESPHome changes. #1

Open ratsputin opened 1 year ago

ratsputin commented 1 year ago

I'm currently working on building this project and I had some significant issues getting it to built with the latest version of ESPHome and the libraries you used.

I currently have it partially working and wanted to pass along the changes I had to make.

The first change is in HVACPCB.h. Apparently, your configuration somehow knew the correct pins for the signals for the 31856. Unfortunately, that didn't work in my case. I had to specify the pins by making the following minor changes:

  Adafruit_MAX31856 maxthermo1 = Adafruit_MAX31856(14, 18, 19, 5);
  Adafruit_MAX31856 maxthermo2 = Adafruit_MAX31856(27, 18, 19, 5);
  Adafruit_MAX31856 maxthermo3 = Adafruit_MAX31856(15, 18, 19, 5);

In addition, there have been some changes in the YAML configuration for ESPHome. It was necessary to explicity specify the proper libraries and the board identifier has changed a bit. Without the below changes, the project wouldn't even build. Here is the first section of my config:

esphome:
  name: esphome-web-f3c690
  friendly_name: "Upstairs HVAC"
  libraries:
    - SPI
    - Wire
    - adafruit/Adafruit BusIO@^1.14.1
    - adafruit/Adafruit MAX31856 library@^1.2.5
    - https://github.com/Sensirion/arduino-sdp
  includes:
    - HVACPCB.h

esp32:
  board: adafruit_feather_esp32_v2
  variant: esp32
  framework:
    type: arduino

Hopefully, this helps anyone else who decides to build this project. I'm still working through the various sensors, so I'm unsure if there will be other changes.

tanky321 commented 1 year ago

Apologies for not updating the repo... this has kind of fallen off my radar over the years.

One thing to note is that all of these sensors are now supported by ESPHome, so custom libraries are no longer needed. I had a ESP board fail on me, so I had to redo the config. Current config is below which might make your life easier.

I apologize in advance, im a hot mess with github...

esphome:
  name: hvac-mon

esp32:
  board: featheresp32
  framework:
    type: esp-idf

#Removed the networking stuff for clarity

spi:
  clk_pin: GPIO5
  miso_pin: GPIO19
  mosi_pin: GPIO18

#I2C
i2c:
  - id: bus_a
    sda: 23
    scl: 22
    scan: True
status_led:
  pin: 
    number: 13

tca9548a:
  - address: 0x70
    id: multiplex0
    i2c_id: bus_a
    channels:
      - bus_id: multiplex0channel0
        channel: 0
      - bus_id: multiplex0channel1
        channel: 1

sensor:
  - platform: sdp3x
    name: "HVAC Dif Pressure"
    i2c_id: multiplex0channel0
    address: 0x25
    update_interval: 10s
    unit_of_measurement: inH2O
    filters:
      - multiply: 0.4014630

  - platform: max31856
    name: "HVAC Temperature 1"
    cs_pin: GPIO14
    update_interval: 10s

  - platform: max31856
    name: "HVAC Temperature 2"
    cs_pin: GPIO27
    update_interval: 10s

  - platform: max31856
    name: "HVAC Temperature 3"
    cs_pin: GPIO15
    update_interval: 10s

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO34
      inverted: True
      mode: INPUT
    name: "HVAC Heating"
  - platform: gpio
    pin:
      number: GPIO39
      inverted: True
      mode: INPUT
    name: "HVAC Cooling"
  - platform: gpio
    pin:
      number: GPIO36
      inverted: True
      mode: INPUT
    name: "HVAC Fan On"
  - platform: gpio
    pin:
      number: GPIO4
      inverted: True
      mode: INPUT_PULLUP
    name: "HVAC H2O Detect #1"
  - platform: gpio
    pin:
      number: GPIO21
      inverted: True
      mode: INPUT_PULLUP
    name: "HVAC H2O Detect #2"
  - platform: status
    name: "HVAC Monitor Status"

switch:
  - platform: restart
    name: "HVAC Monitor Restart"
ratsputin commented 1 year ago

You just saved me a ton of time and effort. Thank you for posting this!

ratsputin commented 1 year ago

One again, thank you for giving me that code. It worked like a champ.

I do have a couple of questions for you regarding this project:

  1. Do you know where I can get the box you used to hold the board? That would be ultra-helpful.
  2. The two H2O sensors don't work at all; nor do the LEDs light. I've double-checked my work, so I'm sure I've got everything hooked up correctly and the right parts. Does that circuit work?

Thanks again for your assistance and putting this board up. I live on the Gulf Coast and my A/C runs about 18 hours a day. This is something I've been looking for for a very long time.

tanky321 commented 1 year ago

Glad you got it to work! I think I bought the box off of amazon, however I believe I laser cut an acrylic adapter plate for mounting the board to the box. I think it was this enclosure: https://www.amazon.com/gp/product/B0786ZLFSV/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&th=1

I can laser cut an adapter for you, email me at demedeirosa @ gmail

I never got around to implementing the H2O sensors, however the circuits themselves should be functional. Might need to tweak the resistors? Those 100K resistors might need to go up much higher, maybe 1meg? The base current is going to be incredibly small so the 100K resistors there might be too hard of a pull down. I think you can also get rid of the 10K resistors in parallel with the LEDs.

Out of curiosity, did I send you a board or did you send out the gerbers to get the boards fabbed?

Also, one thing I noticed is that its difficult to get an accurate reading of static pressure due to the drastic on/off change. I made up the following filtered sensor which only logs if the pressure is above 0.4inH2O. Might need to tweak that based on the static pressure of your system.

- platform: template
    sensors:
      hvac_pressure_filtered:
        friendly_name: HVAC_Pressure
        unit_of_measurement: inH2O
        value_template: >
          {% if states('sensor.hvac_dif_pressure') | float > 0.4 %}
            {{ states('sensor.hvac_dif_pressure') }}
          {% else %}
            {{states('sensor.HVAC_Pressure_Filtered')}}
          {% endif %}