Skip to content

Serial Port Issues 4: XBee’s and Serial

January 14, 2010

To close the last chapter:

1. Regarding programming the Arduino via XBee, as Tom Igoe has noted, it is not as simple as a USB upload: the Arduino and XBee data rates are different, and the Arduino needs to be reset.  Zach Taylor mentioned that rather than hitting the reset button, one can pass the DTR line from a USB-to-serial board through one of the XBee’s digital pins to the reset pin.  We’ll be exploring this further in Rob Faludi’s Sociable Objects class this Spring.

2. Different hardware does require remapping, and reference voltages all need to be verified and set.

3. There was a cold solder joint at one of the accelerometer pins that was at least one of the major causes for the serial/Java hangs described in earlier posts.  The most likely explanation is that at the rate Processing was trying to assemble arrays, any dropped data would cause it to freeze since I also did not have any error-checking in the code.  Fixing the joint and adding this code (provided by Dan Shiffman) eliminated all hangs:

String input = port.readStringUntil('*');
if (input != null) {
println("Receiving: " + input);
int[] vals = int(splitTokens(input,"\t*"));
// Make sure your array has 3 elements!
if (vals.length > 2) {

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: