2012-11-02 09:05 AM
Didn't find a better location to post, so excuse the perhaps slightly off topic question.
I am using a LSM303 (accelerometer/magnetometer) for detection of pitch/roll/attitude angles which then go through a PID controller to set the pulse width of a PWM controller to set the speed of a brushless motor. The software side seems to work quite well and I am getting good data (over I2C) when I disconnect the motors (3.7V, 1A each). When I connect them, I get very noisy data on the lines. I initially thought that spikes from the motors are causing this and implemented schottky diodes across the MOSFETs as well as capacitors to adequately dampen the response (the spikes measured at the motor leads now come in at about 4.5V peak). I checked all lines and there is very little noise (0.1Vpp on the battery, <10mV on digital lines). All digital components have bypass capacitors and the line is regulated with a LDO regulator (after going through a LC filter). I also checked the data on the I2C bus and everything looks good (using 1k pullups). I tired different update rates, both 100 & 400k bus speeds, high/low resolution, polling only one axis at a time and different ranges, but I still get this strange data: This was taken by setting the sensitivity to +-16g, rewriting the firmwar so that the motors would turn on once a connection over bluetooth was established, then gather data with each measurement point. Once all the samples were gathered, the motors are stopped an the data sent over BT. Note that the unit was held stationary, so this does not represent any movement (or very little). At higher sensitivity, the values exceed the maximum (2^12) on a number of occasions. As a side note, since the datasheet of the LSM303 has very little information, the way that each value was obtained is through: accel=integer(MSB << 8 + LSB) / 16. Does anyone have any idea of why I might be seeing this level of noise? I've separated the high power side (mosfets, diodes) from the logic side by some distance but am still seeing this problem... #lsm303dlhc2012-11-12 07:18 AM
Maybe you cantry posting your request into the iNEMO/MEMS post.
https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32F%20MEMS%20%20iNEMO/AllItems.aspx
Best REgards, Billino