Real time vibration measuring project.

Hi guys., I'm trying to make vibration sensing module with arduino nano and Xbee. I've read lots of things to make complete this project, however, my major is mechanical Eng. so i'm having trouble with this. In this form, there are similar project like me, but it was not easy to understand.
Anyway, my situation is,,,
I able to communicate with Xbee and there are 1 Receiver, 3 Sending module.
These are communicate over Xbee Pro S1, AT (not API), 802 protocol(?).

if Sending module 1 send message, 3 byte= id,valH,valL HEX code,
Receiving module receives these message, and by Serial.read() function, it identify which module sent and read values valH, valL and convert into number.

I have to make these process over 100Hz, because I'll use this system to measure vibration of machine or structure.

the baud rate is 57600, however, there are many noise and errors.

help me plz and thanks in advance.

help me plz

OK. Sentences starts with a capital letter. Plz is not a word. Please is.

You have not posted any code. You have not described the environment in which the XBees are operating. You have not defined how the XBees are configured. You have not defined how the XBees are connected to the Arduinos.

You can, therefore, not reasonably expect help.

PaulS:
OK. Sentences starts with a capital letter. Plz is not a word. Please is.

Sorry for that.. I'm not good at English..

PaulS:
You have not posted any code. You have not described the environment in which the XBees are operating. You have not defined how the XBees are configured. You have not defined how the XBees are connected to the Arduinos.

You can, therefore, not reasonably expect help.

Here is my situation and settings.

Receive module:
Arduino Uno - XBee sheid - XBee PRO S1
XBee settings : baudrate 57600 and others are default settings.(means AT communication mode)

Sending modules:
Arduino Uno - XBee sheid - XBee PRO S1
XBee settings : baudrate 57600 and others are default settings.(means AT communication mode)

Receiving sketch in Arduino Uno

//Data Receiver
byte Receive[7];
int x,y,z;

void setup()
{
  Serial.begin(57600);
  delay(1000);
}

void loop()
{
  Switch();
  delay(10); 
}

void Switch()
{
  if(Serial.available()) 
  {
    char inByte=Serial.read();
    switch (inByte) {
    case 0xAA:
      getdata();
      break;
    case 0xAB:
      getdata();
      break;
    case 0xAC:
      getdata();
      break;
    case 0xAD:
      getdata();
      break;
    default:
      Serial.println("NON");
      break;
    }
  }
}
void getdata()
{
  for(int i=0;i<6;i++)  
  {
    Receive[i]=Serial.read();
  }
  x=((Receive[0]<<8)|Receive[1]);
  y=((Receive[2]<<8)|Receive[3]);
  z=((Receive[4]<<8)|Receive[5]);
  Serial.println(x);
  Serial.print(y);
  Serial.print(z);
  Serial.println();
}

Sending module A sketch in Arduino

void setup()
{
  Serial.begin(57600);
  delay(1000);
}

void loop()
{
  accelvalue();
  //Serial.println();
  delay(10);

}
//send 30000,27000,20000 value
void accelvalue()
{
  byte id=0xAA;
  byte xH=0x75;
  byte xL=0x30;
  byte yH=0x69;
  byte yL=0x78;
  byte zH=0x4E;
  byte zL=0x20;
  char data[7]={
    id,xH,xL,yH,yL,zH,zL  };

  for(int i=0;i<6;i++) Serial.print(data[i]);
}

These sketches are made for checking correct communication is available over 100Hz.

As you can see over the sketches, if SenderA module sending 7 byte starting with id (0xAA), Receiving module checks first byte to identify which module sent the message. After that, Receving modules receives accelation values in 6 byte.

However, when I did this sketch, there are many NON and not vaild values in Serial moniter.

I think these sketch are simple to operate over 100Hz, however, it couldn't working over than 100Hz.

Can you give me some advice?

Thanks.

Receiver.ino (760 Bytes)

Could it be that you think you are sending the hexadecimal representation of your values?

When you go Serial.print((byte)0xAA), the arduino does not send two ASCII 'A's (65, I think) - it sends 8 binary bits 10101010 over the wire (or possibly in reverse. Whatever.). If you look at that on a serial monitor you wont see 'AA', you'll see … well, it depends on your encoding.

If you want to send the hex as text, you can do that. Of course, you'll have to decode it at the other end to get numeric values.

for(int i=0;i<6;i++) {
  char digit = (data[i] >> 4) & 0xF;
  Serial.print((char)((digit >= 10 ? 'A'-10 : '0') + digit));
  char digit = (data[i]) & 0xF;
  Serial.print((char)((digit >= 10 ? 'A'-10 : '0') + digit));
}

XBee settings : baudrate 57600 and others are default settings.(means AT communication mode)

It means more than that. It means that your devices are in broadcast mode, which is slow. Set DL on one equal to MY on the other, with neither value 0 or FF.

For instance, use MY=34 and DL=87 on one XBee and use MY=87 and DL=34 on the other XBee.