LAB 1

advertisement
LAB 1 – Introduction to XBee
UPDATED Thursday, February 24, 2011
You may want to consider reviewing the following links before doing this Lab:







X-CTU Tutorial: http://ftp1.digi.com/support/documentation/90001003_A.pdf
Setting up the connections: http://ladyada.net/make/xbee/configure.html
Performing Range Test: ftp://ftp1.digi.com/support/documentation/90001067_a.pdf
More accessories on XBEE: http://www.digi.com/products/accessories/
Manual: http://www.sonoma.edu/users/f/farahman/sonoma/courses/cet543/lab/wireless_class/XBeeManual.pdf
Basic lab idea: http://creativeelectron.net/blog/2009/09/xbee-making-your-first-application-2/
Review the Eval Board schematic: http://ftp1.digi.com/support/images/XBIB-R-dev%20schematic.pdf
You can complete the lab using your own laptop. In this case you need the following software:




X-CTU - Download here. Here is a tutorial: http://ftp1.digi.com/support/utilities/40002637_c.exe
Chanalyzer :
http://www.metageek.net/support/downloads/?utm_campaign=Software&utm_medium=Chanalyzer.3.3&
utm_source=Installer
CoolTerm (or any serial port terminal application): http://download.cnet.com/3001-2383_410915882.html?spi=63173882a4dc5b7abfc091c6d4870c7e
Driver for Serial-to-USB converter
Hardware Requirements

You can purchase the modules from: http://www.sparkfun.com/search/results?term=xbee&what=products
Notes:










1
You can do the lab in a group with one/two other students. You need to select your own lab partner. ONLY
one undergraduate student per group is allowed!
Please make sure you sign the signup sheet.
Each TEAM must submit a separate report!
You must submit TWO copies of your lab report. Include all participants
You must sign up the time sheet if you plan to use the lab setup.
Please only answer the numbered questions (A.1, A2, etc.)
Please be very gentle with the RF devices and lab setup. Handle devices carefully! Be very careful as you
remove connectors and devices.
Please do not remove anything from the lab.
If somehow you cannot Read XBEE registers, always make sure the battery is good!
Always check the baud rate if the communication link is not working.
INTRODUCTION
A-Invoke X-CTU program. Make sure you
go to PC Settings tab and select the
proper interface.
B-Go to Modem Configuration and click on
Restore. You should get something like the figure
shown here.
1- Obtain a screen snapshot for BOTH the
receiver and transmitter modules. You will
not receive any grade if you are missing
these snapshots.
C-Determine what Firmware version is loaded in
the chip (read this:
http://ftp1.digi.com/support/firmware/Instruction
s%20for%20firmware%20upgrades.pdf) and make
sure you know how to update the Firmware.




2
What are the serial numbers (H/L) of the
transmitter and the receiver modules? This
is on the back of XBee chip. Please handle
the modules with care! I already entered
these values.
Obtain the latest Firmware version and
load it in the chip. Click on Write first and
then click on Read to make sure the correct
version is in place.
What version of firmware has been loaded
in the device?
Make sure you do the same for both RX
and TX modules.
BASIC XBEE SETUP
D-In this section you are required to create a point-to-point link between two XBees. Assume the PAN has an ID
of 2001 and the operating channel is 15. Using the Serial Numbers of the Transmitter and Receiver, properly
setup the TX XBee and RX XBee (please do not remove the XBees from the modules unless you have to).


To ensure that you have properly setup the network, connect the LOOP BACK connector (RED DB-9
shown below) to the RX module. Connect the TX module directly to the PC. Power up the RX module.
Perform the Range Test. Note that the remote module (or RX module) refers to the evaluation board
and the TX module refers to the base station connected to the PC.
The figure below shows the high-level hardware configuration for this experiment:
USB
Power Supply
5VGND
VCC
5V
Din
Xbee
Base
GND
Xbee
Remote
Dout
E-Answer the following questions:
1. Connect the DB-9 connector (labeled as Loop Back) to the RX module. Click on the Terminal tab. Make
sure the link is properly operating by sending an ASCII character and receiving it. Click on Assemble
Packets button. Type your name in there and send the data. Show a print screen of your results. If you
remove the Loopback what happens? Explain why? Which pins on the XBee are looped back? Refer to
the schematic of the evaluation board. How can you replace the red DB-9 Connector with a single wire?
2. Change the PAN ID in the TX module (only) to 2000. Run the Range Test again. What happens? Explain.
3. Change the MY of the TX module (only) to 1000. Run the Range Test again. What happens? What does
MY indicate in XBee Radio?
4. Read the Channel (CH) register on the TX module. Change the channel to a different valid value (Read
Chapter 3 http://www.rev-ed.co.uk/docs/xbe001.pdf). Perform the Range Test. Check the CH on
the RX module and make sure it is different from CH on the TX module. Explain what is happening.
5. What is RSSI? What does it represent? What happens to it if you move the RX module to a different
location far from the base?
6. Create a table and list the distance (in meter) and the RSSI values as the RX module moves away from
the TX module. Plot the distance (meter) vs. power received at the base station in mW. You should have
at least 5 points in your plot.
7. Plot the theoretical power loss (in dB) for XBee as of distance. Compare this with your results above1.
8. Referring to the Modem Configuration tab, which register deals with power level of the radio? Change it
and see how the transmit power changes. Explain your observations.
1
3
Read Stallings – Chapter 2
USING AT COMMANDS
In the following steps we learn how to use AT commands. AT commands are designed for more direct human
interaction. Below is a simple example showing how AT commands work:
Example: -> +++ (get into AT mode (Note 1))
<- OK
-> AT (check if xbee modem is responding)
<- OK
-> ATBD (get current baud rate as above)
<- 3 (9600)
-> ATBD 4 (set baud rate to 19200)
<- OK
-> ATBD (check again)
<- 4
-> ATWR (write the baud rate change to flash)
<- OK
what will be the command to change power
level of the TX?
Note that after +++ you should wait to get OK; DONOT press ENTER!
F- Answer the following question:
1. What is the command to change the baud rate to 115200? Note that if you change the BR you
need to reconfigure the XBee’s baud rate in the Port Settings tab in order to be able to
communicate with the XBee.
2. Using AT, change the PAN ID of the TX to 2000 and read it back. Show a snapshot of your result.
TESTING WITH THE SPECTUM ANALYZER SOFTWARE
K- Connect the Wi-Spy 2.4x to the PC (it is probably already connected) and run the Chanalyzer 4 software. Read
about Chanalyzer and watch a short video here: http://gordon.metageek.net/products/wi-spy/ . Here are some
examples 2:
1- Turn off the XBee modules. Take a snapshot of all 2.4G band frequencies that are detected in the lab.
2- Turn on XBee modules and find your XBee signal using the ZigBee signal template. Take a snapshot. You
may have to wait for a few minutes for a good reading.
3- Change the channel on your PAN ID (on both TX and RX). Run the Range Test. Make sure everything is
operating properly and find your ZigBee signal using the ZigBee signal template. Take a snapshot.
2
4
http://www.metageek.net/products/chanalyzer-4/?utm_campaign=Software&utm_medium=Chanalyzer.4&utm_source=HelpMenu
CAPTURING DATA FROM THE REMOTE DEVICE
M- Make sure you can perform the Range Test between the remote device and the Coordinator. Modify the
Remote module as follow 3 :
1. Set the baud rate to 115200.
2. Change the I/O port 0, 2, and 3 to be ADC
3. Set the Sample Rate to 80 milliseconds.
4. Set the number of Sample Before Transmission to 1.
5. Connect the TX module to the computer.
6. At this point, the Red LED on the Remote module should be blinking. Also, you should see that the
LED on the TX module should be (barely) blinking. Note that there is no need to have the Loopback
connector. Include a snapshot indicating the new values.
N- Open the X-CTU program.
1. Make sure you can communicate with the RX module.
2. Go to Terminal tab. You should see something like the figure below.
3. These are the packet frames the Coordinator module is receiving.
4. Read the manual. Explain clearly, where each packet starts, how many bytes are in each packet, which
part of the packet contains the analog data from I/O ports.
5. Take a snapshot of your own data and mark one frame on your figure. Show the part that contains the
data from I/O ports.
6. Which byte indicates the RSSI level? Show it on your snapshot.
7. Do you see the same patterns being repeated or each frame is different?
8. Are the pull-up resistors enabled in your setup? How do you know?
3
5
Make sure you the Manual: http://www.sonoma.edu/users/f/farahman/sonoma/courses/cet543/lab/wireless_class/XBee-Manual.pdf
CAPTURING DATA FROM THE REMOTE DEVICE USING LBVIEW
P- Setup the receiver such that AD1 and AD2 are enabled as digital input.
1- Using the evaluation board’s schematic determine which switches on the remote module are connected
to AD1 and AD2 ports.
2- Use the provided sample LabVIEW program4 to read the received data from the remote module.
3- Modify the LabVIEW Vi such that you extract the following values from the received packet and show
each part separately on the front panel.
a. RSSI value
b. Source address
c. The digital value received from port AD1 or AD2 (you should use and LED on the front panel to
show the digital data)
4- Plot the RSSI on a graph on the front panel.
5- You need to include a snapshot of your program in your lab report and demonstrate its full operation to
the instructor.
6- Using spectrum analyzer, find the 3dB bandwidth. Print a snapshot of the PSD.
7- Using spectrum analyzer (Chanalyzer) show the difference between XBee pro and regular in terms of
power level and frequencies of operation.
a. Optional: you can use different antennas and measure the power received – ask for different
antennas if you plan to do this; it is very interesting.
b. TRY THIS IF YOU CAN (+5 point extra): Set the network nodes to automatic mode such that if
there is too much interference on the working channel, the operating channel automatically
switches to another channel after performing some type of channel scanning.
X- EXTRA CREDIT AND SOME PROJECT IDEAS (must be done individually and approved first- you must
demonstrate the full functionality of your project / If you plan to these projects I will provide you the hardware)
1- Create a mesh network with three XBees. The data packet must be relayed using the intermediate node.
Show your setup for all the devices.
2- Measure the power consumed by the transmitter. Change the setup (including sampling rate, wakeup
time, duty cycle, etc.) such that the power consumed by the end-device is minimized. Plot a graph
showing the improvements you achieved.
3- Connect FOUR XBees, two of them to different PCs. Show that routing can be changed from 1,2,3 to
1,4,3. If Node 2 fails.
4- Use ZigBee to pass low quality video.
4
If you are observing any VISTA problem while opening the LabVIEW program, you may want to restart your computer. We
have tested the program on Windows 7 and XP and there should be no problem.
6
Review Questions:
1- What does MY indicate? How is it different from PAN ID?
2- What is the unit of RSSI? Can you change RSSI value on a XBee chip?
3- What does it mean if the value of RSSI register is set to 40?
4- What is the minimum setup required to get two XBEEs to communicate with one another?
5- Explain exactly how we can use two XBees to measure the temperature and report it to a computer (you
know include the hardware schematic and software setup for each device).
6- In the question above what are the possible things we can do to reduce the power consumption on the
remote device?
7- Assuming the transmitted XBee power is 10 mW centered at 2.5443 MHz with a 3-dB bandwidth of
2MHz, draw the PSD for the signal.
8- What is the point of setting the Baud Rate in XBee. Is it possible to get two XBee chips with different
baud rates to communicate with one another?
9- What does it mean when we perform a loopback test between two XBee chips?
10- What is the main difference between regular ZigBee and ZigBee pro?
11- How many ZigBee channels are available in 2.5 Band?
12- Which register do you set to change the transmit power? What is the maximum transmit power in mW?
13- Can you change the parity setting in RF module? How?
7
Appendix 1:
Appendix 2:
Sample HEX Output String from the REMOTE moduel:
7E 00 0E 83 56 78 51 00 01 32 00 02 02 02 02 02 61 BF
What does it mean:
7E
00 0E
83
56 78
51
00
01
32 00
02 02
02 02
02 61
BF
8
- Start Delimiter
- Length Bytes
- API Identifier Byte for 16bit A/D data
- Source Address Bytes
- RSSI Value Bytes
- Option Byte
- Sample Quantity Byte
- Channel Indicator
- Sample Data AD0(x) [*max value = Vref]
- Sample Data AD2(y) [*max value = Vref]
- Sample Data AD4(z) [*max value = Vref]
- Check Sum
Download