LSM303DLHC Noise

Hi,
I have a setup using a LSM303DHLC accelerometer/magnetometer and am trying to use it to determine pitch/roll/direction information. I am getting fairly good data from the accel when everything is running without any major power being used. However, the goal of the project is to have a self stabilizing unit, so the data is run through a PID controller and then to a PWM unit that controls the speed of two motors. As soon as the motors kick in, the noise on the accels becomes overwhelming. I have implemented reverse diodes (high speed schottky) and filtering capacitors on the motors and checking the noise levels there, I don’t see any issues (peak goes to about 4.5V with a 3.7V source). Also, the noise is not generated due to motion (I have decoupled the motors and am holding the accel still). I have changed sensitivity, frequency, I2C speed all with the same results.
When I transmit raw data (first gather, then transmit) and convert the raw data to acceleration (using Accel=Integer(MSB << 8 + LSB) / 16 ) I get something like this:

What I find strange is that the values are originally looking good (this is at 16G sensitivity, higher sensitivity exceeds the max values quite quickly) and then something occurs. The Z value seems to come back to a useful range, but X and Y don’t…

Any ideas of what this could be? The only thing that comes to mind is noise on the lines, but I have heavily decoupled and bypassed all the components separately and measured the noise levels to find very little noise…

Thanks
Ben

What do you mean by “checking the noise”? Are you using a good oscilloscope with at least 100 MHz bandwidth? If so, what do you measure (peak and rms) on the motor leads, the I/O and power traces to the accelerometer and CPU chips when the motors kick in. Also, what is your construction technique?

That looks a lot like readings of vibrations to me. How do you “decouple” the motors from the sensor?
Lift your chassis into the air, then detach the acceleration sensor (keeping the wires connected) and put it on a sturdy table with a thick book on top of it to stabilize it. (Chassis should not be on the same table, to minimize vibration transmission.) Does it still get those spikes?

I’m using a LeCroy 300MHz 4 channel DSO to measure the voltages. I don’t have the data in front of me, but the Vpp on the digital lines does not exceed 10mV (@3V nominal). What little I do see, I might attribute to the scope being out of cal. As to construction, this is surface mounted components on a 2 layer PCB. Parts are kind of close together (<1 in) so that might be an issue, not sure. As to mechanically decoupling, exactly what you state. Logic on one board, motors on another, connected via cable (tried with long and short cables, parts connected and not - same outcome). Plus, keep in mind that these values are the equivalent of +/- 2g, so not the kind of vibration that would come from an unsteady hand. I’ll see if I can post the motor voltages during the week…

If your DSO has an FFT function, the major frequency components of the noise might give you a hint about the source. For example, do they depend on motor rpm or PWM frequency?

I don’t think that this is a function of PWM frequency or duty cyle. I have tried multiple frequencies between 1kHz and 100kHz with very little difference. The duty cycle was fixed at 50% for this plot but with different (fixed) values, it basically looks the same.
What is strange (should maybe have mentioned this earlier) is that if I set the accel to be disabled on any of the axes (i.e. clear XEn, YEn or ZEn for CTRL_REG1_A (Address 0x20)) the value I receive is not zero but shows the same/similar noisy signal. At first I thought there might be something wrong on the I2C lines, but they look sharp and crisp and nothing else is communicating on that bus. It almost seems as if there was some electrostatic field that is moving the mems sensor irrespective of acceleration. Is that possible? How would I check/fix that?

P.S. thanks for the replies so far…

Well, there is the built in magnetometer, which would be affected by the motor magnetic fields… Crosstalk?

Tried with the Magnetometer in power down mode. Same deal. I would expect this to be based on a hall effect sensor so provided it is powered down there should be no effect.

This would be my guess as to what’s happening. Do you have your setup connected with wires in a way that you could try moving the LSM303DLHC closer and farther from the motors while they’re running without changing any connections to see what effect that has?

Can you try twisting your motor leads to see if that cuts down on the noise?

- Kevin