XBee Digital I/O Adapter
From Digi Developer
|Product Name:||XBee Digital Adapter|
|Digi Product Page:|||
The XBee Digital Adapter is a product designed to take digital input or programatically assert digital output and communicate the I/O changes across the XBee network. For more details of usage and configuration, please review the Drop-in-Networking Accessories User's Guide at: http://www.digi.com/din/docs
Major Features of the XBee Digital Adapter:
- 4 Digital I/O terminals supporting open collector and pull up and pull down capabilities.
- Easy to use screw terminal connector.
- Power output of 12 Volt 50mA in mains powered mode.
- Optional battery powered for isolated locations.
- Power input 3.7-6V (different from first generation XBee adapters)
The XBee Digital Adapter is supported on all Digi's XBee protocols. All of Digi's gateway products that are using the same XBee protocol as the adapter are compatible.
Example: If you have a gateway product with a XBee ZB radio installed, a XBee ZB Analog Adapter is compatible, but not a XBee ZNet 2.5 Digital Adapter.
The XBee Digital adapter uses a unique function set for each of the protocols, requiring that configuration of the radio be done via the RF interface through remote AT commands.
Important: Serial communications disabled on XBee Analog and Digital I/O Adapters
For the XBee Analog and Digital I/O Adapters, the XBee firmware disables the XBee module’s serial communications functionality, so that the pins normally used for serial communications can instead be used for additional I/O functionality. As a result, once an XBee module has been loaded with the firmware image specific to the XBee Analog or Digital I/O Adapters, the XBee module can no longer be configured using X-CTU, the XBee serial API, or local AT commands.
The only way to configure these adapters is by using the Ident or Ident/Reset commissioning and identification button (described in the topic "Commissioning and identity behaviors" in the Drop-in Networking Accessories User's Guide) and OTA commands—either by using a ConnectPort gateway, X-CTU, or by using the remote command API of another serial-enabled module associated to the same network.
Mode and Terminal configuration
The Digital Adapter's terminals can be configured independently for input or output operation. It is possible to set a single terminal to be in both input and output mode.
- To configure a Terminal for Input
- D8=3 (Enables Terminal 1 for Digital Input)
- D1=3 (Enables Terminal 2 for Digital Input)
- D2=3 (Enables Terminal 3 for Digital Input)
- D3=3 (Enables Terminal 4 for Digital Input)
- To configure a Terminal for Output
- D4=5 (Enables Terminal 1 for Digital High Output)
- D6=5 (Enables Terminal 2 for Digital High Output)
- D7=5 (Enables Terminal 3 for Digital High Output)
- P2=5 (Enables Terminal 4 for Digital High Output)
- D4=4 (Enables Terminal 1 for Digital Low Output)
- D6=4 (Enables Terminal 2 for Digital Low Output)
- D7=4 (Enables Terminal 3 for Digital Low Output)
- P2=4 (Enables Terminal 4 for Digital Low Output)
Sensor Readings Retrieval
Once the device has been configured, it is time to start polling sensor samples from the device. There are three methods of polling available for the Digital Adapter. An active polling, and two methods of passive polling. All forms of polling require the user to parse the IS data structure.
Active polling is when an application or user on the XBee network sends the Remote AT command 'IS', which causes the Digital sensor to take a sensor reading and return the results to the requester.
802.15.4 I/O Line Passing support
The I/O Line Passing function of XBee 802.15.4 Modules is not supported with the Digital I/O Adapter, as the Input Port mapping is not identical to the Output Port mapping, e.g. Terminal 2 input is D1, but output on Terminal 2 is D6. Line Passing would require that both are the same!
- Simple to setup
- User-Controlled timing of samples
- For reliable responses, requires a non-sleeping Adapter.
- Less efficient on larger networks.
The first passive polling option is to periodically transmit a sensor reading and send it to the configurable destination address. To configure this setting, set the 'IR' parameter to the rate in milliseconds to send the sensor reading, and the 'DH' and 'DL' parameters to match the 'SH' and 'SL' parameters of the desired destination. In cases where the sensor is also sleeping, enabling the 'IR' parameter causes the sensor to send at least 1 reading per wake cycle. If you desire the device to send only one sensor reading per wake cycle (recommended), set the 'IR' parameter to 0xFFFF.
- Allows for sleeping Digital adapters to reliably get sensor readings to the destination address
- Consistent timing of samples
- More difficult to setup, requires working knowledge of sleep settings.
The second passive polling option is to wait for a change in state on the I/O lines. To enable this feature, the 'IC' parameter is set to a mask indicating which I/O lines to monitor for a state change. Once the desired mask is set, any changes in logical state on the specified lines will generate a sensor reading and send it to the 'DH' and 'DL' address.
- Only XBee traffic generated is caused by actual changes in input. This typically means lower traffic.
- Can be used with sleep settings.
- More difficult to setup, requires working knowledge of sleep settings.
The adapter has several DIP switches on the underside of the unit. DIP switch 1 is the leftmost switch. When the adapter is oriented with the mounting tabs facing upwards, the DIP switches are in the ON position when the switches are positioned away from the screw-lock connector.
Switch settings are:
|1||ON = Internal Battery Powers Pin #6, OFF = battery power not used.|
|2||ON = External Supply Powers Pin #6, OFF = external supply not used.|
|3||ON = Enables a 10K pullup on terminal #1 to 3vdc.|
|4||ON = Enables a 10K pullup on terminal #2 to 3vdc.|
- Switches 1 and 2 should not be on at the same time, as increased parasitic battery drain will result.
- If both Switches 1 and 2 are off, then pin #6 will never supply power out.
- Pullup use is not recommended when running from battery power, owing to the constant drain on the batteries.
- Terminal #3 and #4 have no internal pullup. You may require external pullup resisters to be used.
Terminal 6 is the power out pin. It can be set in either battery pack voltage out or +12VDC at 50mA out if mains powered. To set battery pack voltage output, set dip switch 1 to the on position. To enable +12VDC output, set dip switch 2 to the on position. Setting both to the on position defaults to +12VDC output but incurs extra battery drain as well.
Once the desired power output is selected, the 'P3' setting needs to be set to 5.
Note: In order for consistent output voltage, the XBee Adapter cannot sleep. Using the power out function of this adapter in conjunction with batteries will result in significant additional battery usage.
DIA Configuration and Programming Examples
The DIA is a python framework designed to gather information from multiple sources, provide programmatic control over the information collecting, and present the data either to a software platform such as the Device Cloud or directly to the user through a variety of methods.
Python Programming Examples
This Demo Application uses the XBee DIO Adapter with a motion detector and lamp