Hello everyone, first time post and first time user to the hacker hobby world. I’m pretty exited about all the projects I’ve seen posted online and all the cool things that can be done. Hopefully my first post has all the information needed to troubleshoot this. So, on to my dilemma…
I have 2 UNO boards- 1 is a TX and the other is an RX. The problem is that I can receive data but can’t send data. I also can’t upload any code to the Arduino as long as the Xbee is connected. As soon as I disconnect the TX/RX lines (pins 1/0 respectively) on the UNO, I am able to upload code to it (after hitting the reset button on the UNO). Now, I can send the ‘l’ and ‘h’ commands (see code below) to the RX UNO board if I use the Explorer USB on the xbee and connect using hyperterminal or X-CTU.
I’ve read several posts on how there are problems with the Regulated explorer http://gluonpilot.com/forum/viewtopic.php?f=2&t=167 so I decided to connect the Xbee’s directly to the Uno with a few wire connectors http://www.sparkfun.com/products/9386. Although my original connection was done using the Regulated explorer. I also saw this post http://www.arduino.cc/cgi-bin/yabb2/YaB … 1292582025 which sounded exactly like my problem but there wasn’t a mention of a solution. This post http://www.arduino.cc/cgi-bin/yabb2/YaB … 700182/all is also similar but all of my stuff is soldered and I have checked all the connections with a multimeter and checked for continuity. The xbee manual says the 900 pro can draw up to 210mA and must be 3.3v-3.6v to operate. I have read that this is acceptable from the 3.3v pin on the Arduino UNO. I thought it might be a power problem but I’m not sure so I thought I would ask to see if anyone has any experience with the 900 pro and the UNO’s before I start messing things up
Hardware:
2 Arduino Uno’s http://www.sparkfun.com/products/9950
2 Xbee pro 900’s http://www.sparkfun.com/products/9099
1 Explorer USB http://www.sparkfun.com/products/8687
1 Explorer Regulated (with the diode removed and shorted out) http://www.sparkfun.com/products/9132 and viewtopic.php?f=13&t=25974
1 ProtoShield kit http://www.sparkfun.com/products/7914
Software:
TX:
#include <NewSoftSerial.h>
#define rxPin 0 //set the rxpin to 0
#define txPin 1 //set the txpin to 1
#define BAUDRATE 57600 //baud rate of xbees
//NewSoftSerial usage
//mySerial(ReceivePin, TransmitPin);
NewSoftSerial tx(rxPin, txPin);
const int sndLow = 'l'; //send a light led low command
const int sndHigh = 'h'; //send a light led high command
const int LED = 3; //led on the protoshield to notify button pushed
const int READY = 4; //led on the protoshield to notify that the waits are complete
const int BUTTON = 2; // the number of the pushbutton pin
int btnState = LOW; // variable for reading the pushbutton status
int count = 0; //variable used for alternating button presses
void setup() {
// initialize serial communication:
tx.begin(BAUDRATE);
Serial.begin(BAUDRATE);
//setup the LED as an output
pinMode(LED, OUTPUT);
pinMode(READY, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(BUTTON, INPUT);
delay(5000);
digitalWrite(READY, HIGH); // set the LED on
}
void loop() {
// read the state of the pushbutton value:
btnState = digitalRead(BUTTON);
// check if the pushbutton is pressed.
if (btnState == LOW) {
digitalWrite(READY, LOW); // set the READY off
count++; //increment the count variable so we can alternate between presses
Serial.print(count); //echo out the count to the monitor
if (count == 1) { //if the count is 1 then set led to off
digitalWrite(LED, LOW); // set the LED low
tx.print(sndLow);
tx.flush(); //flush the stream
} else if(count == 2) { //if the count is 2 then set led to on
count = 0; //reset the count
digitalWrite(LED, HIGH); // set the LED high
tx.print(sndHigh);
tx.flush(); //flush the stream
}
delay(5000); //a wait to slow my efforts
digitalWrite(READY, HIGH); // set ready to on
}
} //end loop
RX:
#include <NewSoftSerial.h>
#define rxPin 0
#define txPin 1
#define BAUDRATE 57600
// rx pin, tx pin
NewSoftSerial rx(rxPin, txPin);
const int LED = 13; // the pin that the LED is attached to
void setup() {
// initialize serial communication:
Serial.begin(BAUDRATE);
rx.begin(BAUDRATE);
// initialize the LED pin as an output:
pinMode(LED, OUTPUT);
digitalWrite(LED, LOW); // pull low to turn on!
}
void loop() {
// see if there's incoming serial data:
int c;
while (1) {
c = rx.read();
if (c == 'h') {
digitalWrite(LED, HIGH);
}
// if it's an L (ASCII 76) turn off the LED:
if (c == 'l') {
digitalWrite(LED, LOW);
}
} //end while
} //end loop
TX UNO:
I’m using the 2 LEDs and 1 of the push buttons on the protoshield to run the TX code. Nothing else is connected to this board (except the xbee).
RX UNO:
Nothing is on this board except the xbee.
Wiring (the same for both TX and RX boards):
Xbee pin 1 to Arduino 3.3.v pin
Xbee pin 10 to Arduino ground pin
Xbee pin 2 (DOUT) to Arduino pin 9 (RX)
Xbee pin 3 (DIN) to Arduino pin 1 (TX)
According to the 900 Pro this is the minimum that is needed to operate it.
Configuration:
Both Xbee’s and the code are configured to use 57600 Baud rate. Parity is set to none. Stop bits is set to 1. Data bits is set to 8. Flow control is set to none
Any help is greatly appreciated. Thank you. -Eric