Help with two or more modbus devices on RS485 over TCP - RS485 converter

Begonnen von dudasekk, 25 Juli 2019, 19:14:52

Vorheriges Thema - Nächstes Thema

dudasekk

Hello,
I have ETH/RS485 converter and on RS485 I have 2 modbus devices.
If I create virtual serial port via socat

### Create virtual serial interface via
### socat -d -d -d pty,link=/home/karel/com1,echo=0,crnl tcp:ew11-1:8899
define MB1 Modbus /home/karel/com1@9600,8,N,1

define Relay4_6 ModbusAttr 6 10 RTU
attr Relay4_6 IODev MB1

define MD01_01_ew111 ModbusMD0X 30 30 RTU
attr MD01_01_ew111 IODev MB1


Is there clearly definition ?

define  xxx ModbusAttr 6 10 aaa.bbb.ccc.ddd:8899 RTU
define yyy ModbusAttr 30 30 aaa.bbb.ccc.ddd:8899 RTU

have problems with open/close and no response.
Thank you

pejonp

Example Definition usb-port to tcpip

Sender:
socat TCP4-LISTEN:54321,fork,reuseaddr /dev/signald2,raw,echo=0,b57600 &

Empfänger:(defmod WH2 SIGNALduino Inet-IP:54321)

define Relay4_6 ModbusAttr 6 10 inet-ip:54321 RTU

Pejonp
LaCrossGW 868MHz:WT470+TFA+TX37-IT+EMT7110+W136+WH25A HP1003+WH2621
SignalD(CC1101):Bresser+WS-0101(868MHz WH1080)+Velux KLF200+MAX!+HM-MOD-UART:Smoke HM-SEC-SD+VITOSOLIC 200 RESOL VBUS-LAN+SolarEdge SE5K(Modbus)+Sonnen!eco8(10kWh)+TD3511+DRT710M(Modbus)+ZigBee+Z-Wave+MQTT+vitoconnect

dudasekk

Hi,
It is working if I have only one modbus device connected to Eth2RS485 converter, but not working when two or more devices on RS485.
I try it before.
My connection:

Fhem server --- network --- Eth2RS485 ---- Relay4_6 --- MD01 [ ---- other modbus devices ]
                       ^^^^^^^^^^^^^                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                        Ethernet          8899 - RS485    RS485

I need to define Modbus bus and then define multiple devices connected to this bus with different address.

Thank you
Karel

pejonp

LaCrossGW 868MHz:WT470+TFA+TX37-IT+EMT7110+W136+WH25A HP1003+WH2621
SignalD(CC1101):Bresser+WS-0101(868MHz WH1080)+Velux KLF200+MAX!+HM-MOD-UART:Smoke HM-SEC-SD+VITOSOLIC 200 RESOL VBUS-LAN+SolarEdge SE5K(Modbus)+Sonnen!eco8(10kWh)+TD3511+DRT710M(Modbus)+ZigBee+Z-Wave+MQTT+vitoconnect

dudasekk

Hi,
relay module and MD module ( temperature and humidity) are slaves. One master is fhem server. Slaves are connected on RS485 bus via EW11 (WIFI to RS485).
My full working config is in attachment. I would like to make direct connection to RS485 bus via TCP port for more slaves.
I think, this is for change in 98_Modbus.pm.

BrainHunter

Hi,

this is funny, I did the same thing today...
Is there a better way without socat?



disney


Would I be right in thinking you are trying to connect two PZEM power monitors to FHEM?

If so, my approach may work for you.

Basically, I used 5V esp8266 modules plus the sonoff-tasmota firmware to make the PZEM modules wireless allowing the data to be sent to FHEM via an MQTT server.

I am using PZEM-16 modules which output RS485. These were modified to output TTL level serial data by removing the internal MAX485 chip and addind two internal jumper wires to bring the TTL serial out via the four terminal screw connectors. It then only requires four short wires to provide power and the TTL serial port to the ESP8266.  An addational 100uf cap across the power lines to allow the ESP8266 to work reliably.

The sonoff-tasmota firmware already has support for the PZEM-04 and PZEM-16 modules so the rest is just configuration. 

If you want I can post some images of the mod if you want to try this yourself.