1
\$\begingroup\$

I'm working with vibration analysis on electric motors (AC). I have a mBed FRDM-K64F with a EVAL-ADXL357 connected to it - mounted onto a motor.

The device samples from the FIFO 4000 times per second, and afterwards converts the samples to m/s^2 and transmits them to our server. It does this one time per hour.

The first 4000 samples (after the microcontroller has been reset) look like this (converted to m/s^2) - The data here looks fine, except for the huge spikes: First package of 4000 samples

The following 4000 samples look like this: Second package of 4000 samples

And the third, and following, package(s) of 4000 samples look like this: enter image description here

When I reset the microcontroller the same "process" happens again.

The piece of code I use to sample from the accelerometer is the following:

SPI accl(PTD2, PTD3, PTD1); //mosi, miso, sclk
DigitalOut cs(PTD0); //Chip Select
int idRawData = 0;
uint32_t axisMeasures[37000];
Ticker tickRawData;
float sampleRateRawData = 0.00025;

void tickFuncRawData() {

    cs = false;
        accl.write((0x11<<1) | 0x01);
        for(int i = 0; i < 9; i++) {
            axisMeasures[i+idRawData*9] = accl.write(0xAA);
        }
    cs = true;

    idRawData++;

    if (idRawData == 4000) {
        tickRawData.detach();   
    }
}

tickRawData.attach(&tickFuncRawData, sampleRateRawData);

In order to find out what causes the problem, I have implemented some "printf" logging to output data at various stages in the sampling and converting process, and these are the first 9 entries in the axisMeasures array, from the third package of 4000 samples (the third chart):

No. 0. Value = 86  //x
No. 1. Value = 102 //x
No. 2. Value = 65  //x
No. 3. Value = 85  //y
No. 4. Value = 86  //y
No. 5. Value = 32  //y
No. 6. Value = 88  //z
No. 7. Value = 27  //z
No. 8. Value = 192 //z

The corresponding x, y and z values converted to m/s^2 are:

270.96, 267.62, 276.32

So basically the problem is that huge spikes and later a huge offset are/is gradually "added" to the samples. These extremely high values are not generated naturally by the vibration coming from the motor.

I hope you can help me solve this issue. Please let me know if your need more information AND please bear with me - I'm not so experienced when it comes to electrical engineering :-)

Thanks!

Link to datasheet for ADXL357: ADXL357 Datasheet

\$\endgroup\$
  • \$\begingroup\$ It looks more like a problem with data alignment - as though your read process isn't breaking the incoming bits into bytes at the right places. \$\endgroup\$ – JRE Nov 10 '19 at 11:10
  • \$\begingroup\$ The first run (apart from a couple of spikes) appears sorta normal, but the ones after that are messed up. Looks to me like the buffer you are using (axisMeasures) is not being correctly configured after the first run. I would be looking closely at how the buffer is managed. \$\endgroup\$ – Peter Smith Nov 10 '19 at 13:43
  • \$\begingroup\$ It could also be bit-flip noise on your MISO line (induced signal by the motor drive, perhaps?). Try slowing data rate down a bit, see if that helps \$\endgroup\$ – stiebrs Nov 11 '19 at 12:42

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.