Pages: [1]   Go Down
Author Topic: Xbee Serial.print does nothing but .read works  (Read 2233 times)
0 Members and 1 Guest are viewing this topic.
France
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
I'm trying to set up a point to point xbee network between my computer, using
2 Xbee S2
1 USB explorer
1 IO Expansion Shield For Arduino(V5)

The PhysicalPixel works fine as I press 'H' & 'L' with my computer.
But I need data to come back from the arduino to the computer, so I made a sketch with only Serial.println("Hello World !") in the loop.
When I plug the arduino and start the serial monitor, I've got a ton of hellos, and the tx LED is bright.
So, I put the shield with the Xbee and power up the arduino, and... it doesn't works. The xbee network is fine, the RSSI lights up a second, etc...
But I can only receive data with the arduino (PhysicalPixel works) but when I use Serial.print in my sketch, the tx LED doesn't light up, nothing happens. I thought that was because of the jumper being on "USB" instead of "Xbee", but there is no jumper like that on this shield (only jumper to select RS485/RD232, i'm on RS232).
It seems that no serial connection is established, but only for sending data from the arduino. Because if I plug in the arduino into the computer and start the serial monitor, the tx bright up and send a ton of hellos.

Sorry fot the bad english, and I hope that someone has an answer, because I've spend hours on this problem...
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 49073
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
when I use Serial.print in my sketch, the tx LED doesn't light up, nothing happens.
Then, your Arduino is broken.

Quote
The xbee network is fine, the RSSI lights up a second, etc...
There are no RSSI LEDs to light up... There is an associate LED that blinks to indicate that the XBee is operating, and  blinks at a different speed to indicate that it is paired.

Quote
I thought that was because of the jumper being on "USB" instead of "Xbee", but there is no jumper like that on this shield (only jumper to select RS485/RD232, i'm on RS232).
You need to post a link to the XBee shield you have. There are no such jumpers on either of the 2 shields I have.

Post your code, too. Also, what kind of XBees do you have? Series 1 or Series 2/2.5?
Logged

France
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for your answer smiley
D'oh ! Chrome have closed (?!), I have to write everything again... so :

Quote
Then, your Arduino is broken.
I don't think so, it works fine by connecting the arduino in the computer without the Xbee module. And the Xbee modules work, because I tried tho switch them and the problem is still the same (so that is not a module that is only able to receive and not to send).

Quote
There are no RSSI LEDs to light up... There is an associate LED that blinks to indicate that the XBee is operating, and  blinks at a different speed to indicate that it is paired.
The modules get correctly associated, and the associate LED blinks on both Xbee. But the RSSI LED light up for a second when associating. I've found on web that it's quite normal.

Quote
You need to post a link to the XBee shield you have. There are no such jumpers on either of the 2 shields I have.
I haven't USB/Xbee jumper, but I have a RS485/RS232 jumper. My shield is this one :
http://www.dfrobot.com/wiki/index.php?title=IO_Expansion_Shield_For_Arduino(V5)_(SKU:_DFR0088)

Quote
Post your code, too. Also, what kind of XBees do you have? Series 1 or Series 2/2.5?
I've got 2 Xbee Series 2/2.5 (now, I know that it was an error to buy 2.5 instead of 1 to set up a point to point networks).

My code is the PhysicalPixel with the Serial.println added :

Code:
const int ledPin = 13; // the pin that the LED is attached to
int incomingByte;      // a variable to read incoming serial data into

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // see if there's incoming serial data:
  if (Serial.available() > 0) {
    // read the oldest byte in the serial buffer:
    incomingByte = Serial.read();
    // if it's a capital H (ASCII 72), turn on the LED:
    if (incomingByte == 'H') {
      digitalWrite(ledPin, HIGH);
    }
    // if it's an L (ASCII 76) turn off the LED:
    if (incomingByte == 'L') {
      digitalWrite(ledPin, LOW);
    }
  }
  
  Serial.println("Hello World !");
}

When connected to the computer using serial, everything is fine. I can play with the LED using H & L, and I receive a bunch of Hellos.
When using Xbee modules, H & L works, but I do not receive any Hello. IMHO, it seems that the serial connection isn't well established.

Have a nice day !

Edit : I think it come from the beginning of the serial connection : when the arduino is plugged into a computer, it doesn't send the bunch of hellos (the tx doesn't light up). It starts to send hellos when I start the serial monitor. So I think it doesn't send hellos over Xbee because it doesn't detect that serial monitor has been launched (no correct serial initialization over radio ?), or something like that ?
« Last Edit: September 06, 2011, 05:53:29 am by Aurélien » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 49073
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Edit : I think it come from the beginning of the serial connection : when the arduino is plugged into a computer, it doesn't send the bunch of hellos (the tx doesn't light up). It starts to send hellos when I start the serial monitor.
On what operating system?
Logged

France
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 I'm on Windows 7 x64 Ultimate Edition smiley
Logged

New River, Arizona
Offline Offline
God Member
*****
Karma: 19
Posts: 935
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

try to isolate the problem.  Hook the XBee to the arduino without using the shield.  Use jumpers to get 3.3V ground and the two signal lines without the Shield at all.  Don't worry about the voltage difference on the Rx Tx pins, I've done this many times, just don't use the 5V power by mistake.

And, put a delay(1000) in there somewhere to slow it down and not overrun any buffers on any of the chips. 

There's a few things that can happen in the configuration of the XBees that can drive you nuts.  I've listed the ones that gave me problems on my web page at http://draythomp.blogspot.com/p/world-of-xbee.html.  This might help you also.
Logged

Trying to keep my house under control http://www.desert-home.com/

France
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The problem is that I cannot put the Xbee alone on the proto board, because of the non standard spacing between pins...
But I tried some things :
I added a delay, but the problem is still the same...
But, a question : as the data passes trough the xbee module instead of the serial port, that's normal that the tx doesnt light up, isn't it ? So I tried to put a led on the xbee's tx pin, and it blink a little every second. As I put a delay(1000), it makes sense. So it seems that the arduino, the shield and the xbee works.
So, this is a problem of configuration (IMHO). I used this topic to set up my system : http://www.plasticbit.com/2010/04/05/arduino-processing-and-2-xbee-series-2-modules
But the strange thing is that if I swith the Xbee module, the problem is still the same...
Damn it !

Edit : I'm trying this out : http://www.robotshop.com/forum/showthread.php?614-Xbee-Series-2-Point-to-Point-Duplex-Configuration
« Last Edit: September 07, 2011, 05:46:32 am by Aurélien » Logged

New River, Arizona
Offline Offline
God Member
*****
Karma: 19
Posts: 935
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm convinced you have a problem with the shield.  My suspicions are based on the way the shield supports an SD card and RS485/232 and has a lot of little posts that you short out to configure it.  Didn't you say that the arduino alone works fine sending hello to the computer?  That's why I suggested you hook the XBee up without the shield to isolate something away from the problem.  You only need power, ground and TX RX and you may have something that will fit over the pins on the XBee that you can hook in.  This is only temporary until you can tell where to look for the problem.

However, If you send data out the arduino serial port the little Tx led should light up.  Same for getting data back, the little Rx led should blink.  These are the leds on the arduino board though, not the ones on the shield.

Now, looking at the schematic for the shield.  It appears that the Tx, Rx for the XBee go to a plug that leads nowhere.  So, to get the Tx, Rx from the XBee to the arduino, you have to add two jumpers.  This makes sense since they don't know if you want to use RS485 or XBee or both to communicate.  The XBee Rx, Tx show up on J15 pins 4 and 5.  I suspect these have to be jumped to pins 0 and 1 on the arduino.  But you have to make sure you're not also jumpered to some other pin so that one of the other features is enabled.

But, here's the problem I have, the picture of the shield doesn't seem to match the schematic they point to.  There's another plug, J13 that I can't find on the picture and some of the things are confusing.  However, look at the schematic, find the XBee Tx pin, trace it out and figure out how to get it to the arduino Rx pin.  The do the exact same thing for the XBee Rx pin.  I'll bet you find something isn't going somewhere.

But, based on the schematic, this board is actually pretty nice.  If I'm reading the schematic correctly, you can hook any pin up to the RS485 converter and same with the XBee.  That would even allow both of them to be used at once.  Once you understand how the board is configured you could have an XBee to RS485 converter that has a computer in the middle that can save data on an SD card. 
Logged

Trying to keep my house under control http://www.desert-home.com/

France
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I soldered wires directly on the Xbee's pins, and plugged them into the arduino. IT WORKS !
So, the problem is the shield, you're right. I'm taking a look at the shield. Thanks.
Logged

New River, Arizona
Offline Offline
God Member
*****
Karma: 19
Posts: 935
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Congratulations!!  Now you're on your way to finding the next problem; whatever it is.

Have fun.
Logged

Trying to keep my house under control http://www.desert-home.com/

France
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

YEAH !
The 10k resistor of the Xbee's Rx (the arduino's Tx) was bad soldered. That's tiny, but I managed to solder it correctly. So it works ! Thanks a lot !
(It happens, when you buy stuff in china on ebay... arh)

Edit : To see a pic of the resistor that wasted my time : http://club-robot.enise.over-blog.com/article-resolution-du-probleme-xbee-83808896.html
« Last Edit: September 09, 2011, 11:45:55 am by Aurélien » Logged

New River, Arizona
Offline Offline
God Member
*****
Karma: 19
Posts: 935
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Congratulations again!

I just love google translate!!  It isn't perfect, but wow, I could actually read your blog.  I wonder if google realizes what they've given us with that thing? 

Now, you can get on to the really hard stuff.  smiley-lol
Logged

Trying to keep my house under control http://www.desert-home.com/

Pages: [1]   Go Up
Jump to: