I have a fio v3 + a 9DOF sensor hooked up to an XBEE. On another UNO board, I have a GSM shield and another XBEE board.

The fiov3 is supposed to sample data from the sensor, send it through the xbee. The receiving XBEE will then receive and pass the data to the UNO. The UNo then activates the GSM shield on condition.

However my resulting output on the UNO is as shown :

enter image description here

The data received is corrupted.



Set up a software serial port to pass data between an XBee Shield
and the serial monitor.

Hardware Hookup:
  The XBee Shield makes all of the connections you'll need
  between Arduino and XBee. If you have the shield make
  sure the SWITCH IS IN THE "DLINE" POSITION. That will connect
  the XBee's DOUT and DIN pins to Arduino pins 2 and 3.
// We'll use SoftwareSerial to communicate with the XBee:
#include <SoftwareSerial.h>
// XBee's DOUT (TX) is connected to pin 2 (Arduino's Software RX)
// XBee's DIN (RX) is connected to pin 3 (Arduino's Software TX)
SoftwareSerial XBee(2, 3); // RX, TX

void setup()
  // Set up both ports at 9600 baud. This value is most important
  // for the XBee. Make sure the baud rate matches the config
  // setting of your XBee.

void loop()
  if (Serial.available())
  { // If data comes in from serial monitor, send it out to XBee
  if (XBee.available())
  { // If data comes in from XBee, send it out to serial monitor


#include <SPI.h> // Included for SFE_LSM9DS0 library
#include <Wire.h>
#include <SFE_LSM9DS0.h>

#define LSM9DS0_XM  0x1D // Would be 0x1E if SDO_XM is LOW
#define LSM9DS0_G   0x6B // Would be 0x6A if SDO_G is LOW
// Create an instance of the LSM9DS0 library called `dof` the
// parameters for this constructor are:
// [SPI or I2C Mode declaration], [gyro I2C address], [xm I2C address]

const byte INT1XM = 4; // INT1XM tells us when accel data is ready
//const byte INT2XM = 8; // INT2XM tells us when mag data is ready
//const byte DRDYG = 7;  // DRDYG tells us when gyro data is ready
const int buttonPin = 15;     // the number of the pushbutton pin

int buttonState = 0;    

void setup(){

  pinMode(INT1XM, INPUT);
  //pinMode(INT2XM, INPUT);
  // pinMode(DRDYG, INPUT);
  pinMode(buttonPin, INPUT);  


  Serial.begin(115200); // Start serial at 115200 bps
  // Use the begin() function to initialize the LSM9DS0 library.
  // You can either call it with no parameters (the easy way):

  uint16_t status = dof.begin();
  // Or call it with declarations for sensor scales and data rates:  
  //uint16_t status = dof.begin(dof.G_SCALE_2000DPS, dof.A_SCALE_6G, dof.M_SCALE_2GS);

  // begin() returns a 16-bit value which includes both the gyro and
  // accelerometers WHO_AM_I response. You can check this to make sure
  // communication was successful.
  // Serial.println(status, HEX);


void loop(){


   buttonState = digitalRead(buttonPin);

  if (buttonState == 1) {   

    //  Serial1.println("Hello!"); 


  //if (Serial1.available()){
     // Serial.write(Serial1.read());
//  }


void printAccel()
  // Only read from the accelerometer if the accel interrupts,
  // which means that new data is ready.
  if (digitalRead(INT1XM))
    // Use the readAccel() function to get new data from the accel.
    // After calling this function, new values will be stored in
    // the ax, ay, and az variables.

    Serial.print("A: ");

    // Using the calcAccel helper function, we can get the
    // accelerometer readings in g's.
    Serial.print(", ");
    Serial.print(", ");

    Serial1.print("A: ");

    // Using the calcAccel helper function, we can get the
    // accelerometer readings in g's.
    Serial1.print(", ");
    Serial1.print(", ");


Any idea how to mitigate this would be greatly appreciated.

  • Are the xbees addressing each other? Sometimes if you don't directly address each other (ie you are in broadcast mode) data gets dropped. – Treesrule14 Nov 4 '14 at 16:41
  • 1
    @Treesrule14 How would I go about checking that? I am a little new to the XBEE. If you could post an example/tutorial, that will be highly appreciated. – user4985 Nov 4 '14 at 16:46
  • Do you have a module which can connect the units to the computer? If so you can use XCTU try using this tutorial once you have downloaded it. youtube.com/watch?v=EA-2Xa5OAY8. – Treesrule14 Nov 4 '14 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.