kecajtop / dtr0xx_io

MIT License
13 stars 9 forks source link

Help with connecting two or more board relays with esphome rs485 #2

Closed Kentrp closed 1 year ago

Kentrp commented 1 year ago

Hi! I use your esphome .yaml code to flash my 8 relays boards, its work fine, but now i want to connect them between themselves with RS485 2 wires (i want to connect one master board to Ethernet and other boards to connect to the master use RS485 port) , and don't know how to do it, ill be appreciate you to help me, thank you

kecajtop commented 1 year ago

Hi! Esphome is natlivly supporting RS485 master side. That stuff is very easy to do. I have done it before

sensor:

To use esphome as a modbus slave is more tricky. You might need modbus server. I know it sound wrong but RS485 master is a client and the RS485 slave is a server.

modbus_server:

It will require few tries and errors. Debuging will be very helpulf (ESP_LOGI). Additional RS485 to USB cable might be also requaried. Sorry if I cannot be more helful but my board is not accesable at this time so I cannot make any mockups to test it.

Kentrp commented 1 year ago

Hello! I need one more help, how to write binary sensors and sensors in modbusserver i can't get it work correct, thank you

kecajtop commented 1 year ago

Hi,

What would be your address and register number?

Kentrp commented 1 year ago

It's doesn't matter i just need example (slave address 2 register numbers 210-220)

Kentrp commented 1 year ago

#######Master board modbus_server:

Slave board:

Its work ok with switch, but i need to get binary sensors and temperature sensors, ill be appreciate for help

kecajtop commented 11 months ago

Did you sove this problem?

Kentrp commented 11 months ago

No, i don't know if it possible to do, i want to use pin for Dallas 18b20 sensor

kecajtop commented 11 months ago

Are you good in soldering?

Kentrp commented 11 months ago

Are you good in soldering?

Yes I am

kecajtop commented 11 months ago

Are we still talking about modbus problem or just temp sensor? Are you using ethernet port as well or just wifi?

Kentrp commented 11 months ago

Yes want to connect sensor to relay and if it possible to send data from one to another relay using rs485 ( modbus) I use ethernet in one relay and wifi in another one

kecajtop commented 11 months ago

You might need to use spear pins. I did that before for i2c display

i2c: sda: 4 scl: 5 scan: true id: bus_a frequency: 400kHz

so for dallas chip

sensor:

dallas:

Don't forget 4.7k pull up resistor to 3.3V

kecajtop commented 11 months ago

Or you can use RX pin image you just need to disable uart logs

Kentrp commented 11 months ago

It’s mean to connect dallas sensor to i2c pin 4 data wires?

Kentrp commented 11 months ago

Or you can use RX pin image you just need to disable uart logs

I used this pins in other projects like binary sensor and relay after power off dead i need to reflash it

Kentrp commented 11 months ago

Im interesting to use input to connect sensors, its easy to connect using available contacts

kecajtop commented 11 months ago

try to use pin 4 platform: dallas address: 0x5f000000560bdf28 # id can be obtained from logs on first boot name: ${friendly_name} Temperature dallas:

pin: GPIO4 update_interval: 10s

image

Kentrp commented 11 months ago

We’re is pin 4 in relay

kecajtop commented 11 months ago

image bottom right corner pin 26

kecajtop commented 11 months ago

I will try dallas pin tomorrow. My unit is not easly accessible.

kecajtop commented 10 months ago

I made some progress last evening. I was able to send some intigiger value of the internal temp sensor via modbus.

kecajtop commented 10 months ago

image

kecajtop commented 10 months ago

modbus_server:

sensor:

dallas: pin: GPIO4 update_interval: 10s

kecajtop commented 10 months ago

image

Kentrp commented 10 months ago

Hi can it send more then 1 data sensors through modbus

kecajtop commented 10 months ago

image

kecajtop commented 10 months ago

Did it work?