Let me first start off by saying I am nowhere near an expert Xbee's, but the sole purpose of what I want my Xbee's to do is serial communication with my Arduino. The model # of my xbee is XBP9B-DMUTB002 revE. At this point using the xctu software I'm able to get the two to talk to each other, but once I try to Implement with Arduino I fail to get the two to talk with one another. My whole goal is just to get the two to talk over serial.
Is it even possible with these types of Xbees or am I using the wrong type?
Your help is really appreciate it! I've been racking my brain for two weeks and I'm getting ready to pull the hammer out JK
Xbee 2 (Transparent mode, with xbee 1 DH,DL)
At this point connected to XCTU monitoring incoming messages from arduino.
The Code im useing for Xbee 1 is
#include <SoftwareSerial.h>
SoftwareSerial mySerial(14, 15); // RX, TX
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
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
if (mySerial.available()) {
Serial.write(mySerial.read());
}
if (Serial.available()) {
mySerial.write(Serial.read());
}
}
It won't fix your current issue, but will be a problem for you later (or perhaps you addressed it already?)
These XBees work just fine with Arduino if the wiring and code is correct. Reversing TX/RX often cures XBee problems, even when you think you had it right the first time (been there...).
EDIT: Just realized you are not using the XSC S3B, so my link/warning is likely not applicable. I am curious as to why you are using a programmable XBee (according to the model# you gave it has a 32K programmable chip on it), then hooking it up to an Arduino?
ipecacd: @madmattd Yes my Xbee has a 32K programmable chip. Does that make it unusable with arduino?
No, more than likely it should be fine. A serial port is a serial port. It just seems odd to put a radio with a programmable microprocessor on it (the XBee) onto another programmable microprocessor (the Arduino) If it were me, I'd be saving myself the couple dollars apiece and using the non-programmable XBee, but there should be no harm in using what you have.
Your issue on the Arduino end is almost certainly a wiring one.
Actually, you never said which Arduino you are using. Pins 14 and 15 sounds like a Mega?
Are you seeing the "goodnight moon!" print on your Serial monitor?
madmattd:
No, more than likely it should be fine. A serial port is a serial port. It just seems odd to put a radio with a programmable microprocessor on it (the XBee) onto another programmable microprocessor (the Arduino) If it were me, I'd be saving myself the couple dollars apiece and using the non-programmable XBee, but there should be no harm in using what you have.
Your issue on the Arduino end is almost certainly a wiring one.
Actually, you never said which Arduino you are using. Pins 14 and 15 sounds like a Mega?
Are you seeing the "goodnight moon!" print on your Serial monitor?
When I bought the xbee I didn't realize it was programmable until after it shipped . Yes i am useing 2 arduino mega's. Once i plug in the mega i see "goodnight moon!" but nothing after nor if i send anything over the serial.
You should use other pins. 14 and 15 have hardware serial port hardware (although not connected) and should be used as hardware serial ports (why not using the hardware serial?)
Your VCC on the adapter should be connected to arduino 5V.
Ok guys, made some progress here I think. So this is where im at, i got to the point where the xbee talk... kind of talk. I have one xbee(Lets call this one Xbee1) hooked up to arduino using the code shown in the picture below, you can also see that I have received the message from the other xbee(Lets call this one Xbee2) connected to the computer.
The Xbee2 is connected to the Computer via FTDI, and you can also see in the next picture that I have received the message from the xbee1 connected to the arduino.
Here the kicker, looking at my arduino code and also seeing that both xbee(1 & 2) are config right(I could be wrong on that) I should be able to upload the code to 2 separate arduino Mega and have them talk....Right?
Well, at this point when i try to do that nothing comes up through the serial. I do notice that when i type in the xbee1's serial the status light on both boards goes solid(im guessing this means they connected?), but when type in the xbee2 serial the light never goes on...
I guess I think one of my biggest issues right now is I'm not 100% sure I have the two XBee configured correctly. should I be using API 1 or 2 or transparent? also should I be putting in the DH and the DL of the opposite XBee or should I just leave them blank? Should I be leaving both xbee's in router mode or should I have one router and one coordinator?
Can't "see" code from picture. You should check your picture yourself. Impossible to read the code. Transparent mode, and have each other's address in DH DL. Can't you use other pins than 52 and 53? They have special functions. Why not using hardware serial port Serial1 2 or 3 that mega has?
This morning I switched to pin's 2,3 and reset both xbee to factory only changing the DH & DL, also both were in transparent mode. I had no luck in any try of chat(made sure i hade the Tx and Rx correct)
You should use write instead of print.
Since this code seems to serve your purpose, I'll ask you to do a test. Use arduino serial monitor and type in +++ (no line break) and see if your xbee module enters AT mode. If not, you have again managed to screw up your wiring. If the xbee enters AT mode, try the same on the other module. Try ATDL and ATDH commands on both to see if the addresses are set to each other. If you have time, use XCTU to check if the firmware versions are the same.
So firmware are the same on XCTU, i am unable you see anything when i write "+++" in serial, but what i have found is using the xbee library i am able you send to the other xbee but it the data is messed up. Here is the code im using
What is the baudrate of your xbee module? Check it with your XCTU. If you don't see OK after typing in +++, you are not using transparent mode, or you're using the wrong baudrate.