Step 1 - XBee and Arduino

XBee Setup

In this step we will configure one receiver (router) and one transmitter (coordinator) XBee. We will use free software XCTU for this configuration. Users can find more information about XBee programming in this software's website.

1. Plug in the XBee to the USB adapter and plug it to your PC. After your computer finishes downloading the necessary drivers run XCTU.

2. When purchased, all XBee S2 comes with Baud rate 9600 and router as default. Add the radio module by searching the COM ports with 9600 baud rate devices.

3. When you add the radio module, it will appear on the left part of the XCTU screen. Click on the radio module and software will display all the details about the device on the right.

hotgluekit_driver
hotgluekit_icon

4. As the first XBee device will be the router (this will be the one we will put in the module box), we will leave it as a Router AT and continue configuring other necessary details.

5. We need to change four important parameters for this Router XBee: PAN ID, DL (Destination Address Low), BD (Baud Rate) and RO (Packetization Timeout). Find these parameters and change them to values in order: 3039, 0, 115200 and 0.

6. After changing these values click the write button and finish programing this XBee. Unplug this router XBee from the adapter.

hotgluekit_router

7. Plug the other XBee which will become the coordinator or the transmitter that will stay attached to your PC to send commands to the module.

8. Add the radio device like the previous one and click on it to display its settings.

9. As by default each XBee is set to be Router AT, we will change this one to a Coordinator AT. Click the update firmware button to see the list of possible firmwares. Find ZigBee Coordinator AT from that list and click finish to update the device.

hotgluekit_coordinatorUpdate

10. When you click to update the firmware, the device will be re-programmed to be a Coordinator AT. You can see that the symbol of the device on the left will be changed.

11. Similar to the previous case, we will update some values of this coordinator device: PAN ID, DL (Destination Address Low), BD (Baud Rate) and RO (Packetization Timeout). Find these parameters and change them to values in order: 3039, FFFF (default value), 115200 and 0.

12. Click on write settings button and finish the update. You can leave this XBee connected to your PC

hotgluekit_coordinatorSettings
Note: Notice that we have selected the PAN ID and Baud Rate same for both devices. PAN ID is the network ID, this should be the same for all the other modules you want to command with your coordinator. Baud Rate should also be the same so that data transfer can be done with same transmit settings.

Arduino Programming

In order to program our Arduino Pro Mini, we will use the free software from Arduino. The source code that will upload to our arduino can be found here.

1. Plug your FTDI programmer with the mini USB cable to your PC. Your operating system will download the necessary drivers for the FTDI chip.

2. Solder 5 pin headers to your Arduino's programming pins.

3. Connect the FTDI chip to the Arduino's soldered pins and wait for your operating system to download the necessary drivers.

4. Run the Arduino software.

hotgluekit_ftdi_arduino

5. Open the Arduino source code we provide.

6. Select the "Arduino Pro or Pro Mini (3.3V, 8MHz) w/ ATmega328" board from Tools-> Board

7. Select the COM port where the FTDI is attached from Tools->Board

8. You can find the unit ID of your module in the code line 65 as "myID" and line 66 team ID as "allID". By default we set myID to M1 and teamID to MA1. If you want to build more modules, change myID to M2, M3 and so on.

9. Upload the code by clicking the upload button.

10. After the successful upload, unplug the Arduino from the FTDI board.

hotgluekit_uploadCode
11. IMPORTANT: As we are going to use XBee with the Arduino, we will have to solder it to the TX and RX pins of the Arduino board. If you will need to re-upload a code to your Arduino, you have to make sure that the TX and RX pins are desoldered from the XBee device. Otherwise your code will not upload properly as FTDI board is also using these pins to upload data to Arduino.

Serial Communication

When the coordinator XBee is connected to the PC, any serial communication software which can send and receive data from the serial (COM) ports of the PC can be used to communicate with the modules. XCTU software allows the bi-directional serial communication. Users are also free to use serial communication in MATLAB and can start with this sample code. hotgluekit_serialComm