Enable Analog Input Pin in Xbee

In this post we will walk through the process of remotely configuring the XBee end device I/O pin as analog input from XBee coordinator using Digi X-CTU software.  XBee supports 4 pins that can be configured as analog input pins. Table below lists the details of the I/O pins that can be configured as analog input. The I/O pin, AD2 (pin no. 18) on the end device is considered here for configuring it as analog input.

Hardware/Software environment settings

  • One XBee node configured as Zigbee Coordinator API (Firmware version: 21A7)
  • One XBee node configured as Zigbee End Device API(Firmware version: 29A7)
  • Digi X-CTU application software (Version: 5.2.8.6)
  • Limit the maximum voltage that can be applied to analog IO pin to 1.2V

The voltage range on the analog pin is 0 to 1.2V. A potentiometer is used to present a variable voltage to XBee node I/O pin. We can tap the power from the supply available on the XBee node itself. This arrangement is illustrated in Figure 1.

 

 

The approach followed here, to configure remote end device from coordinator is by passing AT commands in API mode. While working with API firmware version, we need to check Enable API in the PC Settings tab of the X-CTU.

Enable API

In XBee we have the API frame type 0x17, called Remote AT Command Request frame, available to ease our job in setting the pin as analog input.

API Frame to Enable a AD/DIO Pin as Analog Input

7E 00 10 17 01 00 13 A2 00 40 A9 E4 A2
Delimiter Length of payload Frame Type Frame ID 64 bit address of destination
FF FE 02 44 32 02 4C
16 bit network address of destination Command options AT command Command parameter Checksum

 

Length of payload: Calculated by the number bytes between Frame Type and Command parameter. In the above, there are 16 bytes(HEX equivalent 10) between Frame Type and Command parameter.
Frame Type: 0x17 for Remote AT Command Request frame.
Frame ID: 0x01 for ACK.
64 bit address of the destination: Assigned by the manufacturer.
16 bit address of the destination: Assigned by the coordinator while forming network.

Command Options: 0x02 for update.
AT Command: D2(0x4432)for AD2. Refer table for other options.

Pin Number Pin Name AT Command HEX code Command Parameter
17 AD3 D3 44 33 02
18 AD2 D2 44 32 02
19 AD1 D1 44 31 02
20 AD0 D0 44 30 02

Command Parameters: 0x02 for analog input.
Checksum: Calculated by adding all bytes after length(exclude delimiter and length) and then keeping only the lowest 8 bits of the result. Next subtract the result from 0xFF to obtain checksum.

Once the frame is ready, go to Terminal Tab and select Assemble Packet. This will pop up Send Packet window. Select display as HEX. Enter the API frame that you would like to transfer to the remote end device here and click on Send Data.

Send Packet-Analog-Input-with-Xbee - Copy

The text in blue is the API frame passed out from the coordinator to the remote end device. The text in red is the response received from the remote end device by the coordinator. The API response frame type is 0x97, called Remote Command Response.

Enable-Analog-Input pin -with-Xbee

7E 00 0F 97 01 00 13 A2 00 40 A9 E4 A2
Delimiter Length of payload Frame Type Frame ID 64 bit address of source
B4 53 44 32 00 C6
16 bit network address of source AT command Command status Checksum

Length of payload: Calculated by the number bytes between Frame Type and Command parameter. In the above, there are 15 bytes(HEX equivalent 0x0F) between Frame Type and Command status.
Frame Type: 0x97 for Remote Command Response frame.
Frame ID: 0x01 .
64 bit address of the source: Address of the remote radio returning this response.
16 bit address of the source: Network address of the remote radio.
AT Command: D2(0x4432)for AD2.
Command Status: 0x0o for OK.
Checksum: Calculated by adding all bytes after length(exclude delimiter and length) and then keeping only the lowest 8 bits of the result. Next subtract the result from 0xFF to obtain checksum.

Leave a Reply