WB-MGU Interface Converter with WBE2 modules (RS-485, Ethernet, Wi-Fi)

From Wiren Board
This is the approved revision of this page, as well as being the most recent.
Other languages:
WB-MGU v.1

Purpose

Designed for connecting devices with an RS-485 interface to an automation server via Ethernet or Wi-Fi. The server can be any controller / computer supporting the required protocols.

The device has one RS-485 (Modbus RTU) port and one slot for WBE2 extension modules. Examples of those modules include wired interfaces like isolated RS-485, CAN, KNX, OpenTherm and so on, or wireless interfaces like Z-Wave LR, Zigbee or Matter. Extension modules are communicating with the main ESP32 MCU via UART.

Two modes are available for the RS-485 port:

  • Modbus TCP — for Modbus devices only;
  • transparent gateway — suitable for any protocols running over RS-485.

The device is flashed and ready to use as a gateway, but you can write your own firmware for it and use it for other tasks. Read more about developing DIY firmware.

Technical specifications

Parameter Value
General
Main MCU ESP32
CPU Core Xtensa® dual-core 32-bit LX6 @ 240 MHz
Flash 4 MByte
SRAM 520 KByte
PSRAM 0 MByte (default), 8 MByte (option)
Power supply
Interface power supply voltage 9 V — 28 V DC
Power consumption at 24 V 1 W
Maximum current from Vout 2.5 A
Maximum current from Vout when powered by PoE (continuous) 500 mA
Power inputs
  • 1 Vin input;
  • 1 PoE 802.3af, 802.3at input on Ethernet using a built-in module
Power input priority

from the input with higher voltage

Output for powering external devices
Vout Module power supply voltage is supplied to the terminals, with overcurrent protection above 2.5A, capable of being disabled via software.

When powered by PoE, a stabilized 24 V voltage will be supplied to Vout. When powered by PoE, the current drawn from Vout is lower.

Клеммники и сечение проводов
Рекомендуемое сечение провода с НШВИ 0.35 – 1 мм2 — одинарные, 0.35 – 0.5 мм2 – сдвоенное обжатие
Длина стандартной втулки НШВИ 8 мм
Момент затяжки винтов 0.2 Н∙м
Communication
Data exchange protocol

Via RS-485 terminals:

  • Modbus TCP;
  • transparent gateway for any protocols over RS-485 (e.g., Modbus RTU over TCP).
Interfaces
  • 1x RS-485
  • Ethernet 10/100
  • Wi-Fi 2.4 GHz
  • Connector for extension modules WBE2
Operating conditions
Air temperature
Relative humidity Up to 95%, non-condensing
Climatic execution according to GOST 15150-69 O2.1*
Warranty period 2 years
Service life 5 years
Габариты
Ширина, DIN-юнитов 2
Габаритные размеры (Д x Ш x В) 36 x 90 x 58 мм
Weight (with packaging)

105 g

General operating principle

Hardware

The module is based on the ESP32 chip, which implements the functions of an RS-485 gateway, allows controlling peripherals and indicators, and provides a web interface and API for configuring the module.

Network interfaces and packet handling

The module has two network interfaces: Ethernet and Wi-Fi, which can act as an access point or client.

The module's firmware receives packets via Ethernet / Wi-Fi and sends them to the RS-485 port or to the WBE2 extension module port, then translates device responses back. The port selection depends on which TCP port the packet arrived at, default: 502 — RS485-1, 503 — RS485-2.

Power supply

The module can be powered in two ways: directly from the Vin terminal or, optionally, via IEEE 802.3af / 802.3at standard PoE.

Powering via PoE requires a separate WBP-ACTIVE-POE module with a built-in voltage converter, which is installed inside the device. It converts the input PoE voltage to 24 V and supplies it to the gateway's internal power bus.

Using the WBP-PASSIVE-POE module is permitted, but only with a power supply voltage not exceeding 24 V DC. Exceeding this voltage will result in the gateway failure.

The module is equipped with one power output (Vout) for connecting peripheral devices.

Connected load power Vin (24 V) Active PoE mode Passive PoE mode
802.3af 802.3at
Nominal 60 W 15 W
Maximum short-term 120 W 12 W 28 W 30 W


Indication

On the front panel under the sticker, there are indicators showing the status of the module and its outputs.

WB-MGU Indicators
Indicator behavior and colors
Designation Color State Meaning
Status Green blinking the device has booted up and is operating in normal mode
solid power is present, firmware problem
Vout Orange solid device power ON
OFF device power OFF
Ethernet Green solid link established
blinking data exchange
OFF no link
Wi-Fi Green solid enabled, no data exchange
blinking data exchange
OFF disabled
RS485 1/2 Green (RX) blinking receiving data from port
Orange (TX) blinking sending data to port

Installation

WB-MGU is mounted on a standard 35 mm DIN rail and occupies a width of 2 DIN modules.

Wiring

Module power supply

The V+ GND terminal block with a 5.08 mm pitch is used for power connection.

The module can also be powered by Ethernet PoE.

Network interfaces

The module is connected to the Wiren Board controller or another device directly via Ethernet or via Wi-Fi, including through a router or VPN. The main condition is that the module's IP address must be accessible from the controller.

RS-485

The V+ GND A B terminal block with a 3.5 mm pitch is used to connect devices via the RS-485 bus. Power for the connected devices can also be taken from these terminals. For stable communication with the device, it is important to correctly organize the connection to the RS-485 bus; read about this in the article RS-485 Bus Physical Connection.

For the RS-485 interface, settings for speed, stop bits, and other parameters are available. By default, the terminating resistor and failsafe bias are enabled. They can be disabled in the settings. The RS-485 ground in the WB-MGU is not isolated from the power ground.

Configuration

Web interface

For convenience of settings, the module has a web interface that works in modern browsers on computers and mobile phones. To access it, you need to connect the computer and the module to the same network via one of the interfaces:

  • Wi-Fi, where it brings up an access point and automatically distributes IP addresses to clients.
  • Ethernet, where IP addresses are not configured; the module must receive them via DHCP, for example, from your router.

Default values are given in the table below. More information about network settings is output to the debug console accessible via the USB-C port under the module cover.

Default connection parameters
General
Login admin
Password admin
mDNS hostname wb-mge-XXXXXX.local, XXXXXX — last 3 digits of Ethernet MAC in hex format

You can also take the access point name printed on the sticker and add .local to it

Wi-Fi
Access point WB-MGE-XXXXXX, XXXXXX — last 3 digits of Ethernet MAC in hex format.
Key (password) printed on the sticker on the side of the device.
IP address 192.168.5.1
Subnet mask 255.255.255.0
Ethernet
IP address DHCP
Subnet mask DHCP

Web interface access

Access to the module's web interface via Wi-Fi access point

By default, Wi-Fi operates in access point mode:

  1. Open the list of Wi-Fi access points on your laptop or phone and connect to WB-MGE-XXXXXX, where XXXXXX are the last 3 digits of the Ethernet MAC in hex format.
  2. Enter the security key (password) printed on the sticker on the side of the device.
  3. The web interface will be available at 192.168.5.1, login / password — admin / admin.

Access to the module's web interface via Ethernet

By default, the module's Ethernet port is configured to obtain an IP address via DHCP, so you will need a router with configured IP address distribution — usually any router in an apartment or office:

  1. Connect the module to the router via Ethernet;
  2. Go to your router's settings and see what IP address it assigned to the module.
  3. Open a web browser on a computer connected to the same router. The web interface will be available at the IP address from the previous step, login / password — admin / admin.

Access to the module's web interface via Wiren Board Cloud

If the WB-MGU is connected to one of the controller's network interfaces, and the controller is in the Wiren Board Cloud, you can configure proxying for the module's web interface and access it via the cloud. Details in Gaining access to arbitrary web interfaces on the controller.

Saving and loading configuration

Uploading and downloading configuration from the web interface

Configured parameters can be saved to a file and used to restore them on a new device or when creating identical installations.

All web interface, port, and network interface settings are exported to the file.

Terminator and failsafe bias

Resistor control from the web interface

The module has installed and enabled by default:

  • terminator — a 120 Ohm resistor connected between lines A and B. It should be enabled if the module is at the end of the bus, and disabled if in the middle.
  • failsafe bias — 560 Ohm resistors that pull the bus, eliminating uncertainty when device transmitters are turned off. If the module acts as a master, it must be enabled; otherwise, disabled.

The control is software-based; go to the settings of the required port and set the status.

«Modbus TCP» mode

Modbus TCP mode configuration

In this mode, the module receives Modbus TCP packets via network interfaces, unpacks them, and sends them to one of the RS-485 ports. Then it packs the received response and sends it back to the network interface to the client that requested the data.

Mode selection is available for each port separately:

  1. Go to Settings → RS-485 1 (or 2).
  2. Select Modbus TCP mode.
  3. If necessary, specify the TCP port from which requests will be forwarded to this RS485 port.

In Modbus TCP mode, the module can only act as a server. Currently, only one simultaneous connection is supported per port.

«Transparent gateway» mode

WB-MGU connection in transparent gateway mode. Two modules are connected via an IP network.
Transparent gateway mode configuration

In this mode, the module receives packets of any protocol (e.g., Modbus over TCP) via network interfaces, unpacks them, and sends them to one of the RS-485 ports. Then it packs the received response and sends it back to the network interface from which the request was received.

Mode selection is available for each port separately:

  1. Go to Settings → RS-485 1 (or 2).
  2. Select Transparent mode and choose a role.
  3. If necessary, specify the TCP port from which requests will be forwarded to this RS485 port.

The following roles are available in «Transparent gateway» mode:

  • Server — used when connected to, for example, a Wiren Board controller.
  • Client — used when the WB-MGU is connected to another similar module.

In this mode, only one master can poll devices on each port.

If you want to forward two segments of the RS-485 bus over a local network or VPN using a WB-MGU, select the «Server» mode for one module and «Client» for the other, specifying the server's IP address.

When combining two RS-485 bus segments using WB-MGU v.3 gateways and polling devices from a Wiren Board controller, set the timeout in the port settings of the wb-mqtt-serial driver to at least 200-250 ms when working over Ethernet or at least 350 ms when working over Wi-Fi or a VPN.

Configuration in Wiren Board controller

The controller and the module are connected to the same network via a router and obtain IP addresses via DHCP

The controller is connected to the module via Ethernet, the controller is — IPv4 Shared to other computers, the module is — DHCP Client

The controller is connected to the module via Ethernet, the controller has — IPv4 Static IP address, the module has — Static IP address

To manage Modbus devices connected to the module from the Wiren Board controller, you need to configure the wb-mqtt-serial driver:

  1. Add TCP ports in the wb-mqtt-serial driver settings to receive data from RS-485-1 and RS-485-2 of the module.
  2. To make the devices appear on the Devices tab in the Wiren Board controller's web interface, add them automatically via Wiren Board devices search on the RS-485 bus, or manually, by selecting a template.
  3. WBIO modules are added manually, by selecting a template. The module address depends on what the WB-MGE v.3 is used with:
    • Wiren Board controller — <WB-MIO Modbus address>:<WBIO module sequence number (starting from 1)>.
    • Third-party controller or software — addresses are calculated according to the WB-MIO registers table.


Z-Wave Support

WB-MGU with Z-Wave

WB-MGU can be equipped with the WBE2R-R-ZWAVE-TR extension module to provide Z-Wave LR support. Additionally, TRIDENT IoT ZWay Controller SDK can run on main ESP32 MCU. Choose WB-MGU with 8MB PSRAM option for this.

Parameter Value
Antenna connector RP-SMA
Z-Wave IC Trident T32CZ20
Output power 20dB
Supported protocols Z-Wave, Z-Wave Long Range
Supported roles Z-Wave Controller, Z-Wave End Device

Device flashing

Flashing connector and debug console

Programming connector

The module is based on the ESP32 chip, and a USB-C programming connector is installed on the board.

To access the USB-C connector, remove the top cover of the device by prying it from the side with something thin. You can also receive debug information from the module through this connector. When connecting the module to a computer via USB, it will be detected as an ACM device that can be opened in any terminal program.

Important: when using the debug console, first connect the USB-C cable to the computer and WB-MGU, and then supply power to the gateway. This will help avoid device reboots, see ERRWB-MGEv30001 for more details.

Writing firmware

For flashing, you can use the esptool utility or an analog. A USB-UART converter based on CH343 is built into the device.

You can check the connection by requesting the chip ID, for example:

$ esptool.py -p /dev/ttyACM0 -b 115200 chip_id
esptool.py v4.8.1
Serial port /dev/ttyACM0
Connecting......
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting.....
Detecting chip type... ESP32
Chip is ESP32-U4WDH (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 2c:bc:bb:31:8b:00
Uploading stub...
Running stub...
Stub running...
Warning: ESP32 has no Chip ID. Reading MAC instead.
MAC: 2c:bc:bb:31:8b:00
Hard resetting via RTS pin...

GPIO and interfaces

Below are tables with the connection of interface modules and the addresses of the expander outputs.

RTL8201FI Ethernet interface
ESP32 GPIO18 GPIO23 GPIO0 GPIO5 GPIO19 GPIO22 GPIO21 GPIO25 GPIO26 GPIO27
RTL8201FI MDIO MDC CLK RST TXD0 TXD1 TXEN RXD0 RXD1 CRS_DV
TCA9535 Expander
TCA9535 SDA SCL PD00 PD02 PD04 PD05 PD06 PD07
ESP32 GPIO32 GPIO33
RS485 terminator ON bias ON
VOut and LED VOut ON
LED Wi-Fi OFF
LED Eth OFF
Status ON

In the table above, ON means that applying a logical one to the port turns on this or that node. For the Status LED, if the port is in the HiZ state, the LED will be turned on. TCA9535 has a standard address of 0x20 on the bus.

PSRAM64H Memory
PSRAM64H CE CLK SIO0 SIO1 SIO2 SIO3
ESP32 GPIO9 GPIO6 GPIO8 GPIO17 GPIO7 GPIO11
RS-485
ESP32 GPIO14 GPIO12 GPIO15
RS485 TX RX RTS
WBE2
ESP32 GPIO10 GPIO4 GPIO13
WBE2 TX RX RTS

In these cases, for ESP32, RX is an input and TX is an output.

Buttons
ESP32 GPIO34
Config (B1) +

In this case, when the button is pressed, it applies a logical zero to the ESP32 port.


Images and drawings

Corel Draw 2018 (font — Ubuntu): Файл:WB-Library.cdr.zip

Visio:

  1. Wiren Board devices: Файл:WB-Visio-Lib.zip.
  2. Panels, circuit breakers, contactors, and more by a third-party developer.

SVG: Файл:WB-Library.svg.zip

Module dimensional drawing (DXF): Файл:WB-MGEv3.dxf.zip

Module dimensional drawing (PDF): Файл:WB-MGEv3.pdf

База УГО для AutoCAD Electrical: Файл:Wirenboard-AE-base.zip