I have a problem making Seeduino stalker V3 and Arduino Uno (could be also two Arduino Unos) communicate each other through XBee S1 Pro module. I have made the following setup:
Configure two Xbee modules to communicate (UartSBee with X-CTU software).
Xbee S1 Pro -> Xbee shield V2.2 (Seeedstudio) -> Arduino UNO (Seeeduino-Stalker v3)-> pc -> x-ctu with this configuration :
The program in the arduino should have an empty Setup() method and an empty loop() method.
xbee shield V2.2 have this configuration :
jumper between XB_TX and DIGITAL on the line 1
jumper between XB_RX and DIGITAL on the line 0
The X-CTU configuration XBee 1 : PAN ID= 3333, DL=2384, MY=86. XBee 2: PAN ID= 3333, DL=86, MY=2384. Made this communication permanent by writing the setting to internal eeprom
Run X-CTU -> it detect xbee and I was will be able to use it through XCTU.
Then, when I want to use my xbee with arduino IDE (in my case Arduino Uno and Seeduino stalker) . I Use UART software to Tx-Rx between Arduino UNO and Seeeduino Stalker with this wire configuration and Software code
plug a jumper wire between xbee XB_TX (pin 11 on the Seeedstudio Xbee Shield V2.2) and arduino TX1 (1) and a jumper wire between xbee XB_RX (pin 10 on the Seeedstudio Xbee Shield V2.2) and arduino RX1 (0)
Then, I pushed to code to both arduino and Stalker. Its not working. Here the code
plug a jumper wire between xbee XB_TX (pin 11 on the Seeedstudio Xbee Shield V2.2) and arduino TX1 (1) and a jumper wire between xbee XB_RX (pin 10 on the Seeedstudio Xbee Shield V2.2) and arduino RX1 (0)
That was wrong. You are talking to the XBee on pins 10 and 11. Do NOT short them to pins 0 and 1. Those pins are for talking to the PC.
I made it to work the code for sender and receiver with this code.
Sender
#include <SoftwareSerial.h>
SoftwareSerial xbee1(3, 2);
void setup( ) {
Serial.begin( 9600 );
xbee1.begin( 9600 );
Serial.println( "Ready!" );
delay( 500 );
xbee1.write( "XBee 1 says it's ready!" );
}
void loop( ) {
if( Serial.available( ) ) {
/* If data comes in from serial monitor, send it out to XBee */
xbee1.write( " it's ready!" );
}
if( xbee1.available( ) ) {
/* If data comes in from XBee, send it out to serial monitor */
Serial.write( "11111!" );
}
}
Receiver
#include <SoftwareSerial.h>
SoftwareSerial xbee1(2, 3 );
void setup( ) {
Serial.begin( 9600 );
xbee1.begin( 9600 );
Serial.println( "Ready!" );
delay( 500 );
xbee1.write( "XBee 1 says it's ready!" );
}
void loop( ) {
if( Serial.available( ) ) {
/* If data comes in from serial monitor, send it out to XBee */
xbee1.write( Serial.read( ) );
}
if( xbee1.available( ) ) {
/* If data comes in from XBee, send it out to serial monitor */
Serial.write( xbee1.read( ) );
}
}
But when I attached a sensor (Animomenter) on the sender and try to send the sensor data to the Receiver it does not receive it. Here the Sender and Receiver code with trying to send a sensor data
Sender
#include <Wire.h>
#include <SoftwareSerial.h>
SoftwareSerial xbee1(3, 2);
// ----CONSTANTS (won't change)
#define SENSOR1 A0
//------- VARIABLES (will change)
int sensorValue;
float outVoltage;
int Level;
void setup() {
Serial.begin(9600);
xbee1.begin( 9600 );
}
void loop() {
sensorValue = analogRead(A0);
outVoltage = sensorValue * (5.0 / 1023.0);
delay (50);
Level = 6*outVoltage;//The level of wind speed is proportional to the output voltage.
int val = map(Level, 0, 30, 0, 30);
Serial.println(val);
delay (500);
xbee1.write(val);
if( Serial.available( ) ) {
/* If data comes in from serial monitor, send it out to XBee */
xbee1.write( Serial.read( ) );
}
if( xbee1.available( ) ) {
/* If data comes in from XBee, send it out to serial monitor */
Serial.write( xbee1.read( ) );
}
}
Reciever
#include <SoftwareSerial.h>
SoftwareSerial xbee1(2, 3);
void setup() {
Serial.begin(9600);
delay( 10 );
xbee1.begin( 9600 );
}
void loop() {
if( Serial.available( ) ) {
/* If data comes in from serial monitor, send it out to XBee */
xbee1.write( Serial.read( ) );
}
if( xbee1.available( ) ) {
/* If data comes in from XBee, send it out to serial monitor */
Serial.write( xbee1.read( ) );
}
}