Modbus wireless connection

Is there a way to connect wirelessly between a Modbus device and an HA Green hub? E.g. by using the wifi on an ESP32 which is hard wired to the device’s Modbus and uses the wifi to pass the data to the HA, via the router? Or through a Zigbee to modbus converter, if such exist? I have a ZBT-1.

I ask because the distance between the Modbus device and the HA is too large to easily run a RS 485 or USB cable between the two.

Have a look in this repository. Here are some hints what you can do. I plan to use it too.
https://github.com/ViperRNMC/marstek_venus_modbus

1 Like

Modbus can operate over serial (RTU) as RS485, and also ethernet TCP. Using Modbus (TCP) works well.

Using any Modbus to Ethernet converter will allow you to physically wire into the device RS485 serial port, and into the local network via the LAN router. Ideally the converter - LAN connection should be wired for stability, but WIFI will also work.

It is better to use a Modbus aware converter, since Modbus RTU is modified slightly for transport over TCP. A simple RS485 to Ethernet converter will not necessarily perform the Modbus protocol conversion, which means you have to perform that at the computer end.

I use several serial to ethernet converters, and have recently updated my Modbus RS485 to TCP converter that I use with my solar inverter. Although I am using the USR-DR-134 model with a wired Ethernet connection, the manufacturer does provide WIFI devices.

https://www.pusr.com/products/Serial-to-Dual-Band-WiFi-Converter.html

Given the low cost, small size, 5-36v wide power range, and the many features including dual band WIFI, AP/STA modes, Modbus gateway, multi-master polling, and edge computing, I don’t see any real value in building your own DIY converter.

1 Like

Many thanks. Hopfully none of these solutions need me to code as the furthest my skill runs to is tweaking someone else’s YAML.

That will hardly depend on the hardware you intend to use.

1 Like

RS485/Modbus will run for ten times further then Ethernet or WiFi, reliably.

When you get your adapter (WaveShare are popular ones) try the Protocol Wizard add-on to test everything and set it up.

Thanks. May try that.
Don’t need speed as only need to know the export every minute or so. But reliability is important and I can see that wifi may be unreliable. Running an ethernet cable between the devices may be possible.

What distance are you talking about? Is it line of sight, through barriers such as concrete walls or metal shielding, or around other buildings, or are we talking the next desk in the same room? Are there already data links between the two end points?

Running a cat 5 or better eight core cable, and using it for Ethernet, or RS485 or some other protocol is an option, depending on distance involved - the wire is the same, but the devices connecting to it are talking different electrical signals and software protocols.

WiFi may be convenient if an occasional dropped reading is acceptable.

A dedicated converter, whether a ESP32 with a RS485/ModBus adapter and custom firmware you develop, or a specifically designed interface like WaveShare make is your choice. Either way is some faffing around.

Are you sure you have to poll so often? What is your device with the ModBus interface?

Only 20m and there is already moderate Wi-Fi coverage. Problem is that I can’t get into the loft to run the cable, so the last time I did it it had to go around the outside of the building and the cable got damaged by sunlight even with UV resistant cable.

A through the mains Ethernet link may be better e.g. TPLink’s V600 Powerline Adaptor.

If the inverter has a Ethernet socket can I just connect it straight to the router, which means the HA can access it direct through an IP address? No need to worry about ModBus, RS485 and protocol converters.

These are rare, and you would still need to have a cable run to your router.

The Sigenergy inverter has WLAN, ethernet, RS485 and GPRS listed on its datasheet. Not sure which of these are standard and which extras that need buying. Presumably to HA it does not mind if it’s talking via wifi or ethernet. Both are accessed by giving the HA the relevant IP address of the inverter.

So ModBus is a rabbit hole I maybe disappeared down because RS485 is what my house inverter uses. I don’t need RS485 for this different application.

Is it correct to talk about ModBus over RS485 and Modbus over ethernet or Wifi? I.e ModBus is the protocol, but RS485 and ethernet are the way it’s carried from A to B. Excuse my ignorance.