The new Raspberry Pi B Model B+ is here - Pick one up in the store and check our detailed guide!

Adafruit xbee adapter v1.1 to send and receive data

by Umar Khalid on Wed Mar 13, 2013 9:01 pm

I am using xbee series 1 with adafruit xbee adapter v1.1. I have connected one adapter to the computer and other one is connected to Arduino Leonardo. When I use Arduino Serial Monitor to send data (“cool”), I can see it in x-ctu terminal as shown in the image below. But when I try to use x-ctu terminal to transmit data like ”writehere”. I cannot see anything in the serial monitor of the Arduino. I am using following code. Please can you help?


Code: Select all | TOGGLE FULL SIZE
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3);


void setup()  {
  pinMode(13, OUTPUT);
  Serial.begin(9600);
  Serial.println("Goodnight moon!");
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  mySerial.println("Hello, world?");
}



void loop()                     // run over and over again
{

  if (mySerial.available()) {
      Serial.print((char)mySerial.read());
  }
  if (Serial.available()) {
      mySerial.print((char)Serial.read());
  }
  delay(100);
}
Attachments
sen2.jpg
typing data from Arduino Serial monitor to send it to Xbee connected to PC
sen2.jpg (135.04 KiB) Viewed 476 times
send.jpg
Data received by xbee connected to the PC from Arduino Serial Monitor
send.jpg (136.96 KiB) Viewed 476 times
sending.jpg
Trying to send data from PC Xbee to Arduino but Arduino do not receive anything on serial monitor
sending.jpg (136.74 KiB) Viewed 476 times
Umar Khalid
 
Posts: 11
Joined: Sun Nov 11, 2012 8:00 am

Re: Adafruit xbee adapter v1.1 to send and receive data

by adafruit_support_bill on Thu Mar 14, 2013 5:24 am

How do you have the adapters connected to the computer and Leonardo? A photo(s) would be good.

Do you get the same behavior if you swap modules/adapters?
User avatar
adafruit_support_bill
 
Posts: 27992
Joined: Sat Feb 07, 2009 9:11 am

Re: Adafruit xbee adapter v1.1 to send and receive data

by Umar Khalid on Thu Mar 14, 2013 7:58 am

Yes I get the same behaviour when I switch the xbee modules. On the PC side I am using “USB XBee Adapter” and here is the photo of how I have connected Arduino to xbee module.
Attachments
arduino with xbee.jpg
Arduino xbee adapter connection
arduino with xbee.jpg (872.93 KiB) Viewed 446 times
Umar Khalid
 
Posts: 11
Joined: Sun Nov 11, 2012 8:00 am

Re: Adafruit xbee adapter v1.1 to send and receive data

by adafruit_support_bill on Thu Mar 14, 2013 8:09 am

The wiring looks right, and if swapping modules doesn't change things then the modules themselves are OK. Post photos of the front and back of the adapter (module removed) and we'll check over the assembly.
User avatar
adafruit_support_bill
 
Posts: 27992
Joined: Sat Feb 07, 2009 9:11 am

Re: Adafruit xbee adapter v1.1 to send and receive data

by Umar Khalid on Thu Mar 14, 2013 8:18 am

Please have a look at the front and back photo of the module.
Attachments
2.jpg
FRONT OF THE module
2.jpg (792.68 KiB) Viewed 441 times
1.jpg
back of the module
1.jpg (716.03 KiB) Viewed 441 times
Umar Khalid
 
Posts: 11
Joined: Sun Nov 11, 2012 8:00 am

Re: Adafruit xbee adapter v1.1 to send and receive data

by adafruit_support_bill on Thu Mar 14, 2013 9:28 am

Assembly looks good. But the solder joint on the Tx wire (pink) looks like a cold joint. Touch that up and see if that helps.
User avatar
adafruit_support_bill
 
Posts: 27992
Joined: Sat Feb 07, 2009 9:11 am

Re: Adafruit xbee adapter v1.1 to send and receive data

by Umar Khalid on Thu Mar 14, 2013 9:48 am

I tried soldering the pink wire again but it does not work. when I send data from PC red led "turns on" on the adapter connected to arduino but I can not see anything on the serial monitor. I think may be the code I am using is not compatible with arduino Leonardo.
Umar Khalid
 
Posts: 11
Joined: Sun Nov 11, 2012 8:00 am

Re: Adafruit xbee adapter v1.1 to send and receive data

by adafruit_support_bill on Thu Mar 14, 2013 10:00 am

Aha - the Leonardo! That is likely your problem. You should be able to make it work on a different set of pins.

http://arduino.cc/en/Reference/SoftwareSerial
Not all pins on the Leonardo support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
User avatar
adafruit_support_bill
 
Posts: 27992
Joined: Sat Feb 07, 2009 9:11 am

Re: Adafruit xbee adapter v1.1 to send and receive data

by Umar Khalid on Thu Mar 14, 2013 10:10 am

Thanks a lot. Now it is working!!!!!!!!!!!!!!!!! Adafruit products and customer support are the best in the world!!!!! Thanks thanks and thanks a lot again! :D :D :D :D
Umar Khalid
 
Posts: 11
Joined: Sun Nov 11, 2012 8:00 am