XBee via SIP Adapter not passing serial data to RX of Arduino
concyse
Posts: 4
I'm trying to test basic communications using XBee (pro s2b) in simple 'AT' mode. Using XCTU's I can pass simple ASCII back and forth, so the XBees are talking to one another fine. Then I connected a Parallax SIP card to to either end and wired them to a pair of Uno's. The Send side of the pair shoots some simple text over the air based on a simple input. I connected the Receive end to an XCTU to ensure the data was transmitting, and the ASCII strings came in just fine - so the Send side of the pair is working great. However, when I put the Receive radio in place and try to capture the RX signal into the Receiving UNO, I get nothing.
I can see all the TX and RX lights flash in a healthy way on the SIP adapter boards. It's as if the Uno's RX isn't listening (put on default pins 0,1 for the serial comms). If I take the XBees out of the equation and wire the RX and TX from both the Uno's directly together the code executes fine and the serial data is passing as it should.
It's as if everything works fine from: Send-UNO > XBee > to other XBee > ...and then the RX signal output from the 2nd XBee isn't 'strong' enough to drive the RX input of the receiving Uno.
Thanks to anyone who has advice to offer.
I can see all the TX and RX lights flash in a healthy way on the SIP adapter boards. It's as if the Uno's RX isn't listening (put on default pins 0,1 for the serial comms). If I take the XBees out of the equation and wire the RX and TX from both the Uno's directly together the code executes fine and the serial data is passing as it should.
It's as if everything works fine from: Send-UNO > XBee > to other XBee > ...and then the RX signal output from the 2nd XBee isn't 'strong' enough to drive the RX input of the receiving Uno.
Thanks to anyone who has advice to offer.
Comments
I've greatly reduced the code to bare essentials in order to go upstream as far as possible. I've basically set the receiving end to set pin13 high on the Arduino for any Serial event, and it triggers when I connect serial data directly to the TX/RX from another source.
I'm suspecting there may be some wiring needed but every respectable tutorial out there doesn't seem to point to any - but few if any are using the SIP adapter as part of their solution either.
I've tried using a simple SerialEvent() to throw a flag and indicated data received, but nothing. Below is some sample code I've used to test the end-to-end.
I'm happy to take this to the Arduino group - but I do feel like the answer lies somewhere between the output from the SIP and the input of the Arduino, I just need to find out whose side of the fence this lands.
Thanks for your help,
-Bill
/*
* ********* Doorbell Basic BELL ********
* requires pre-paired XBee Radios
* and the BUTTON program on the receiving end
* by Rob Faludi http://faludi.com
*/
#define VERSION "1.00a0"
int BELL = 13;
void setup() {
pinMode(BELL, OUTPUT);
digitalWrite(BELL, LOW);
Serial.begin(9600);
}
void loop() {
// look for a capital D over the serial port and ring the bell if found
if (Serial.available() > 0) {
if (Serial.read() == 'D'){
//ring the bell briefly
digitalWrite(BELL, HIGH);
delay(1000);
digitalWrite(BELL, LOW);
}
}
}
/*
* ********* Doorbell Basic BUTTON ********
* requires pre-paired XBee Radios
* and the BELL program on the receiving end
* by Rob Faludi http://faludi.com
*/
#define VERSION "1.00a0"
int BUTTON = 2;
void setup() {
pinMode(BUTTON, INPUT);
Serial.begin(9600);
}
void loop() {
// send a capital D over the serial port if the button is pressed
if (digitalRead(BUTTON) == HIGH) {
Serial.print('D');
delay(10); // prevents overwhelming the serial port
}
}
I have used the Sip Adapter with an Ardunio UNO and it works without issue.
Please note I do not connect it to pins 0 and 1 of the UNO which is the serial port and are even
labeled rx,tx. This port which you use Serial functions is the port to talk to the terminal and to download new
code.
Use the SoftwareSerial library to create a serial port on two other pins, I used pins 2 and 3 which if I remember
are the ones in the Software Serial examples.
I did not have to do any level shifting just direct connection to pins 2,3 and setup SoftwareSerial.
Tom
The final code on the receiving Arduino came out looking like this...
#include <SoftwareSerial.h>
int BELL = 13;
uint8_t recv = 2;
uint8_t trans = 3;
SoftwareSerial soft_serial(recv, trans);
void setup() {
pinMode(BELL, OUTPUT);
digitalWrite(BELL, LOW);
soft_serial.begin(9600);
}
void loop() {
// look for a capital D over the serial port and ring the bell if found
if (soft_serial.available() > 0) {
if (soft_serial.read() == 'D'){
//ring the bell briefly
digitalWrite(BELL, HIGH);
delay(1000);
digitalWrite(BELL, LOW);
}
}
}