Modbus Example X4 Setup

From Digi Developer

Jump to: navigation, search


Modbus XBee Bridge Example - Setting up the X4

This real-world example includes the following features:

  • Digi ConnectPort X4 (CPX4) as a Modbus/TCP bridge. Remote Modbus/TCP clients can access the X4 via either Ethernet or cellular, and the CPX4 fetches the Modbus responses via Xbee mesh
  • Digi XBee 485/232 Adapters link serial Modbus/RTU slaves into the bridging system
  • Digi ConnectPort X2 (CPX2) link Ethernet-based Modbus/TCP slaves into the bridging system
  • Digi Wall Routers (or any powered node) can extend and fortify the robustness of the bridgign system
  • Other CPX4 can be located remotely via long-range serial Point-to-Multipoint radios (such as XTend RF Modem). Modbus/RTU can be tunneled up to 40 miles away to other Xbee mesh groups.

Portions of this example can be review on these pages:

ConnectPort X4 Installation

Setting an Appropriate IP into the CPX

You first need to get an appropriate IP into your ConnectPort gateway, which most likely is a fixed IP on your local IP subnet. Some ConnectPort gateway products default to DHCP clients, which other default to Fortunately, the Digi Device Discovery tool allows you to locate and connect to your Digi device without changing the IP in your computer.

  • Confirm that you have the correct power for your model - the default supplied is 12vdc and the CPX4 support 9 to 30vdc.
  • Connect the CPX4 via an Ethernet Hub or Switch to a PC running Windows; A "Cross-Cable" will probably work, however some notebooks have problems negotiating Ethernet hardware modes with other end-devices.
  • Turn off the Windows firewall on your Windows computer
  • Install the Digi Device Discovery tool (see - It is part number 40002256)
  • To repeat! Make sure your Windows firewall is off, then you can discover Digi devices with IP of (no IP), 169.254.x.x (auto-ip), and (a hard-coded IP which might NOT match your own subnet). The Digo Device Discovery tool will allow you to hard-code a suitable IP (if required) and after a Digi device reboot, you can log into the web interface.

Setting an Appropriate XBee PAN id into the CPX

By default your gateway's XBee network comes up with an unknown or random PAN id - think of it as your 'network call-name'. This is fine if you are the only person in a few miles using ZigBee - and if you only have 1 such gateway. However, as soon as there are two Xbee networks within RF sight of each other, you'll need to force them to build separate PANs (or network-groups). Even if today you have the sole gateway and everything builds fine, at any moment your neighbor or a colleague might add a second system, and then any power outage risks you losing XBee devices to other networks. So you always want to hard-code in your own unique PAN id!

  • Click the Configuration > XBee Network link at the left, and you will see something like this:


Note: these screen shots are from a ConnectPort X2, not an X4 - the same concepts apply. Also the colors are modified by a custom CSS (or cascading style sheet) - which is a little known feature of the Digi ConnectPort line.

  • You'll see the dialog below, under which you'll want to:
    • Enter a fixed unique Extended PAN ID - a phone number works well
    • Enter a Node Identifier. Since these are sorted in alpha order, starting it with an '_' forces your gateway to always be listed at the top of your list.
    • Press the Apply button to save your settings.


Personal tools
Wiki Editing