SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By ander.dominguez
#166250
Hi, :D

I have started to work with these Xbees, in order to see if they fit on a project that I'm doing. I have just bought a development kit with 2 Serie 1 Xbee Pro, a board to connect one to the computer through USB and another board to connect it through a RS232 cable.
I already know how to set most of the parameters of the Xbees (PAN ID, Channel, etc.). The problem is that I want to have a star topology for my system. I want a Xbee asking the rest of the Xbees to give the information from one of their analog inputs. The problem is that I don't know how can I do that.
The coordinator Xbee will have a controler, but first of all I want to get the raw information somewhere.

The problem is that I don't know how to ask from the central Xbee to each one of the others at a time.

(I hope that you understood my queston and want to apologize if there's any mistake. It's only that English is not my first language, I'm not completely stupid, just a bit)
By stevech
#166268
you can configure XBee S1 to sample analog signals you wire up and send samples at some interval to a specific gateway XBee. No code to write.
Just config XBee S1 using PC and XCTU.
You need to invest time in reading the Xbee S1 User Guide/OEM manual where how to do this is well described. But it is not a 10 minute job.
Happy to help you here.
By ander.dominguez
#168048
Thank you for your answer.

I have been looking at the Datasheet for a while and I think I know how can I do it. However, I have a question regarding the measurements of de ADC.
If I want to measure the value of the ADC every 66ms, then send it to another Xbee (quite simple to do), whilst the Xbee is trying to send the information from one to the other is the first Xbee reading from the ADC? Or am I going to lose information?
I mean, can the Xbee read the ADC while sending information to another Xbee? Is that ADC value stored in some kind of buffer for the next X samples, and not lost?

I hope that you understood my question.

Thank you very much.
By waltr
#168066
For a typical setup the ADC reading will not be lost. You setup the XBee parameter to read the ADC periodically (66ms) and it will send it to the destination XBEE (as per the DH & DL parameters) and get an ACK (it'll resend of it does not get an ACK up to three times).
The only way to lose the ADC reading is if the Receiving XBee's UART output buffer fills up due to holding CTS inactive (if CTS is enabled) or the processor (serial port) does not receive the XBee's UART data.
It is also possible to over whelm the RF channel if you try sending too much data (like streaming UART to UART) at high Baud rates. Just remember that XBees are designed for low data rates (bandwidth).
By ander.dominguez
#168086
Thank you for your answer Waltr.

My system consists of 13 Xbees, each of them sending 80Bytes of information + Addressing (20 measurements of 2 ADC signals) every 1.33s, to a coordinator Xbee. All of the 13 set with the DH=0x00 and DL=0x01. The coordinator MY=0x01, DH=0x00 and Dl=0xFFFF. I hope that is low data rate. However, what I meant by "losing information" is that each of the Xbees will/could be trying to send the information through the channel (air-CSMA/CA) and some of them will/could be waiting to send de data. My question is if those Xbees will read the ADC while they're waiting to send, while reading if the channel is ocupied or free.

I hope that you understood my question.

Thanks in advance.
By waltr
#168097
Kind of hard to answer.
If there is so much RF traffic that the XBee with the ADC value can not get the value sent before its time to take the next ADC sample I really don't know if the pending ADC value is buffered and then sent.
Lets do some math:
80 bytes = 800bits (8-N-1) * 13 XBees = 10400 bit
every 1.33s: 10400 bits/1.33 = 7820 bits per second.
The RF bandwidth of the XBees is 250Mbps but has a good bit of overhead (wait for clear channel, checksum, ACK back to sender) so it is fairly safe to assume an rf bandwidth of a quarter or 62.5kbps which is 6 time the required data rate.
So it seems that there should not be any problems getting all the data through unless the RF links are very weak or have interference and the XBee's must do several re-sends before getting an ACK.
By ander.dominguez
#168588
Thank you for your answer Waltr.

I'm going to forget that problem for a while as I have two questions for you (or anybody else who knows the answer).

First of all, I have a space constrained application where I have to use a PCB or chip antenna. However, I don't know which one is better, or what the difference is, regarding range.
http://ftp1.digi.com/support/images/XST ... tennas.pdf
Second, I'd like to use the coordinator Xbee to send to sleep the rest of the Xbee when my application ends, but I don't know how to do that. What I want is to wake and sleep one of my remote Xbees from the coordinator when I want (some kind of remote switch, but I want to switch the 13 Xbees off/on sepparately).
How could I do that? Could you help me?

Thank you very much.
By waltr
#168592
If the distance is not too great then the chip antenna should work fine. But you will need to run tests to verify operation is to your satisfaction.

Offhand I do not know how to put a remote node to sleep. Check the remote commands (AT commands) that the coordinator can send. I do know that the sleep period can be set remotely so maybe that can be used creatively.
By stevech
#168616
Xbees.. antennas...
Best: U.FL connector + pigtail coax going to a small (rubber ducky type) or large antenna, depending on need.
Better: Short stubby wire antenna, standard option
Poor: chip antenna on PCB. OK for short ranges
N/A: on-PC board copper traces. I've not seen that in a Digi product.

Sleep and end device
If Xbee series 2, the mandatory use of Zigbee dictates what's done.
If XBee series 1, and using Digi's very fine DigiMesh, it too dictates the sleep schedules.
If Xbee series 1, and not using DigiMesh, you configure the sleep times and wake causes other than timing, or there's a wakeup by I/O pin change. Or some other node can send remote AT command to change the sleeping. Beware of course: Remotely mis-configuring can lead to a long walk or airplane ride.
By ander.dominguez
#168622
Thank you both for your replies.

I'm not that worried about the antenna, as far as my Xbees will be no further than 6m from the coordinator and that I can use a wire antenna (just realized that I could use the wire one).

I'm using series 1 Xbees and not DigiMesh. My system is just some kind of A/D link. It measures some values and then sends them to the central or coordinator Xbee. However, the problem relays on sending the information. I need to send the information from each Xbee every 1.3s but separately. Namely, I want to send the data of each Xbee (13 Xbees) separated by 100ms each, otherwise the channel will be occupied and my system will not work the way I want. That is why I want to switch them on in a controlled way. And, of course, I cannot control when to turn on the different power supplies; the system has to handle that data sending by itself.
What I would basicaly need to know is what the AT command is in order to send a Xbee to sleep mode. And which one to wake it up.
It's maybe to much to ask, but I don't know how to do it.
By ander.dominguez
#168656
Of course I have read it. But it doesn't tell me, if possible, how to send an Xbee to sleep remotely.

"Sleep Modes enable the RF module to enter states of low-power consumption when not in use. In
order to enter Sleep Mode, one of the following conditions must be met (in addition to the module
having a non-zero SM parameter value):
• Sleep_RQ (pin 9) is asserted and the module is in a pin sleep mode (SM = 1, 2, or 5)
• The module is idle (no data transmission or reception) for the amount of time defined by the
ST (Time before Sleep) parameter. [NOTE: ST is only active when SM = 4-5.]"

I cannot change the status of pin 9 (I'd have to do that manually). Not valid for my application.
I cannot set the ST as long as my application will be working 1-2h each day at a different time. I need to send a kind of Sleep the Xbees at the end of the use. Wake them up again (in a controlled way and remotely) when I'm going to use the application. Switching on and off the power would work the same way, but that would also need to be controlled remotely...
I don't know what to do, or how to do it.
By Valen
#168661
If you have one central Xbee configured to be Coordinator (where all the samples as supposed to be sent to) and not sleeping (needs CE=1, and/ or SM=6 for backwards compatibility with older firmware), then you can use that one to send remote configuration commands (Api indentifier ID 0x17) to each end device XBee to disable it's sleep mode (SM=4 or 5 vs 0) and alter it's cyclic sleep period (ST, from long sleep period to short/off period and vice versa). Each end device XBee should check for RF activity and request unreceived messages from the coordinator when it wakes up from cyclic sleep.

[EDIT] But it appears only one message for one end device is stored. So waking up all of them needs to be done one at a time.

It might require some time for all of them to be in the same awake mode. And I don't think the sampling will be synchronised among all the Xbee end devices. But when the 1-2 hours are done then you can send them all messages to return into cyclic sleep mode. (I'd say to the broadcast adress) It's takes a bit of communication and organisation and transition time, but should be possible.

However I must admit that I never had as many Xbees to try this out with. Just 2, and barely played around with sleep settings.
By ander.dominguez
#168679
Thank you very much Valen, your answer was what I needed! :D

The fact is that my application is a bit weird... Moreover, I'm not an expert in communication (that's why I'm using Xbee) and I have few time to do my "degree ending project"(? Don't know how to call it in English) which is to design 13 sensors (strain gauges) and send the information wirelessly, starting from nothing and ending with a completely functional/salable product...
I guess I could kind of cheat the Xbee to make it work my way.
Thank you very much (again) and I'll ask in case the Xbees don't obey. :twisted: