joe_prince
Well-known member
I'm having an issue when trying to use 2 xBees with the Teensy. Eventually I will need 2-way communication (for telemetry on the quadcopter), but for now I'm just trying to get simple 1-way communication to work.
Below is the bill of materials list for the circuit:
- Teensy 3.1
- xBee Series 2 (2mW): https://www.adafruit.com/products/968
- XBee USB Adapter Board: https://www.parallax.com/product/32400
- 3.3V Regulator: https://www.sparkfun.com/products/526
For the configuration of the xBees, I'm using transparent communication with a Coordinator in AT mode (which will be sending the data), and a Router in AT mode (which will be receiving the data). The settings that have been changed in XCTU are the pan ID [ID] to match for both xBees, the destination address high [DH] and low [DL] to match the other xBee, and the baud rate [BD] to 115200. Below are screenshots from XCTU for both the coordinator and router:
XCTU Coordinator Settings:
XCTU Router Settings:
I'm using the USB adapter board for the xBees, which takes a 3.3V input from the regulator. The TX pin of the xBee is connected to the RX pin on the Teensy, and vice versa. Below is a screenshot of the schematic and photos of the actual circuit:
Schematic:
Actual Circuit (one for the Coordinator, one for the Router):
Actual Circuit Close-up:
For now, I'm trying to establish simple communication using the following code:
Coordinator (sender):
Router (receiver):
Just to make sure my xBees were working properly, I used the same circuit and code with 2 Arduino Uno's and it worked as expected (i.e., the router received the 'K' character and turned on the LED on pin 13). I even tested other variations where I sent a larger packet of data and the receiving Arduino Uno received it all. I also have the longer-range series 2 xBees (63mW) that I will be using for the actual quadcopter, but again those worked fine using 2 Arduino Uno's but didn't work with the Teensy.
Below is the bill of materials list for the circuit:
- Teensy 3.1
- xBee Series 2 (2mW): https://www.adafruit.com/products/968
- XBee USB Adapter Board: https://www.parallax.com/product/32400
- 3.3V Regulator: https://www.sparkfun.com/products/526
For the configuration of the xBees, I'm using transparent communication with a Coordinator in AT mode (which will be sending the data), and a Router in AT mode (which will be receiving the data). The settings that have been changed in XCTU are the pan ID [ID] to match for both xBees, the destination address high [DH] and low [DL] to match the other xBee, and the baud rate [BD] to 115200. Below are screenshots from XCTU for both the coordinator and router:
XCTU Coordinator Settings:
XCTU Router Settings:
I'm using the USB adapter board for the xBees, which takes a 3.3V input from the regulator. The TX pin of the xBee is connected to the RX pin on the Teensy, and vice versa. Below is a screenshot of the schematic and photos of the actual circuit:
Schematic:
Actual Circuit (one for the Coordinator, one for the Router):
Actual Circuit Close-up:
For now, I'm trying to establish simple communication using the following code:
Coordinator (sender):
Code:
// SENDER
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.println('K');
delay(20);
}
Router (receiver):
Code:
// RECEIVER
int LED = 13;
void setup() {
Serial.begin(115200);
pinMode(LED, OUTPUT);
}
void loop() {
if (Serial.available() > 0) {
if (Serial.read() == 'K') {
digitalWrite(LED, HIGH);
delay(50);
}
else {
digitalWrite(LED, LOW);
}
}
}
Just to make sure my xBees were working properly, I used the same circuit and code with 2 Arduino Uno's and it worked as expected (i.e., the router received the 'K' character and turned on the LED on pin 13). I even tested other variations where I sent a larger packet of data and the receiving Arduino Uno received it all. I also have the longer-range series 2 xBees (63mW) that I will be using for the actual quadcopter, but again those worked fine using 2 Arduino Uno's but didn't work with the Teensy.