XBee Digital I/O Adapter
XBee Digital I/O Adapter
The Digi Digital I/O Adapter is programmable digital interface. It has 4 screw terminals for control and monitoring of digital devices, and 2 screw terminals for providing power. Screw terminals 1-4 can be either outputs or inputs, terminal 5 is a dedicated ground terminal, and terminal 6 can provide up to 50mA of current at 12 volts (useful for many 12 volt sensor devices). Full control of the 12 volt power output, the mode of each I/O pin, as well as sensing and output values are provided over the wireless interface. The device can run from an external power supply or from an internal battery. The Virtual Wiring system supports the Digital I/O device when it is using an external supply; it does not support the device when it is running from a battery. For a complete description of the Digital I/O Adapter, consult the Digi manual.
XBee Digital I/O Terminals
The Virtual Wiring DigitalIO Device represents the Digital I/O Adapter device within the Virtual Wiring System. The Device has 4 input and 4 output terminals. Depending on the configuration of the Digital I/O Adapter device, some or all of the 8 terminals are active. The 4 input terminals control the output state of the 4 screw terminals. They are called "1", "2", "3" and "4" and take either
off values. If the terminal is 'on', the output sinking function of the Digital I/O Adapter screw terminals is on, and the screw terminal functions as an output. If the Device terminal is
off, the output sinking function is off, and the screw terminal can function as an input or as a floating output. The 4 Device output pins are called "1S", "2S", "3S", and "4S", and they can report the value (on or off) on each of the 4 Digital I/O Adapter screw terminals.
XBee Digital I/O Device Installation
To install a DigitalIO Device, the device must first be joined into an existing XBee network (which the Virtual Wiring system is a part of). Once joined, create a DigitalIO Device by running the DigitalIO Script. The parameters for the DigitalIO Script are:
port_location: the port_location of whatever wired device the system owns in the network (usually a Coordinator's port_location). If there is only one XBee network for the system, this parameter can be set to nil.
address: the 64 bit network address of the device. The network address uniquely identifies the XBee device. Typically, the address is found on a paper (serial number) label affixed to the device. It is also in the device's SH and SL registers, and it shows up in the return value from an AT ND (node detect) command. Network addresses are written in hex, are 16 characters long, and often look like "0013a200406b0263". To enter a network address as an address parameter, start with the 16 character network address, strip off any leading zeros, and append "0x" to the beginning.
change_detect: a string of DigitalIO Device output terminals describing which of the Digital I/O Adapter device screw terminals are in change detect mode. Digital I/O Adapter screw terminals which are in change detect mode will report all value changes to the system, while screw terminals which are not in change detect mode will report nothing. The change_detect parameter takes a nil value or a string of some or all of the DigitalIO Device output terminals ("1S", "2S", ...). All Digital I/O Adapter screw terminals which are functioning as inputs should be in change detect mode.
enable_12V: a true/false value which can turn on or off the 12 volt power supply on screw terminal 6. In order for the enable_12V parameter to be effective, the Digital I/O Adapter dip switch (see Digi documentation) must be set to enable 12V power switching.
To add a DigitalIO Device with ID "dio", screw terminals 1 & 2 inputs, screw terminals 3 & 4 outputs, 12 volt power, and network address 0013a200406b0263 to a system which is wired to a Coordinator Device at port_location "/dev/ttyUSB0", run the DigitalIO Script with the following parameters:
change_detect: "1S, 2S"
Note: the port_location parameter can be set to nil, if the system owns only one XBee network.