XBee RS-485 adapter
Product description
Notation
The XBee RS-485 is claimed to support RS-422 and RS-485. RS-422 means 4-wire (separate TX/RX pairs). RS-485 strictly means 2-wire with the TX/RX function on a single wire pair for half-duplex only. If you want RS-485 4-wire, then configure the product for RS-422.
Pinouts
The XBee RS-485 has a 6-screw removable terminal block. Pin #1 is on the same side as the DIP switches - or if the adapter is mounted (screwed down), then if you face the open ends of the terminals, then pin #1 is on the left (opposite the power connector)
Pin | When RS-422 | When RS-485 |
---|---|---|
1 | TxD+ | Dat+ (B) |
2 | TxD- | Dat- (A) |
3 | RxD+ | Not Used |
4 | RxD- | Not Used |
5 | Ground | Ground |
6 | 12vdc Switched Power | 12vdc Switched Power |
Note on pin 5: This pin is used as power, signal, and reference ground. Since the Digi AC/DC supply has a floating earth, you will need to tie this to your RS-485 device (or at least the same ground reference they use). This is also the return for the 12vdc switched power.
Note on pin 6: When enabled, provides up to 50mA of 12vdc power - see programming options below
DIP Switch Settings
Switch | Comments |
---|---|
1 | Not used |
2,3,4 | OFF for RS-422, ON for RS-485 |
5,6 | ON to enable BIAS and Termination, OFF to disable |
Note on line bias: Line bias is available only when external power is used, but it should always be enabled unless there is a specific reason to disable it. Enabling line bias 'quiets' a floating line, which prevents noise from generating large amounts of XBee traffic.
Note on ON setting: the lebeling on the DIP switch can be hard to see - as of Sep 2009 the black DIP switch block used is ON when the switch button is AWAY from the etched numbers.
Programming options
There are many options to consider when making wireless programmatic access to an XBee network of devices or device adapters. In broad terms, one may write a program which runs on a PC to interact with a network or one may use a gateway device, such a ConnectPort X [2] gateway.
When using a PC, one may consider using the simplistic and easy "AT-Command" mode for the XBee attached to the computer. Although using this mode is straight-forward it does not offer one as fine of control as when using the "API mode" firmware option.
One may also consider using a Digi ConnectPort X family of gateway device to provide additional intelligence and flexibility when connecting to a network of wireless devices. The ConnectPort X [3] offers a customizable Python Programming Environment and instant connectivity to the Device Cloud Management Platform. The ConnectPort X offers users the ability to choose to write their own applications from the ground-up, using Digi's and Python's[4] reference and example information, or to use the highly extensible DIA Application to collect and aggregate information.
Using the Aux-Power output
The auxiliary power output can be used to selectively power up an external RS-485 equiped sensor. When the XBee RS-485 adapter sleeps, the aux-power drop.
To turn the auxiliary power on, send the AT command 'D2\x05' (set D2 to 5).
To turn the auxiliary power off, send the AT command 'D2\x04' (set D2 to 4).
To make use of this power option with sleeping sensors, you will need the following things to occur:
- Set the XBee sleep settings as required - the length of time to remain awake will be tricky to calculate.
- Enable the aux-power output to be true
- if the sensor transmits its data automatically, then this will be sent over the mesh to either the MAC address loaded in the DH/DL register pair, or for Zigbee to the coordinator
- if the sensor must be polled, then you must enable one of the I/O settings with the XBee so that it sends an dummy message to the host. Then your host application must wait for that dummy message and quickly send any serial poll required.