Accelerometer data transfer with XBee

Hi guys,

I am working on a project where I am trying to measure acceleration data wirelessly. This is my equipment:

Arduino UNO
ADXL 345 accelerometer
Xbee Shield from sparkfun
Xbee Explorer from sparkfun
2 Xbee series 1 wireless modules

The acceleration data is displayed correctly when Arduino is connected, but when I try to receive the data wirelessly with XCTU software, all I get is an infinite string of hexadecimal characters and the ASCII values.

I usually use hyperterminal to store the data into a csv file so that I can process it later, but again, when I try the wireless connecction, weird nonsense characters appear instead of the values I want.

How can I modify my code or my xctu configuration to obtain the values in decimal notation so that I can process them?

This is the code that I uploaded to the Arduino board:

#include <Wire.h>
#include <ADXL345.h>
#include <SoftwareSerial.h>

ADXL345 adxl; //variable adxl is an instance of the ADXL345 library
SoftwareSerial XBee(2, 3); // RX, TX

int x,y,z; //Boring accelerometer stuff
unsigned long Time; //time vector
int dt; //sampling time

// variables of settings for ADXL345
int rangeval = 2; //2,4,8,16
bool fullResBit = 0;
double OutputDataRate = 800;

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()
  Time = millis(); //get the time in milli second
  dt = 10; //sampling time in milli second

  // set the sampling to 
  if ((Time % dt) == 0){
    adxl.readAccel(&x, &y, &z); //read the accelerometer values and store them in variables x,y,z
    // Output x,y,z values


Thank you very much in advance


Do you understand the difference between print() and write()? Why are you using write() to send data to an application that expects ASCII data?

Hi PaulS,

I do understand, I might be wrong though. As far as I know, Arduino has to write the values to XCTU software so that XCTU can read them.

As you can see in the code, the values are of type int. However, in the XCTU software (Xbee/RF configuration platform), the values are shown in ascii and hexadecimal notation.

So my problem is that I don't know what to do to transform any of those notations to decimal so that I can process them.

So my problem is that I don't know what to do to transform any of those notations to decimal so that I can process them.

Then write a simple sketch that sends an int to the Serial Monitor, using write() and print(). Learn what the difference between the two functions. Learn which is appropriate to use when.