We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpElectronics,  Serial Library › Processing <--> XBee <--> Arduino
Page Index Toggle Pages: 1
Processing <--> XBee <--> Arduino (Read 3650 times)
Processing <--> XBee <--> Arduino
Apr 19th, 2009, 1:23pm
 
I've been experiencing some delay issues communicating between processing, xbees and an arduino. The delay is significant enough, anywhere from 2 -10 seconds, that I must have something setup incorrectly.

Essentially, I've got a processing test sketch controlling and reading the sensors and motors off of my arduino.  I have a sparkfun xbee dongle attached to the computer and an xbee shield attached to my arduino. I loaded Standard Firmata onto the arduino. Similar to what was done to the Firmata library at michaelclemow.com's blog (I can't post the full link)  I instead modified the Arduino library slightly to recieve the xbee parameters from processing, rather than hard code them into the Firmata.cpp file.
I added this to the constructor of Arduino, passing in a new object called XBee
Code:

if(xb!=null){
   xb.writeToSerial(serial);
}

The xb is just a helper class and the meat of the writeToSerial method is this:
Code:

serial.write("+++");
serial.write("ATDH"+destinationHigh+", DL"+destinationLow+"\r");
serial.write("ATMY"+myAddress+"\r");
serial.write("ATID"+panId+"\r");
serial.write("ATCN\r");


All that works great. the problem is, that like I said earlier, the sketch controller seems to have a delay of 2-10 seconds. If I remove the xbees from the architecture, everything responds correctly and quickly.

When I reattach the xbees, its response times slow to a crawl. At first I didn't think they were working, but I've been able to confirm it's just delayed. I've added print statements pretty much everywhere and it seems as though the arduino receives the commands, but hangs somewhere.

I have the baud set to 115200 and the packetization timeout set to 0 and it's faster than it was at the default of 3, but something is still wrong. I've changed to a lower baud rate and that seemed slower as well. The xbees are right next to each other right now.

The coordinator zdnet 2.5 Destination address is set to FFFF, which is broadcast all. Are there any optimal performance settings that can be tweaked?

Even without running through Processing, and just testing the radios through gtkterm, the response is slow. So I'm pretty sure it's something with the xbees.

Running on Ubuntu 8.10, jdk6, arduino 15, processing 1.0.3, xbee series 2.5's. I am running avr-gcc 4.3, which I know has a major bug with long's to int's; is it possible that this bug is being exposed though the timing protocols?

Any Ideas?
Re: Processing <--> XBee <--> Arduino
Reply #1 - Apr 20th, 2009, 12:55pm
 
So, if I understand the problem correctly, the xbees respond in a timely fashion only when they are not hooked up to an Arduino.

What arduino hardware are you using?
Re: Processing <--> XBee <--> Arduino
Reply #2 - Apr 21st, 2009, 9:00pm
 
No actually, using gtkterm, I can query the remote xbee with the command "ATND" and that command takes a couple of seconds to respond as well.  And when I turn on my Processing sketch that is reading and sending commands via the Arduino Processing library the delay is greater.

The Arduino for Processing library assumes that the Standard Firmata is loaded onto the Arduino. Under the hood, it's just interpreting the serial commands.

I have a feeling it has something to do with the coordinator being set to broadcast all (0xFFFF). I've been reading through all the digi specs, but haven't found anything to support that theory yet.
Re: Processing <--> XBee <--> Arduino
Reply #3 - Jun 22nd, 2009, 11:18pm
 
Dear
i have 2 xbees series 2 ,ATND tells the XBEE to do a Node Detection, which lets us find what devices are on around us.i have send atnd from ATMEL89c52 conected with one of the xbee ,i dont no why the other xbee no response ,do u have any idea pliz?
Page Index Toggle Pages: 1