Thursday, September 11, 2014
IO sampling Using XBEE API ADC operation
XBee Analog and Digital IO Lines
XBee ZB firmware supports a number of analog and digital IO pins that are configured through software commands.Analog and digital IO lines can be set or queried. The following table lists the configurable IO pins and the corresponding configuration commands.
Periodic IO Sampling
Periodic sampling allows an XBee/XBee-PRO module to take an IO sample and transmit it to a remote device at a periodic rate. The periodic sample rate is set by the IR command. If IR is set to 0, periodic sampling is disabled. For all other values of IR, data will be sampled after IR milliseconds have elapsed and transmitted to a remote device. The DH and DL commands determine the destination address of the IO samples. DH and DL canbe set to 0 to transmit to the coordinator, or to the 64-bit address of the remotedevice (SH and SL).
Only devices running API firmware can send IO data samples out their UART. Devices running AT firmware will discard received IO data samples.
First configure your coordinator xbee as ZigBee Coordinator API mode.
Then configure your router xbee as ZigBee Router API mode.
Since router xbee collects the adc sample from ad0 pin so we have set the ad0 pin as analog pin.We also need a periodic sampling rate at which analog pin is sampled and send it to coordinator xbee. Suppose you want to get sample every 100 milliseconds then set IO sample rate as 64(64 is hex value of 100).
Now the router xbee will sample the ad0 pin analog value every 100 milliseconds and send it to coordinator.
To ensure that it will send to coordinator I set destination address with my coordinator serial number.You can set to any xbee serial no. to send data to specific that xbee.
Now write the configuration to the xbee module.
Okay, now give the connections.Since the adc pins of xbee are 1.2v tolerant so make voltage divider to fed it to ad0 pin.
Now give power in both xbee.To see the received sample connect the coordinator xbee with pc using XCTU.Open the terminal.If everything is ok then you will see a series of data frames is coming every 100milliseconds.
If you vary the pot then you will see the frame data also changes.
That,s it! You can use this frames to get the sample data in microcontroller or pc.I already interface my xbee with my PIC18F4550 and send these data to a software using usb which plots the values.
If have any confusion , you are most welcome to contact with me,put comments or mail me.Dont forget to share.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment