3 Xbees, can I use AT Commands too control via coordinator?

Hi,

I am using Xbee ZB modules, the coordinator is connected to a PC, each XBee has a microcontroller

I have looked through all the documentation but cannot find a clear answer.

I will have one coordinator and three end devices, each of the end devices will have a microcontroller attached, and will listen for any information on the serial port connected to its Xbee.

The microcontroller will be monitoring a temperature and I wish to send it back to the coordinator on a temperature change.

The coordinator from time to time will ask the microcontrollers via the XBee module their temperature, so a very simple setup!

I would prefer not to use API mode at the moment as it looks very complicated. I would like to communicate with each Xbee module using the AT commands.

Is this possible?

If so how would it be done?

Would I use the coordinator to select the address of a specific Xbee module ( as they would all have individual addresses set previously) then send a small text file which each microcontroller would process and then send back data to the coordinator?

Regards

Gary

This is doable and it isn’t that hard.

The API commands look difficult but are easier to use with a processor than the AT commands. The AT command needs the ‘+++’ then a wait (but not too long) then the command, its designed for a human interface.

If you are running the XBees as received the coordinator is running in API mode. So your PC must talk to the coordinator with API frames. This is an advantage as the address of the sending unit is embedded in the API frame so the code running on the PC can determine which unit send the data.

The PC, through the coordinator, can request data from any of the other XBees IO pins. To request data from the microcontrollers a data frame is sent to the processor which then sends its data, temperature, back to the coordinator.

Conversely, with a processor on an XBee, the processor can send data to the coordinator on its own. Again, if you use API then the address of the sending XBee is in the API frame. This is close to how a remote XBee works without a processor attached.

Look through the threads here and in the PIC SFE PIC forum on API frames. There have been several threads on the subject with code. It is not all that difficult.

Here are some links that may help:

http://code.google.com/p/python-xbee/so … nk/xbee2.5

http://www.jsjf.demon.co.uk/xbee/xbee.html

http://www.circuitsathome.com/category/wireless/xbee

Post back with additional questions.

Edit to add the following:

You may be able to leave the XBee end devices in AT mode (firmware version) but keep the coordinator running API firmware. With the XBee’s set this way the coordinator can send a data frame (PC sends a formated API frame to the coordinator with the end devices address) to an end device and it data should come out the serial port to the processor. In the other direction the processor send data into the XBee’s serial port and it comes out of the coordinator as an API frame.

I believe I did experiment with this set-up but may need to do it again to confirm.

There is a third method to consider. The XBee modules do have analog inputs. You can connect your temperature sensors (with the appropriate conditioning circuits) to the XBee inputs (the series 2 XBees have a full-scale input of 1.2V). The coordinator, from the PC, can query the value of the XBee input with the AT"IS" command or the remote XBees can be set up the periodically send the value to the PC by way of the coordinator.

If you are only interested in a change of temperature then the PC can throw away any value that does not change.

Hi Waltr,

Thanks for the reply, I am not sure how i have the coordinator set up, all I know is that its set to replace a RS232 cable, which I beleive is using AT commands?

I am hoping to use VB.NET to talk to the coordinator as if it were a RS232 port as in serial port. As this is fairly simple in VB.NET

Would this be possible, as you say API is most probably easier that i think, but just wanted to get it up and running, as simple as possible, before at a later stage trying API.

Regards

Gary

If your coordinator is running AT firmware then any data sent into a remote XBee (with the remote’s DL,DH set to the coordinate’s SL,SH) will go to the coordinator. This will work if you send an identifier along with the temperature data so you know which XBee the data is coming from.

One down side that I can foresee is that a remote XBee may not send all the data in one shot. What can happen is the coordinator receives part of the data from one remote XBee then data from a different XBee the the remaining data from the first XBee. The result is that the data from the two remotes is scrambled together without a good way of separating them. You’ll have to check this but I think that it can happen.

Go for the AT method to get it up and running. Then if there are problems you can switch to API on the coordinator by adding a decode layer in your VB.NET code.

you can, without using a microprocessor attached to the XBee, I believe. Configure it using XCTU to send an A/D sample every x amount of time, addressed to some XBee.

Hi,

Waltr:

Thanks for your help so far, nice to have someone to give me pointer to what will work even if its just to get the basic parts of it going, then gradually increase the complexity.

Stevech:

Thanks for that info, but I am actually using a DS1820 which is an all digital temparture sensor. But many thanks for giving me that info that i may use for something else at a later date.

regards

Gary

questuk:
Hi,

Stevech:

Thanks for that info, but I am actually using a DS1820 which is an all digital temparture sensor. But many thanks for giving me that info that i may use for something else at a later date.

regards

Gary

OK. I’ve used the DS1820. If you hooked a thermistor/resistor arrangement to the XBee, you’d not need a microprocessor. But you may well have other reasons for the micro to be there.