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 onhigh values (1600/3200, but espetially 1600) I get some very regular disturbances with same amplitude at64 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.
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: