The Stalker sensor platform : Part 4 - Transmitting data using Xbee's

Previously - The Stalker sensor platform : Part 3 - Getting time stamped temperature data

xbee-s2-pcb-500x500

In the last tutorial part we wrote our code to get a time stamped temperature data from the Stalker. Now we want to send this information wireless using  XBEE modules. The good news is that we don't have to touch code anymore. The XBEE module on the Stalker is connected to the same serial interface we've been using to talk to the computer. We need just to configure the XBEE modules and the wireless data transmission will work. For this session we'll need all the parts from the last tutorials and additionally we'll need:

If you're not shore which XBEE module type to use, have a look at our Introduction to XBEE tutorial.

 

     1.  Preparation

We'll use the tool X-CTU to configure the XBEE's. First we're going to configure our XBEE for the Stalker as End Device. Then we'll configure the other XBEE as Coordinator and giving it the address data of the End Device. After that these two XBEE's should be able to talk to each other. You can find a detailed explanation what End Device/Coordinator configuration means here.

The first steps are:

  • Install X-CTU
  • Plug one XBEE module into the XBEE USB Explorer and connect it to the PC

 

     2.  Configure End Device (XBEE module for the Stalker)
  • Start X-CTU

  • Press the Test button to test if the XBEE is connected, you should get an answer message as shown in the picture

  • Change to the "Modem Configuration" tab and press Read to get the actual XBEE configuration

2013-05-10 09_16_54-xbee_set_coordinator

  • Now set this XBEE as "ZIGBEE END DEVICE AT" and set a PAN ID of your choice, you'll have to give the other XBEE the same PAN ID to ensure that they can talk to each other. After this configuration we'll write these changes to the XBEE module by pressing the Write button
!! Be careful selecting the Function Set and ensure that you've selected the AT type (NOT API), if you choose the wrong option you may not be able to connect to the XBEE module anymore!!

2013-05-10 09_26_04-xbee_read_after function set

  • We need again to read the XBEE configuration to get the SH and SL addresses of our XBEE End Device. Note these two addresses, we'll need them later to configure the second XBEE module.
  • Unplug carefully our configured XBEE module, you can already plug it into the Stalker.

 

     3.   Configure the Coordinator (XBEE module for the receiver)
  • Plug the second XBEE module to the USB Explorer
  • Press again the test button in the first tab of the X-CTU window to ensure that the module is connected properly
  • Switch to the Modem Configuration tab and press read, you should see now again the standard XBEE configuration

2013-05-10 09_30_42-xbee_set_coordinator

  • Configure this XBEE module as ZIGBEE COORDINATOR AT and set the same PAN ID as on the other module, then press write.
!! Be careful selecting the Function Set and ensure that you've slected the AT type (NOT API), if you choose the wrong option you may not be able anymore to connect to the XBEE module !!
  • Read again the new configuration of our second XBEE by pressing the read button.

2013-05-10 09_38_37-xbee_coordinator_set_adress

  • Our Coordinator needs to know the address of our End Device. Therefore we'll set the SH and SL addresses from our End Device (which you hopefully noted somewhere) as DH and DL addresses in our Coordinator device. Press the write button after this change.

  • The two XBEE's are configured, and if you have loaded the code from tutorial part 3 on the Stalker and you plugged in the End device XBEE on our Stalker you should receive already the time stamped temperature data by switching to the Terminal tab of the X-CTU tool.

A useful advice at the end: mark your Coordinator XBEE somehow (small label or a pen dot), in that way you can distinguish what's the Coordinator and the End Device.

Next:

The Stalker sensor platform : Part 5 - Logging data using Raspberry Pi