ADXL345 High noise at 64Hz and its multiples

Hello everyone,

Currently for my project I’m using ADXL345 sensor on an original SparkFun beakout board, connected to Arduino Nano board, powered by a 9V battery, communicating with pc trought Bluetooth module HC-05 at 115200 baud/s.

Setting the sampling frequency on high values (1600/3200, but espetially 1600) I get some very regular disturbances with same amplitude at 64 Hz and its precise multiples (128, 192… until available bandwidth).

In the annexes there is the spectrum of a signal (peaks not at the previously mentioned frequences are supposed to be there), sampling freq 1600Hz, 10s of acquisition

Have you ever experienced something similar? do you have any idea what it could be?

P.S. some more info that could be useful:

  • the communication protocol is SPI. I checked and the default SPI clock from Arduino is 4MHz (16MHz from processor / 4), which greater than the required.

  • 2 Logic level converters to convert 8 I/O from 3.3V to 5V and reverse between the sensor and Arduino

  • To transfer data I adopted the following logic: FIFO buffer gets filled up with 25 values, watermark interrupt triggers and Arduino reads 25 times (so the FIFO gets empty). Arduino then sends 252channels bytes to the pc with the command Serial.write.

  • I’ve already tried to change Bluetooth connection with usb cable instead, tried to change baud rate, tried to change Arduino board. In all the cases no changes. Only one small detail, when passing from 115200 baud/s to 74880 baud/s the first peak appears to be at 128Hz rather than 64Hz.

What annexes? Can’t see anything like a frequency plot. Anyway, regular peaks at multiples of a certain frequency means there is irregularity in your datastream. Do you send the data in bulk over serial? Like 252channels bytes in one go? Or are the samples sent per sample over serial. The SPI interupt and serial transmission interrupt might get into a timing conflict if you sent over serial in large packs of samples.

Thanks Valen for replaying.

Sorry for the attachment, I thought I uploaded it.

Anyway, I thought the same since 64 is a very special number when talking about electronics.

Data transmission is triggered by the watermak interrupt (so it’s not continuous), when it starts two bytes are sent one after the other for 25 times (rather than an array of 25 bytes). Follows code of ISR in case of single channel (Z direction) acquisition to give a better undestanding:

void ISR_WatermarkZ(){
  for(int kk=0; kk<sizeBuffer; kk++){   // sizeBuffer==25
    readRegister(DATAZ0, 2, values);    // reads from sensor
    Serial.write(values[0]);                        // LSB, writes over serial
    Serial.write(values[1]);                        // MSB
  }
  if(watermark>=nBatch){                       // terminating condition
    noInterrupts();
    writeRegister(INT_ENABLE, 0b00000000);        //disable interrupts 
    writeRegister(POWER_CTL, 0x00);                        //sleep mode accelerometer
    interrupts();
    stopcontrol=1;
  }
  watermark++;
}

Actually the problem is still the same also in case of 3 channels acquisition (X,Y,Z), where the method is slightly different:

void ISR_WatermarkXYZ(){                          // x-y-z channels 
  for(byte kk=0; kk<sizeBuffer; kk++){
    readRegister(DATAX0, 6, values);        
    for(byte pp=0; pp<6; pp++){
      Serial.write(values[pp]);                   // sends an array of 6 bytes, from LSB X to MSB Z
    }  
  }
  if(watermark>=nBatch){
    writeRegister(INT_ENABLE, 0b00000000);        //disable interrupts 
    writeRegister(POWER_CTL, 0x00);               //sleep mode accelerometer
    stopcontrol=1;
  }
  watermark++;
}

thanks again for your help