XBee confusion

Hey,

So I am working on a projected in which I am trying to transmit an analog signal wirelessly through two xbees. On the sensor end I have a xbee module on a Sparkfun Xbee Explorer USB Breakout board. I am hoping to use the ADC onboard the xbee to transmit the 0-3V signal from my sensor.

On the other end I have an arduino with an xbee shield and xbee module.

I am able to set up the sensor side module as a coordinator and the arduino-side module as a router/end device in order to transnfer serial dats from the arduino to the sensor side module. However, I am having trouble reversing the flow of this. I need to be able to transmit an analog signal from the sensor to the arduino, and then read this signal in serial from from the arduino via pc.

Any suggestions on what I should do?

I am using series 2 modules

This might helphttp://www.faludi.com/2006/12/03/xbee-direct-io-with-adc/ along with tutorials from adafruit sparkfun and digi on how to use xbee modules.

So I've got transmission of serial data up and running, however I'm having another problem. The data from the sensor is being transmitted, bu in "bursts". What it seems like is that it is waiting until it has a full packet (100 bytes) , and then transmitting I was wondering if anyone had any thoughts on how to force the Xbee to transmit whenever it receives serial input.

Just so you know, I have the Packetization timeout set to zero.

thanks

In addition, it seems as if the arduino code is exiting the main loop() part and going back to setup() periodically.

Yes that sound right .

The manual says -:

As an example for a simple A/D link, a pair of RF modules could be set as follows:
These settings configure the remote module to sample AD0 and AD1 once each every 20 ms. It
then buffers 5 samples each before sending them back to the base module. The base should then
receive a 32-Byte transmission (20 Bytes data and 12 Bytes framing) every 100 ms.
Remote Configuration
DL = 0x1234
MY = 0x5678
D0 = 2
D1 = 2
IR = 0x14
IT = 5

Base Configuration
DL = 0x5678
MY = 0x1234
P0 = 2
P1 = 2
IU = 1
IA = 0x5678 (or 0xFFFF)

IT (v1.xA0*) I/O Settings Samples before TX. Set/Read the number of samples to collect before transmitting
data. Maximum number of samples is dependent upon the number of enabled inputs

In addition, it seems as if the arduino code is exiting the main loop() part and going back to setup() periodically.

can you post a brief sketch that shows that problem?

I know that if you plug in the USB ,or go from stop to monitor .
You get a reset - which runs the set up code again.

yeah, here is the sketch:

#define sensor 0

int sval = 0;

void setup()  {

  Serial.begin(9600);

  Serial.println("Connection Established");
}

void loop()   {
  
  // Transmit data//
  
  sval = analogRead(sensor);

  Serial.println(sval);
  delay(50);
}

I think what is happening with the bursts is that the xbee is waiting for a 100 byte packet to transmit. Anybody have any solutions as to how to force the xbee to transmit more frequently?

Swivel, your first post said that you had a problem reading data from the xbee. The sketch you posted only transmits data. I understood you to say that part was working ok. Perhaps you can restate your question and post the code that you want to get working (if its different from the above).

I apologize, I am working on this project as I post, so my older posts have lost relevancy as my design decisions have effected the initial configuration. Currently I am operating a arduino reading an analog signal from a sensor. This signal is then sent serially to the xbee module on an arduino xbee shield. This xbee module then communicates with another xbee module which is connected via usb to my pc. The sketch detailed above is the one loaded onto the arduino.

So for I am able to transmit data from the arduino xbee to the pc-attached xbee. however, I am having a problem with the data coming in "bursts". I'm not sure what the cause of this is. I have two theories:

  1. The Arduino is exiting the main loop() function, restarting it's setup function, and as such is transmitting in bursts.

  2. The xbee module is waiting for 100 bytes to transmit.

I'm more inclined to think that the problem is cause by 1), as when I monitor the com port the "Connection Established" text prints every time one of these bursts occur. Does anyone know why my Arduino board would do this?

So you are on version 1 xbees ?

Have you tried resetting the xbee to it`s default and starting again ?

The project I`ve played with which uses 2 xbee version 1s.

It transmits the time every second over the xbee to a PC.

It sends nn:nn:nn , which is only about 10 bytes and do transmit every second , therefore can`t be buffered.

If you are using the I/O direct and not sending serial data look at IT

IT (v1.xA0*) I/O Settings Samples before TX. Set/Read the number of samples to collect before transmitting
data. Maximum number of samples is dependent upon the number of enabled inputs

Perhaps run that sketch connected directly to the PC without the xbee shield and see what happens. If you get the “connection established' message then the problem may have nothing to do with the xbee

To peter:

I am using series 2 xbee modules, one set up as a znet 2.5 coordinator and the other as a znet 2.5 end device/router.

To mem:

I tried connecting the arduino up to the pc directly and the sketch runs just fine (no "Connection Established"). It must be something within the xbee/xbee shield which causes this problem.

I am using series 2 xbee modules, one set up as a znet 2.5 coordinator and the other as a znet 2.5 end device/router.

I am running the same, and with the default configuration I get no delay. Did you modify any configuration that could have changed the behavior? Are you running the latest firmware?

Wow!

I reset both of my modules to the defaults, and voila, instant non-bursty data. Thanks to everyone for helping me out.

Well !!!

What can I say .

From reading the forums that is the 99% solve all.