Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
T16M ESPHome yaml for home assistant
#1
Code:
esphome:
  name: t16m
  friendly_name: t16m

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ethernet:
  type: W5500
  clk_pin: GPIO42
  mosi_pin: GPIO43
  miso_pin: GPIO44
  cs_pin: GPIO41
  interrupt_pin: GPIO2
  reset_pin: GPIO1

i2c:
   - id: bus_a
     sda: 11
     scl: 12
     scan: true
     frequency: 400kHz

pcf8574:
  - id: 'pcf8574_hub_out_1'  # for output channel 1-16
    i2c_id: bus_a
    address: 0x25
    pcf8575: true

  - id: 'pcf8574_hub_in_1'  # for input channel 1-16
    i2c_id: bus_a
    address: 0x24
    pcf8575: true

uart:
  - id: uart_1    #RS485
    baud_rate: 9600
    debug:
      direction: BOTH
      dummy_receiver: true
      after:
        timeout: 10ms
    tx_pin: 13
    rx_pin: 14

switch:
  - platform: uart
    uart_id: uart_1
    name: "RS485 Button"
    data: [0x11, 0x22, 0x33, 0x44, 0x55]

  - platform: gpio
    name: "t16m-output01"
    id: "t16m_output01"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 0
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "t16m-output02"
    id: "t16m_output02"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 1
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "t16m-output03"
    id: "t16m_output03"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 2
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "t16m-output04"
    id: "t16m_output04"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 3
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "t16m-output05"
    id: "t16m_output05"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 4
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "t16m-output06"
    id: "t16m_output06"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 5
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "t16m-output07"
    id: "t16m_output07"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 6
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "t16m-output08"
    id: "t16m_output08"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 7
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "t16m-output09"
    id: "t16m_output09"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 8
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "t16m-output10"
    id: "t16m_output10"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 9
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "t16m-output11"
    id: "t16m_output11"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 10
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "t16m-output12"
    id: "t16m_output12"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 11
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "t16m-output13"
    id: "t16m_output13"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 12
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "t16m-output14"
    id: "t16m_output14"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 13
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "t16m-output15"
    id: "t16m_output15"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 14
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "t16m-output16"
    id: "t16m_output16"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 15
      mode: OUTPUT
      inverted: true

binary_sensor:
  - platform: gpio
    name: "t16m-input01"
    id: "t16m_input01"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "t16m-input02"
    id: "t16m_input02"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 1
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "t16m-input03"
    id: "t16m_input03"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 2
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "t16m-input04"
    id: "t16m_input04"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "t16m-input05"
    id: "t16m_input05"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "t16m-input06"
    id: "t16m_input06"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 5
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "t16m-input07"
    id: "t16m_input07"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 6
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "t16m-input08"
    id: "t16m_input08"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 7
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "t16m-input09"
    id: "t16m_input09"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 8
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "t16m-input10"
    id: "t16m_input10"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 9
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "t16m-input11"
    id: "t16m_input11"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 10
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "t16m-input12"
    id: "t16m_input12"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 11
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "t16m-input13"
    id: "t16m_input13"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 12
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "t16m-input14"
    id: "t16m_input14"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 13
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "t16m-input15"
    id: "t16m_input15"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 14
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "t16m-input16"
    id: "t16m_input16"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 15
      mode: INPUT
      inverted: true

##pull-up resistance on PCB
  - platform: gpio
    name: "t16m-W1-io8"
    pin:
      number: 8
      inverted: true

  - platform: gpio
    name: "t16m-W1-io9"
    pin:
      number: 9
      inverted: true

  - platform: gpio
    name: "t16m-W1-io10"
    pin:
      number: 10
      inverted: true

  - platform: gpio
    name: "t16m-W1-io15"
    pin:
      number: 15
      inverted: true

  - platform: gpio
    name: "t16m-W1-io16"
    pin:
      number: 16
      inverted: false

  - platform: gpio
    name: "t16m-W1-io17"
    pin:
      number: 17
      inverted:  false

  - platform: gpio
    name: "t16m-W1-io18"
    pin:
      number: 18
      inverted:  false

  - platform: gpio
    name: "t16m-io0"
    pin:
      number: 0
      inverted:  false

web_server:
  port: 80
download yaml file:
.txt   T16M-HA.txt (Size: 7.27 KB / Downloads: 76)
Reply
#2
Hey there,

I've just tried running the T16M with the code above, but the outputs don't seem to behave as expected.

I'm powering the device with 24V DC, and I'm getting 24V from output pins that are unrelated to the one I enabled.

See this screenshot: I'm having pin `1` enabled, am checking output pin `3`, and am reading 24V:


[Image: 2JP5Kyl.jpg]
https://snipfly.io/2JP5Kyl.jpg )

I'm wondering if my wiring assumptions are wrong: how am I supposed to power on/off the various 1~16 pins?

Thanks in advance
Reply
#3
beside OUTPUT , the green two terminal showed "DC" also need connect with 24V
Reply
#4
(03-22-2025, 11:29 PM)admin Wrote: beside OUTPUT , the green two terminal showed "DC" also need connect with 24V

Is there a polarity on these DC and OUTPUT connectors?

Polarity is relevant to me, because I'm attaching everything to DC valves.

My rough diagram (sorry for the sod state of my drawing) for what I have in mind:

[Image: FUCXBx1.jpg]

https://snipfly.io/FUCXBx1.jpg

Sorry if it sounds a bit simplistic: just want to avoid burning through these T16M without even having a chance to use them :S
Reply
#5
your diagram is wrong.
"DC" connect with +24V
if your lamp is AC220v, you should connect with a KC868-E16v2 extend relay module. T16M is output DC24V voltage, not use for AC220V lamp.
Reply
#6
I think the original concern on this specific programming is solved: I just misunderstood that the mosfets bridged `DC` to their OUTPUT pin, rather than their pin with `+` or `-`.

The loads I want to run are 24V DC (no contactor, no relays, no 220V AC). Sorry if I misused a 220V lamp symbol: I'm still very new to all this.

With your wiring diagrams, the last concerns I have are in this other thread: https://www.kincony.com/forum/showthread.php?tid=7860

I'd say that all the provided programming from the original post of this thread is correct / working, once wired correctly, thanks! :-)
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)